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: Fungible Token Flows #12

Open TrevorJTClarke opened 2 years ago

TrevorJTClarke commented 2 years ago

Unit Tests

Workspace Tests

Security Implications:

Examples:

# FT balance is stored on each token account, to help these are fns that can retrieve and maintain that snapshot to be used for internal accounting.
# ------
near call $TREASURY_ACCOUNT_ID store_ft_balance_of '{"ft_account_id": "'$CHEDDAR_TOKEN'"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS

near view $TREASURY_ACCOUNT_ID get_ft_list

near view $TREASURY_ACCOUNT_ID ft_balances '{"from_index": "0", "limit": "10"}'

# NEAR_ENV=mainnet near view meta-token.near ft_balance_of '{"account_id": "croncat.sputnik-dao.near"}'
# near view $CHEDDAR_TOKEN ft_balance_of '{"account_id": "'$TREASURY_ACCOUNT_ID'"}'
# near view $TREASURY_ACCOUNT_ID ft_balance_of '{"account_id": "'$META_TOKEN'"}' --accountId $TREASURY_ACCOUNT_ID
# near view $TREASURY_ACCOUNT_ID ft_balance_of '{"account_id": "'$CHEDDAR_TOKEN'"}' --accountId $TREASURY_ACCOUNT_ID

near call $TREASURY_ACCOUNT_ID ft_transfer '{"ft_account_id": "'$CHEDDAR_TOKEN'", "to_account_id": "'$NEAR_ACCT'", "to_amount": "100000000000000000000000000"}' --accountId $TREASURY_ACCOUNT_ID --gas $MAX_GAS