https://docs.openzeppelin.com/contracts/3.x/api/token/erc20#ERC20
QuillAudits Smart Contract Audit Report
- It's generic contract for payment of ERC20 tokens
- Users can pay for services in ERC20 tokens like USDT/USDC
Install all dependencies with command npm i
.
Update the .env
file with following details:
RPC_URL
: RPC url of network.USER_PRIVATE_KEY
: Private key of user's wallet from which payment has to be done. [Not required for during deployment]USER_WALLET_ADDRESS
: User's wallet address from which payment has to be done. [Not required for during deployment]DEPLOYER_WALLET_ADDRESS
: Deployer's wallet address.DEPLOYER_PRIVATE_KEY
: Private key of deployer wallet which is used for deploying the contractNEW_OWNER_PRIVATE_KEY
: Private key of new owner's wallet. [Not required for during deployment]NEW_OWNER_WALLET_ADDRESS
: New owner's wallet address. [Not required for during deployment]PAYMENT_VAULT_CONTRACT_ADDRESS
: Contract address of proxy contract, which we get after deployment.CHAINSCAN_API_KEY
: Etherscan API key, used by hardhat for deployment and verification.
npx hardhat compile
Proxy deployment should happen only once:
npx hardhat run scripts/deploy.ts --network <network-name>
Verify proxy contract after each deployment for upgrade
npx hardhat verify --network <network-name> <proxy-contract-address>
After deployment of contract, update the .env
file as required, details below.
RPC_URL
: RPC url of networkUSER_PRIVATE_KEY
: Private key of user's wallet from which payment has to be doneUSER_WALLET_ADDRESS
: User's wallet address from which payment has to be doneDEPLOYER_WALLET_ADDRESS
: Deployer's wallet address.DEPLOYER_PRIVATE_KEY
: Private key of deployer wallet which is used for deploying the contractNEW_OWNER_PRIVATE_KEY
: Private key of new owner's wallet. This is used for testing transferOwner function.NEW_OWNER_WALLET_ADDRESS
: New owner's wallet address. This is used for testing transferOwner functionPAYMENT_VAULT_CONTRACT_ADDRESS
: Contract address of proxy contract, which we get after deployment.CHAINSCAN_API_KEY
: Etherscan API key, used by hardhat for deployment and verification.
ts-node scripts/paymentInteraction.ts <network_name> <token_name>
Supported testnet network names: mumbai
and goerli
.
Supported mainnet network names [Not recommended to run]: polygon
and ethereum
.
Supported token name: usdt
and usdc