Skip to content

Instantly share code, notes, and snippets.

@darwinsubramaniam
Created May 16, 2022 13:39
Show Gist options
  • Save darwinsubramaniam/1a6d58243d7bf340a31d5e48d4d0fb0b to your computer and use it in GitHub Desktop.
Save darwinsubramaniam/1a6d58243d7bf340a31d5e48d4d0fb0b to your computer and use it in GitHub Desktop.
Ink! Set Caller and Callee
let accounts =
ink_env::test::default_accounts::<ink_env::DefaultEnvironment>();
assert_eq!(erc20.balance_of(accounts.bob), 0);
// Set the contract as callee and Bob as caller.
let contract = ink_env::account_id::<ink_env::DefaultEnvironment>();
ink_env::test::set_callee::<ink_env::DefaultEnvironment>(contract);
ink_env::test::set_caller::<ink_env::DefaultEnvironment>(accounts.bob);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment