2020-11-29 04:28:01 +00:00
|
|
|
*** Settings ***
|
2021-02-08 05:05:17 +00:00
|
|
|
Variables ../../../variables/common.py
|
2020-11-29 04:28:01 +00:00
|
|
|
|
2021-02-08 05:05:17 +00:00
|
|
|
Library ../${RESOURCES}/neofs.py
|
|
|
|
Library ../${RESOURCES}/payment_neogo.py
|
2021-04-26 10:30:40 +00:00
|
|
|
Library ../${RESOURCES}/utility_keywords.py
|
2021-05-07 12:14:37 +00:00
|
|
|
Library ${KEYWORDS}/wallet_keywords.py
|
|
|
|
Library ${KEYWORDS}/rpc_call_keywords.py
|
2020-11-29 04:28:01 +00:00
|
|
|
|
2021-02-20 14:05:03 +00:00
|
|
|
*** Variables ***
|
2021-05-07 12:14:37 +00:00
|
|
|
${DEPOSIT_AMOUNT} = ${10}
|
|
|
|
${WITHDRAW_AMOUNT} = ${10}
|
|
|
|
${TRANSFER_AMOUNT} = ${15}
|
2021-02-20 14:05:03 +00:00
|
|
|
|
2020-11-29 04:28:01 +00:00
|
|
|
*** Test cases ***
|
2020-11-29 04:30:45 +00:00
|
|
|
NeoFS Deposit and Withdraw
|
2020-11-29 04:28:01 +00:00
|
|
|
[Documentation] Testcase to validate NeoFS Withdraw operation.
|
|
|
|
[Tags] Withdraw NeoFS NeoCLI
|
|
|
|
[Timeout] 10 min
|
|
|
|
|
2021-04-26 10:30:40 +00:00
|
|
|
[Setup] Create Temporary Directory
|
|
|
|
|
2021-04-26 17:48:43 +00:00
|
|
|
${WALLET} ${ADDR} ${PRIV_KEY} = Init Wallet with Address ${TEMP_DIR}
|
2021-04-02 14:29:41 +00:00
|
|
|
${SCRIPT_HASH} = Get ScriptHash ${PRIV_KEY}
|
2020-11-29 04:28:01 +00:00
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
##########################################################
|
|
|
|
# Transferring GAS from initial wallet to our test wallet
|
|
|
|
##########################################################
|
|
|
|
${TX} = Transfer Mainnet Gas ${MAINNET_WALLET_WIF} ${ADDR} ${TRANSFER_AMOUNT}
|
|
|
|
Wait Until Keyword Succeeds ${MAINNET_TIMEOUT} ${MAINNET_BLOCK_TIME}
|
|
|
|
... Transaction accepted in block ${TX}
|
|
|
|
${MAINNET_BALANCE} = Get Mainnet Balance ${ADDR}
|
|
|
|
Should Be Equal As Numbers ${MAINNET_BALANCE} ${TRANSFER_AMOUNT}
|
2021-04-26 10:30:40 +00:00
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
############################
|
|
|
|
# Making deposit into NeoFS
|
|
|
|
############################
|
2021-02-20 14:05:03 +00:00
|
|
|
${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} ${DEPOSIT_AMOUNT}
|
2021-05-07 12:14:37 +00:00
|
|
|
Wait Until Keyword Succeeds ${MAINNET_TIMEOUT} ${MAINNET_BLOCK_TIME}
|
2020-11-29 04:28:01 +00:00
|
|
|
... Transaction accepted in block ${TX_DEPOSIT}
|
2021-04-26 10:30:40 +00:00
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
${MAINNET_BALANCE} = Get Mainnet Balance ${ADDR}
|
|
|
|
${EXPECTED_BALANCE} = Evaluate ${TRANSFER_AMOUNT}-${DEPOSIT_AMOUNT}
|
|
|
|
Should Be True ${MAINNET_BALANCE} < ${EXPECTED_BALANCE}
|
|
|
|
${DEPOSIT_FEE} = Evaluate ${EXPECTED_BALANCE} - ${MAINNET_BALANCE}
|
|
|
|
Log Deposit fee is ${DEPOSIT_FEE}
|
2021-04-26 10:30:40 +00:00
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
${NEOFS_BALANCE} = Get NeoFS Balance ${PRIV_KEY}
|
|
|
|
Should Be Equal As Numbers ${NEOFS_BALANCE} ${DEPOSIT_AMOUNT}
|
2020-11-29 04:28:01 +00:00
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
# TODO: try to withdraw more than was deposited
|
2020-11-29 04:28:01 +00:00
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
###########################
|
|
|
|
# Withdrawing deposit back
|
|
|
|
###########################
|
2021-02-20 14:05:03 +00:00
|
|
|
${TX} = Withdraw Mainnet Gas ${WALLET} ${ADDR} ${SCRIPT_HASH} ${WITHDRAW_AMOUNT}
|
2021-05-07 12:14:37 +00:00
|
|
|
Wait Until Keyword Succeeds ${MAINNET_TIMEOUT} ${MAINNET_BLOCK_TIME}
|
2020-11-29 04:28:01 +00:00
|
|
|
... Transaction accepted in block ${TX}
|
|
|
|
|
2021-04-02 14:29:41 +00:00
|
|
|
Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT}
|
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
${NEOFS_BALANCE} = Get NeoFS Balance ${PRIV_KEY}
|
|
|
|
${EXPECTED_BALANCE} = Evaluate ${DEPOSIT_AMOUNT} - ${WITHDRAW_AMOUNT}
|
|
|
|
Should Be Equal As Numbers ${NEOFS_BALANCE} ${EXPECTED_BALANCE}
|
2021-02-20 14:05:03 +00:00
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
${MAINNET_BALANCE_AFTER} = Get Mainnet Balance ${ADDR}
|
|
|
|
${MAINNET_BALANCE_DIFF} = Evaluate ${MAINNET_BALANCE_AFTER} - ${MAINNET_BALANCE}
|
|
|
|
Should Be True ${MAINNET_BALANCE_DIFF} < ${WITHDRAW_AMOUNT}
|
|
|
|
${WITHDRAW_FEE} = Evaluate ${WITHDRAW_AMOUNT} - ${MAINNET_BALANCE_DIFF}
|
|
|
|
Log Withdraw fee is ${WITHDRAW_FEE}
|
2021-04-26 10:30:40 +00:00
|
|
|
|
|
|
|
[Teardown] Cleanup
|
|
|
|
|
2021-05-07 12:14:37 +00:00
|
|
|
|
2020-12-29 19:55:33 +00:00
|
|
|
*** Keywords ***
|
2021-04-26 10:30:40 +00:00
|
|
|
|
2020-12-29 19:55:33 +00:00
|
|
|
Cleanup
|
2021-03-29 10:18:24 +00:00
|
|
|
Cleanup Files
|
2021-04-26 10:30:40 +00:00
|
|
|
Get Docker Logs withdraw
|