/cheap-swap-contract

Primary LanguageSolidityMIT LicenseMIT

cheap-swap-contract

介绍

通过交易所代付GAS实现cheapswap。

部署地址

deployment

核心代码

contracts

运行脚本

test

yarn test ./test/cheapMintNFT.test.ts
yarn test ./test/cheapSwapRouterV3.test.ts

Sample Scripts

Install dependencies

yarn

Compile contracts

yarn build

Hardhat test

yarn test 

Hardhat solidity-coverage

yarn test:cov

SOP

environment

bscTest

export ENV_FILE='./envs/env.bscTest'
export NETWORK_ID=97
export WAIT_NUM=1
export GAS_PRICE=10

bsc

export ENV_FILE='./envs/env.bsc'
export NETWORK_ID=56
export WAIT_NUM=3
export GAS_PRICE=5

rinkeby

export ENV_FILE='./envs/env.rinkeby'
export NETWORK_ID=4
export WAIT_NUM=1
export GAS_PRICE=3

ROPSTEN

export ENV_FILE='./envs/env.ropsten'
export NETWORK_ID=3
export WAIT_NUM=1
export GAS_PRICE=3

eth

export ENV_FILE='./envs/env.eth'
export NETWORK_ID=1
export WAIT_NUM=3
export GAS_PRICE=30

ployTest

export ENV_FILE='./envs/env.ployTest'
export NETWORK_ID=80001
export WAIT_NUM=3
export GAS_PRICE=10

ploy

export ENV_FILE='./envs/env.ploy'
export NETWORK_ID=137
export WAIT_NUM=3
export GAS_PRICE=35

script

deploy script

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:deploy --contract CheapSwapFactory --gas-price $GAS_PRICE --wait-num $WAIT_NUM --network $NETWORK_ID

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:deploy --contract CheapMintNFT --gas-price $GAS_PRICE --wait-num $WAIT_NUM --network $NETWORK_ID

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:deploy --contract ERC721_TEST --gas-price $GAS_PRICE --wait-num $WAIT_NUM --network $NETWORK_ID

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:deploy --contract CheapSwapRouterV3 --gas-price $GAS_PRICE --wait-num $WAIT_NUM --network $NETWORK_ID

verify contract

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:verify --contract CheapSwapFactory --args [] --network $NETWORK_ID

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:verify --contract CheapSwapAddress --args [\"0x1f2479ee1b4aFE789e19D257D2D50810ac90fa59\"] --address 0xe793A4236769d66a885b7FFC480269f468098B34 --network $NETWORK_ID

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:verify --contract CheapMintNFT --args [] --network $NETWORK_ID

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:verify --contract ERC721_TEST --args []  --network $NETWORK_ID

yarn run env-cmd -f $ENV_FILE yarn run hardhat contract:verify --contract CheapSwapRouterV3 --args []  --network $NETWORK_ID