• Activity
  • Builds
  • Builders
  • FAQ

Staking Contract with Permit2

Code Live Demo

This is an example of how to use Permit2, which was recently implemented by uniswap lab. In this staking contract user can take advantage of staking token with Permit2. With permit2 user don't need send a new transaction for ERC20 token approval. Approval is done via EIP712 signature. Staking contract and foundry test are available in my public repo. This staking contract is a simplified version of synthetix original staking contract. I addition to that I have implemented Permit2 which was recently published by Uniswap lab. If you look at the staking contract you will see there are two ways to stake. First option : Simple stake() where user need to first send an approval transaction before staking. Second option: Staking with permit2 where user can just sign the approval message. This can be implemented with any ERC20 token ( even the ones that don't support permit) https://twitter.com/dec3ntraliz3d/status/1600880091298267136?s=20&t=1lPewzOQDD_bjrMQzb3gVg

0x07D5...558f