NodeJS 12.x+ must be installed as a prerequisite.
$ npm install
- Install dependencies
- Add .env file
- Set GAS_PRICE_GWEI in .env file (optional)
- Set PRIVATE_KEY in .env file
- Set RPC_URL in .env file
- If updating from v2 to v3 set MODE='2to3' in .env file
- run: npm run mainnet-deploy or npm run bsc-deploy
Tests are run on Ethereum mainnet fork, you need node url to run the fork.
$ npm run ganache-mainnet -- mainnet-node-url
$ npm run test
User needs to deploy a wallet for himself sending along ETH that will be used to cover copy fees.
getUserWallet(address _user) view returns(address); // Get address of the user wallet, or 0x0 if not deployed.
deployUserWallet(address _w2w, address _referrer) payable; // Deploy user wallet for transaction sender.
deployUserWalletFor(address _w2w, address _user, address _referrer) payable; // Deploy user wallet for specific user.
changeParam(bytes32 _key, bytes32 _value); // Set value of an arbitrary key.
changeParam(
'0x5732570000000000000000000000000000000000000000000000000000000000', // W2W key is used to indicate current Wallet2Wallet contract address. Only the one specified here has access to user's funds.
'0x000000000000000000000000cafecafecafecafecafecafecafecafecafecafe' // 0xcafecafecafecafecafecafecafecafecafecafe contract address.
);
changeOwner(address _owner); // Set new owner.
owner() view returns(address); // Get current wallet owner.
params(bytes32 _key) view returns(bytes32); // Get value by an arbitrary key.
buyBack(IERC20[] _tokens, bytes[] _datas); // Buy DEXE with TradeProvider using all the specified tokens, then keep them store them.
In order to validate consistency of your changes run:
$ npm run validate
JS: based on Google, though with only single indentations even for arguments.
Solidity: based on solhint default, though with some rules disabled.