Skip to content

jatinj615/permit

Repository files navigation

Permit wrapper for ERC20

Problem Statement

ERC2612 allows for gasless approvals for ERC20 via signatures. While many ERC20 tokens now incorporate permits, many do not. contract which serves as a wrapper to an ERC20 and allows permits.

Proposed Solution

Created a singleton contract which implements permit and relies on max allowance.
After the user gives max allowance to address(this) user can send a signature with permit method which checks the signature and transfers the tokens using safeTransferFrom method from SafeERC20.

Deployed and verified Permit contract address on kovan link

0xbe05377f035e00B3052633c9c813a2D1F20928E7

Requirements

Setup project

  1. Clone the repository

    git clone https://github.com/jatinj615/permit.git
    cd permit
  2. create .env file and set environment variables

     touch .env
    
     // structure of env file
     ALCHEMY_API_KEY=<YOUR_ALCHEMY_KEY> // can use - GuY3V68erOgOioj6jYTGb1IfkJCIxhLH
     MNEMONIC=<YOUR_MNEMONIC_PRIVATE_KEY>
     OWNER_PRIVATE_KEY=<YOUR_OWNER_PRIVATE_KEY>

    refer to .env.example file for refrence.

    To get OWNER_PRIVATE_KEY run

    npx hardhat node
    
    // Ouput
    Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
    Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 //OWNER_PRIVATE_KEY(must be of Account #0)
  3. Install the dependencies

    npm install
  4. Compile the code

    npx hardhat compile

Run Test cases

npx hardhat test

Deploy Contract

npx hardhat run scripts/deployer.ts --network <network_name>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published