ngduythao / permit2-payment

A smart contract utilizing the permit2 feature allows users to define and authorize a set of executionss they wish to perform. They can also specify the amount of ERC20 tokens they are willing to pay to relayers for executing these operations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Permit2 Payment

User specifies and signs the set of operations they want to do and an amount of ERC20 tokens they're willing to pay for execution

Contract and verifies signature using Uniswap Permit2 and pulls user tokens, performs the payments.

Getting Started

git clone git@github.com:ngduythao/permit2-payment.git
cd permit2-payment
pnpm install # install Solhint, Prettier, and other Node.js deps

Build

Build the contracts:

$ forge build

Clean

Delete the build artifacts and cache directories:

$ forge clean

Compile

Compile the contracts:

$ forge build

Coverage

Get a test coverage report:

$ forge coverage

Deploy

Deploy to Anvil:

$ forge script script/DeployFoo.s.sol --broadcast --fork-url http://localhost:8545

For this script to work, you need to have a MNEMONIC environment variable set to a valid BIP39 mnemonic.

For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.

Format

Format the contracts:

$ forge fmt

Gas Usage

Get a gas report:

$ forge test --gas-report

Lint

Lint the contracts:

$ pnpm lint

Test

Run the tests:

$ forge test

Related Efforts

License

This project is licensed under MIT.

About

A smart contract utilizing the permit2 feature allows users to define and authorize a set of executionss they wish to perform. They can also specify the amount of ERC20 tokens they are willing to pay to relayers for executing these operations.


Languages

Language:Solidity 64.9%Language:JavaScript 32.6%Language:Ruby 1.2%Language:Julia 0.9%Language:Shell 0.3%Language:Makefile 0.1%Language:Handlebars 0.0%Language:Nix 0.0%