Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E Testing: Fungible Token Flows #12

Open
14 tasks
TrevorJTClarke opened this issue Jan 26, 2022 · 0 comments
Open
14 tasks

E2E Testing: Fungible Token Flows #12

TrevorJTClarke opened this issue Jan 26, 2022 · 0 comments

Comments

@TrevorJTClarke
Copy link
Member

Unit Tests

  • Add unit tests here: https://github.com/Cron-Near/treasury/blob/main/treasury/src/ft_impl.rs#L205
  • Test: Can prepare for future tests: deploy basic FT, mint balance to need holders: dao, treasury, etc
  • Test: can store_ft_balance_of
  • Test: can get ft_balances
  • Test: Can get list o supportedf ft tokens: get_ft_list
  • Test: Can get list of ft tokens & its balances: ft_balances
  • Test: Can make an FT transfer: ft_transfer

Workspace Tests

  • Add tests here: https://github.com/Cron-Near/treasury/blob/main/e2e/src/ft_impl.rs
  • Test Flow: Receive & Transfer
    • Mint some default tokens to an account
    • update internal balances using store_ft_balance_of
    • Check list of supported FT tokens get_ft_list
    • Check balances of FT tokens ft_balances
    • Transfer some FT tokens (ft_transfer) & validate (directly on the FT contract, with ft_balance_of)

Security Implications:

  • TBD - TC

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant