-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
integration_test/confidential_transfers_module/ct_precompile_queries.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Tests for querying ct account via precompile. These tests depend on initialize_account_tests running and passing. | ||
- name: Test querying confidential token account via precompile | ||
inputs: | ||
# Setup test account | ||
- cmd: printf "12345678\n" | seid keys add ctquerytest | ||
- cmd: printf "12345678\n" | seid keys show -a admin | ||
env: ADMIN_ADDR | ||
- cmd: printf "12345678\n" | seid keys show -a ctquerytest | ||
env: TEST_ADDR | ||
- cmd: printf "12345678\n" | seid tx bank send $ADMIN_ADDR $TEST_ADDR 100000000uatom -b block --fees 2000usei --chain-id sei -y --output json | jq -r ".code" | ||
- cmd: printf "12345678\n" | seid tx bank send $ADMIN_ADDR $TEST_ADDR 1sei -b block --fees 2000usei --chain-id sei -y --output json | jq -r ".code" | ||
|
||
# Initialize confidential token account for denom uatom for admin | ||
- cmd: printf "12345678\n" | seid tx ct init-account uatom --from ctquerytest --fees 4000usei --chain-id sei -b block -y --output json | jq -r ".code" | ||
env: INIT_ACCOUNT_CODE | ||
|
||
# Deposit to the confidential token account | ||
- cmd: printf "12345678\n" | seid tx ct deposit 500000uatom --from ctquerytest --fees 4000usei --chain-id sei -b block -y --output json | jq -r ".code" | ||
env: DEPOSIT_CODE | ||
|
||
# Query the account state | ||
- cmd: printf "12345678\n" | seid q ct account uatom $TEST_ADDR --output json | ||
env: ACCOUNT_STATE | ||
- cmd: echo $ACCOUNT_STATE | jq -r ".pending_balance_credit_counter" | ||
env: PENDING_BALANCE_COUNTER | ||
- cmd: echo $ACCOUNT_STATE | jq -r ".decryptable_available_balance" | ||
env: AVAILABLE_BALANCE_CIPHER | ||
|
||
# Query the account to verify the new account state via precompile | ||
- cmd: cast call 0x0000000000000000000000000000000000001010 "account(string,string)((bytes,bytes,bytes,uint32,bytes,string))" $TEST_ADDR uatom | ||
env: ACCOUNT_STATE_PRECOMPILE | ||
- cmd: echo $ACCOUNT_STATE_PRECOMPILE | jq -R -r "split(\", \")[3]" | ||
env: PENDING_BALANCE_COUNTER_PRECOMPILE | ||
- cmd: echo $ACCOUNT_STATE_PRECOMPILE| jq -R -r "split(\", \")[5]"| sed -e s/\"\)//g -e s/\"// | ||
env: AVAILABLE_BALANCE_CIPHER_PRECOMPILE | ||
verifiers: | ||
# Verify that the account exists after the instruction is executed. | ||
- type: eval | ||
expr: INIT_ACCOUNT_CODE == 0 or INIT_ACCOUNT_CODE == 38 | ||
|
||
# Verify that the deposit was successful | ||
- type: eval | ||
expr: DEPOSIT_CODE == 0 | ||
|
||
# Verify that the pending balance counter is the same in both queries | ||
- type: eval | ||
expr: PENDING_BALANCE_COUNTER == PENDING_BALANCE_COUNTER_PRECOMPILE | ||
|
||
# Verify that the available balance is the same in both queries | ||
- type: eval | ||
expr: AVAILABLE_BALANCE_CIPHER == AVAILABLE_BALANCE_CIPHER_PRECOMPILE | ||
|
||
|