CronCats / treasury

Autonomous treasury for enabling DAOs or any type of near account to manage multiple funds to accrue interest across different vehicles
MIT License
4 stars 2 forks source link

E2E Testing: Staking #13

Open TrevorJTClarke opened 2 years ago

TrevorJTClarke commented 2 years ago

Unit Tests

Workspace Tests

Examples:

# add/remove staking pools
near call $TREASURY_ACCOUNT_ID add_staking_pool '{"pool_account_id": "node0"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near call $TREASURY_ACCOUNT_ID add_staking_pool '{"pool_account_id": "meta-v2.pool.testnet", "liquid_unstake_function": "liquid_unstake", "yield_function": "harvest_meta", "withdraw_function": "withdraw_all"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near call $TREASURY_ACCOUNT_ID add_staking_pool '{"pool_account_id": "hotones.pool.f863973.m0"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near call $TREASURY_ACCOUNT_ID remove_staking_pool '{"pool_account_id": "hotones.pool.f863973.m0"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near view $TREASURY_ACCOUNT_ID get_delegations
near view $TREASURY_ACCOUNT_ID get_config
near view $TREASURY_ACCOUNT_ID get_info

# deposit&stake
near call $TREASURY_ACCOUNT_ID deposit_and_stake '{"pool_account_id": "meta-v2.pool.testnet"}' --accountId $TREASURY_ACCOUNT_ID --amount 10
near call $TREASURY_ACCOUNT_ID deposit_and_stake '{"pool_account_id": "hotones.pool.f863973.m0"}' --accountId $TREASURY_ACCOUNT_ID --amount 10 --gas $MAX_GAS
near call $TREASURY_ACCOUNT_ID deposit_and_stake '{"pool_account_id": "hotones.pool.f863973.m0", "amount": "100000000000000000000000000"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS

# # update internal balance
near call $TREASURY_ACCOUNT_ID get_staked_balance '{"pool_account_id": "meta-v2.pool.testnet"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near call $TREASURY_ACCOUNT_ID get_staked_balance '{"pool_account_id": "hotones.pool.f863973.m0"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near view $TREASURY_ACCOUNT_ID get_delegations

# liquidunstake
near call $TREASURY_ACCOUNT_ID liquid_unstake '{"pool_account_id": "meta-v2.pool.testnet", "amount": "5000000000000000000000000"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near call $TREASURY_ACCOUNT_ID liquid_unstake '{"pool_account_id": "meta-v2.pool.testnet"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS

# unstake
near call $TREASURY_ACCOUNT_ID unstake '{"pool_account_id": "meta-v2.pool.testnet"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS
near call $TREASURY_ACCOUNT_ID unstake '{"pool_account_id": "hotones.pool.f863973.m0", "amount": "5000000000000000000000000"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS

# withdraw
near call $TREASURY_ACCOUNT_ID withdraw '{"pool_account_id": "meta-v2.pool.testnet"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS

# withdraw
near call $TREASURY_ACCOUNT_ID yield_harvest '{"pool_account_id": "meta-v2.pool.testnet"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS