-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
7d92790
commit 810fb1c
Showing
9 changed files
with
475 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -446,6 +446,12 @@ $(UKM_WITH_CONTRACT_TESTING_OUTPUT_DIR)/%.run.executed.kore: \ | |
mkdir -p $(UKM_WITH_CONTRACT_TESTING_OUTPUT_DIR) | ||
|
||
echo "<(<" > [email protected] | ||
echo "::address" >> [email protected] | ||
echo "<|>" >> [email protected] | ||
cat $(UKM_CONTRACTS_TESTING_INPUT_DIR)/address.rs >> [email protected] | ||
echo ">)>" >> [email protected] | ||
|
||
echo "<(<" >> [email protected] | ||
echo "::bytes_hooks" >> [email protected] | ||
echo "<|>" >> [email protected] | ||
cat $(UKM_CONTRACTS_TESTING_INPUT_DIR)/bytes_hooks.rs >> [email protected] | ||
|
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
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
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
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
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,3 @@ | ||
fn is_zero(address: u64) -> bool { | ||
address == 0_u64 | ||
} |
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,279 @@ | ||
list_mock GetAccountStorageHook ( 7809087261546347641 ) ukmInt64Result(0); | ||
list_mock SetAccountStorageHook ( 7809087261546347641 , 10000 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(0); | ||
list_mock SetAccountStorageHook ( 7162266444907899391 , 10000 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(10000); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(10000); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(10000); | ||
list_mock SetAccountStorageHook ( 7162266444907899391 , 9900 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 7162266444908917614 ) ukmInt64Result(0); | ||
list_mock SetAccountStorageHook ( 7162266444908917614 , 100 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(9900); | ||
list_mock GetAccountStorageHook ( 7162266444908917614 ) ukmInt64Result(100); | ||
list_mock SetAccountStorageHook ( 8028228613167873919 , 200 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 8028228613167873919 ) ukmInt64Result(200); | ||
list_mock SetAccountStorageHook ( 8028228613167873919 , 0 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(9900); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(9900); | ||
list_mock SetAccountStorageHook ( 7162266444907899391 , 9700 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 7162266444908917614 ) ukmInt64Result(100); | ||
list_mock SetAccountStorageHook ( 7162266444908917614 , 300 ) ukmNoResult(); | ||
list_mock GetAccountStorageHook ( 7162266444907899391 ) ukmInt64Result(9700); | ||
list_mock GetAccountStorageHook ( 7162266444908917614 ) ukmInt64Result(300); | ||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "#init(Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 10000_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
push_value 1010101_u64; | ||
mock Caller; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: bytes_hooks :: length; | ||
return_value; | ||
|
||
check_eq 0_u32; | ||
|
||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "balanceOf(Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 1010101_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 10000_u64; | ||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "transfer(Uint64,Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 2020202_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value_to_arg; | ||
push 100_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
push_value 1010101_u64; | ||
mock Caller; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 1_u64; | ||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "balanceOf(Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 1010101_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 9900_u64; | ||
|
||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "balanceOf(Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 2020202_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 100_u64; | ||
|
||
|
||
|
||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "approve(Uint64,Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 3030303_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value_to_arg; | ||
push 200_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
push_value 1010101_u64; | ||
mock Caller; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 1_u64; | ||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "transferFrom(Uint64,Uint64,Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 1010101_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value_to_arg; | ||
push 2020202_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value_to_arg; | ||
push 200_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
push_value 3030303_u64; | ||
mock Caller; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 1_u64; | ||
|
||
|
||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "balanceOf(Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 1010101_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 9700_u64; | ||
|
||
|
||
|
||
|
||
call :: bytes_hooks :: empty; | ||
return_value_to_arg; | ||
push "balanceOf(Uint64)"; | ||
call :: bytes_hooks :: append_str; | ||
return_value_to_arg; | ||
push 2020202_u64; | ||
call :: bytes_hooks :: append_u64; | ||
return_value; | ||
mock CallData; | ||
|
||
call_contract 12345; | ||
return_value; | ||
check_eq (); | ||
|
||
push_status; | ||
check_eq 2; | ||
|
||
output_to_arg; | ||
call :: test_helpers :: decode_single_u64; | ||
return_value; | ||
|
||
check_eq 300_u64 | ||
|
||
|
Oops, something went wrong.