Permit2 introduces a low-overhead, next generation token approval/meta-tx system to make token approvals easier, more secure, and more consistent across applications.
This repository is subject to the DerpDEX Bug Bounty program, per the terms defined here.
Contract | Testnet Address | Mainnet Address |
---|---|---|
Permit2 |
0x7dBaee32F615b50B318A8650eE23214768d25b34 |
0x37a47BEd105deFc9d4242C8F7232f1fF61e24976 |
/contracts
: smart contracts./deploy
: deployment and contract interaction scripts./test
: test fileshardhat.config.ts
: configuration file.
yarn hardhat compile
will compile the contracts.yarn run deploy
will execute the deployment script/deploy/deploy-Permit2.ts
. Requires environment variable setup.yarn hardhat verify --network zkSyncTestnet CONTRACT_ADDRESS_HERE
will verify the contracts on the zkSync testnet.
yarn run deploy
is configured in the package.json
file and run yarn hardhat deploy-zksync
.
In order to prevent users to leak private keys, this project includes the dotenv
package which is used to load environment variables. It's used to load the wallet private key, required to run the deploy script.
To use it, rename .env.example
to .env
and enter your private key.
WALLET_PRIVATE_KEY=123cde574ccff....
In order to run test, you need to start the zkSync local environment. Please check this section of the docs which contains all the details.
If you do not start the zkSync local environment, the tests will fail with error Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2)