2

Now I'm building ink! smartcontract based AMM, as you know there are needed to approve before adding liquidity in general. but it's bad UX for users cuz we need to approve several times before adding liquidity or swapping.

Uniswap and other EVM based AMM were overcoming this issue as you know EIP-2612.

Permit function is implemented in ERC20, are there any kinds of the function like this in PSP22??

https://eips.ethereum.org/EIPS/eip-2612

https://docs.openzeppelin.com/contracts/4.x/api/token/erc20#ERC20Permit

1 Answer 1

2

permit function from EIP-2612 is really Ethereum-centric but you can still adapt it ink! & substrate.
But you need to restrict your contract to only be used by ECDSA addresses.
Have a look at this issue

And the implementation of seal_ecdsa_recovery in pallet_contract

And the code snippet in top of ecdsa_recover in ink! repo

2
  • Thank you. I have checked the issue but it doesn't make me clear... This is why ?? But you need to restrict your contract to only be used by ECDSA addresses.
    – Steve
    Nov 17, 2022 at 12:27
  • explained there :substrate.stackexchange.com/a/3220/567
    – P.Ossun
    Nov 17, 2022 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.