Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Relayer fees #51

wants to merge 3 commits into from

Conversation

kroist
Copy link
Contributor

@kroist kroist commented Mar 26, 2024

introduced relayer logic by adding two public operations:
DepositRelayer, WithdrawRelayer
both operations mirror Deposit and Relayer respectively, but with three additional fields:

  • fee: u128 - amount of fee for relayer
  • fee_token: Scalar - fee payment token
  • relayer: Scalar - relayer address

@kroist kroist requested review from Yithis and pmikolajczyk41 March 26, 2024 11:27
Comment on lines -41 to +35
setup-tests: build-psp22 build-shielder ## Builds contracts and generates wrappers.
setup-tests: build-shielder ## Builds contracts and generates wrappers.
Copy link
Member

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

Comment on lines +123 to +138
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()?;
Copy link
Member

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]);
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants