-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Stake Wars: Episode III. Challenge 008
= solidstate.shardnet.near
<staking_pool_id> = solidstate.factory.shardnet.near
RESUME: Smart-contract doesn’t work properly. It unstakes all funds from owner’s account.
root@SolidState:/near-staking-pool-owner/contract# near view solidstate.factory.shardnet.near get_account_staked_balance '{"account_id": "solidstate.shardnet.near"}'/near-staking-pool-owner/contract# near view solidstate.factory.shardnet.near get_account_unstaked_balance '{"account_id": "solidstate.shardnet.near"}'
View call: solidstate.factory.shardnet.near.get_account_staked_balance({"account_id": "solidstate.shardnet.near"})
'921669235961613096111062729'
root@SolidState:
View call: solidstate.factory.shardnet.near.get_account_unstaked_balance({"account_id": "solidstate.shardnet.near"})
'0'
root@SolidState:/near-staking-pool-owner/contract# NEAR_ENV=shardnet near deploy solidstate.shardnet.near --wasmFile target/wasm32-unknown-unknown/release/contract.wasm/near-staking-pool-owner/contract# CONTRACT_ID=solidstate.shardnet.near
Starting deployment. Account id: solidstate.shardnet.near, node: https://rpc.shardnet.near.org, helper: https://helper.shardnet.near.org, file: target/wasm32-unknown-unknown/release/contract.wasm
Transaction Id 2k7xADcbjTGCqE9jkNDMU6PbEXiFaKNN19crKtkUspV7
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.shardnet.near.org/transactions/2k7xADcbjTGCqE9jkNDMU6PbEXiFaKNN19crKtkUspV7
Done deploying to solidstate.shardnet.near
root@SolidState:
root@SolidState:~/near-staking-pool-owner/contract# NEAR_ENV=shardnet near call $CONTRACT_ID new '{"staking_pool_account_id": "solidstate.factory.shardnet.near", "owner_id":"solidstate.shardnet.near", "reward_receivers": [["solo.shardnet.near", {"numerator": 3, "denominator":10}], ["sync.shardnet.near", {"numerator": 70, "denominator":100}]]}' --accountId $CONTRACT_ID
Scheduling a call: solidstate.shardnet.near.new({"staking_pool_account_id": "solidstate.factory.shardnet.near", "owner_id":"solidstate.shardnet.near", "reward_receivers": [["solo.shardnet.near", {"numerator": 3, "denominator":10}], ["sync.shardnet.near", {"numerator": 70, "denominator":100}]]})
Doing account.functionCall()
Transaction Id 6vTh1DGyQhrotHppAcyEfmaYCuhKmWDL2299eErPr84h
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.shardnet.near.org/transactions/6vTh1DGyQhrotHppAcyEfmaYCuhKmWDL2299eErPr84h
''
root@SolidState:/near-staking-pool-owner/contract# near view solidstate.factory.shardnet.near get_account_unstaked_balance '{"account_id": "solidstate.shardnet.near"}'/near-staking-pool-owner/contract# near view solidstate.factory.shardnet.near get_account_staked_balance '{"account_id": "solidstate.shardnet.near"}'
View call: solidstate.factory.shardnet.near.get_account_unstaked_balance({"account_id": "solidstate.shardnet.near"})
'0'
root@SolidState:
View call: solidstate.factory.shardnet.near.get_account_staked_balance({"account_id": "solidstate.shardnet.near"})
'921669235961613096111062729'
root@SolidState:/near-staking-pool-owner/contract# near call $CONTRACT_ID withdraw '{}' --accountId $CONTRACT_ID --gas 200000000000000/near-staking-pool-owner/contract# near view solidstate.factory.shardnet.near get_account_staked_balance '{"account_id": "solidstate.shardnet.near"}'
Scheduling a call: solidstate.shardnet.near.withdraw({})
Doing account.functionCall()
Retrying request to broadcast_tx_commit as it has timed out [
'GAAAAHNvbGlkc3RhdGUuc2hhcmRuZXQubmVhcgBuOqpQJFqdcPQFJrXCTKbHe2JquDPLoXR5TMvQv3K16hxFBP7BAQAAGAAAAHNvbGlkc3RhdGUuc2hhcmRuZXQubmVhcma7B99QqU+X/R8kTblN10qtLkLInwXD+cmY1Ur5o1JqAQAAAAIIAAAAd2l0aGRyYXcCAAAAe30AgPQg5rUAAAAAAAAAAAAAAAAAAAAAAAAAAeDxvTXTFU1mX0Q1OBbj4+bNK76VeZXmKnfn7pLhZjQN7wCjvidWgxQZ4j1kZvZgBMauunLrcUHG6maZEvroCA=='
]
^[[A^[[AReceipts: 9to7Y5DGovwf6y7mDStj5DbMe7NixYkizRwvGvyWPgdw, 5Go7npUZxGAD8dbCarToZcTbsD8rPgmMFYX7GuJK6xMq
Log [solidstate.shardnet.near]: Unstaking all from staking pool
Receipts: DKWHBC4xzAjE56mo95sqHgN8uTHiEei6bnaExVK4eVzY, 5T59TUPddsTUpPCeLPDHCFszEkDaQp5sttUeAT4Q8R2, CYgtbvvFX353WDXzDUhVKjRGVnkATyL5WEQLuvdJumEb
Log [solidstate.shardnet.near]: @solidstate.shardnet.near unstaking 921669235961613096111062730. Spent 920187319286301369939152592 staking shares. Total 921669235961613096111062730 unstaked balance and 0 staking shares
Log [solidstate.shardnet.near]: Contract total staked balance is 3560689149877926827894609521. Total number of shares 3554964054126737620708034673
Transaction Id CiTiwMqLcPp8wKsHhn235JWgWHRY2jrvq4UXNLHxXGLZ
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.shardnet.near.org/transactions/CiTiwMqLcPp8wKsHhn235JWgWHRY2jrvq4UXNLHxXGLZ
''
root@SolidState:
View call: solidstate.factory.shardnet.near.get_account_staked_balance({"account_id": "solidstate.shardnet.near"})
'0'
return stake back
root@SolidState:/near-staking-pool-owner/contract# near call solidstate.factory.shardnet.near stake_all --accountId $CONTRACT_ID/near-staking-pool-owner/contract# near view solidstate.factory.shardnet.near get_account_staked_balance '{"account_id": "solidstate.shardnet.near"}'
Scheduling a call: solidstate.factory.shardnet.near.stake_all()
Doing account.functionCall()
Receipts: 2V89MJwjHcuRtTc1zDdmVE3cPRLE3o4jnPjJ7bMGHyqG, BgWGa3whmSZsuhZEY3ztg1mAnGXRimXQtiPjiprqJNpw, GC3zthqyFhn5M3kMgSVZmzsaR7Tsp7pc6GXBP1NUpLzA
Log [solidstate.factory.shardnet.near]: @solidstate.shardnet.near staking 921669235961613096111062729. Received 920187319286301369939152592 new staking shares. Total 1 unstaked balance and 920187319286301369939152592 staking shares
Log [solidstate.factory.shardnet.near]: Contract total staked balance is 4482358385839539924005672251. Total number of shares 4475151373413038990647187265
Transaction Id GVD2wvmsKyhsXwvfVLZqiSrDozYAN41ceGHX4De4C6R5
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.shardnet.near.org/transactions/GVD2wvmsKyhsXwvfVLZqiSrDozYAN41ceGHX4De4C6R5
''
root@SolidState:
View call: solidstate.factory.shardnet.near.get_account_staked_balance({"account_id": "solidstate.shardnet.near"})
'921669235961613096111062729'