-
Notifications
You must be signed in to change notification settings - Fork 619
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
test: meta transaction FT transfer #8564
test: meta transaction FT transfer #8564
Conversation
This is the example used for NEP-366, an FT transfer paid by the relayer but the relayer gets a reward. Adds `fungible_token.wasm` as a test contract, which is the example implementation of NEP-141 in the near-sdk-rs repository.
This was a bit trickier than I thought, but I think it's worth adding this scenario to our test suite. On a side note, I keep sending these tests in batches, because I personally prefer reviewing several small PRs than one huge PR. But I can also group the remaining tests together in this PR if you don't want to be spammed by review requests, just let me know. |
|
||
// let transfer_event: serde_json::Value = | ||
// serde_json::from_str(&fn_call_logs[1]).expect("log events should be JSON"); | ||
// assert_eq!(transfer_event, ft_transfer_event(&sender, &receiver, 1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also check that david got the tokens ? (and that the token balance of alice & bob are correct)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I added a small helper assert_ft_balance
and then
assert_ft_balance(&node, &ft_contract, &receiver, 1000);
assert_ft_balance(&node, &ft_contract, &sender, 10_000 - 1000 - 10);
assert_ft_balance(&node, &ft_contract, &relayer, 1_000_000 - 10_000 + 10);
This is the example used for NEP-366, an FT transfer paid by the relayer but the relayer gets a reward in FT. Adds `fungible_token.wasm` as a test contract, which is the example implementation of NEP-141 in the near-sdk-rs repository. We deploy this WASM, initialize the state to make an FT transfer possible and then execute a meta transaction as intended. This makes gas checks in meta transaction tests even more annoying but otherwise the existing test framework mostly just worked.
This is the example used for NEP-366, an FT transfer paid by the
relayer but the relayer gets a reward in FT.
Adds
fungible_token.wasm
as a test contract, which is theexample implementation of NEP-141 in the near-sdk-rs repository.
We deploy this WASM, initialize the state to make an FT transfer
possible and then execute a meta transaction as intended.
This makes gas checks in meta transaction tests even more annoying
but otherwise the existing test framework mostly just worked.