-
Notifications
You must be signed in to change notification settings - Fork 8
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
Relayer fees #51
base: main
Are you sure you want to change the base?
Relayer fees #51
Conversation
setup-tests: build-psp22 build-shielder ## Builds contracts and generates wrappers. | ||
setup-tests: build-shielder ## Builds contracts and generates wrappers. |
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.
nit: things like removing psp submodule can be easily done in separate mini PRs
build_call::<DefaultEnvironment>() | ||
.call(AccountId::from(token.bytes)) | ||
.call_v1() | ||
.gas_limit(0) | ||
.transferred_value(0) | ||
.exec_input( | ||
ExecutionInput::new(Selector::new(ink::selector_bytes!( | ||
"PSP22::transfer_from" | ||
))) | ||
.push_arg(AccountId::from(user.bytes)) | ||
.push_arg(self.env().account_id()) | ||
.push_arg(amount) | ||
.push_arg([].to_vec() as ink::prelude::vec::Vec<u8>), | ||
) | ||
.returns::<Result<(), PSP22Error>>() | ||
.invoke()?; |
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.
please reduce repetitions across this module - you can crate functions dedicated for transfer
and transfer_from
that would hide the whole boilerplate
@@ -26,3 +26,9 @@ pub fn init_bob(session: &mut Session<MinimalSandbox>) -> Result<AccountId32> { | |||
init_acc_with_balance(session, &res)?; | |||
Ok(res) | |||
} | |||
|
|||
pub fn init_relayer(session: &mut Session<MinimalSandbox>) -> Result<AccountId32> { | |||
let res = AccountId32::new([4u8; 32]); |
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.
please use constants for all actors in this module
introduced relayer logic by adding two public operations:
DepositRelayer
,WithdrawRelayer
both operations mirror
Deposit
andRelayer
respectively, but with three additional fields:fee: u128
- amount of fee for relayerfee_token: Scalar
- fee payment tokenrelayer: Scalar
- relayer address