This repository contains the BatchTokenTransfer contract + a script to perform batch transfers of specified token.
- Clone this repository
- Install NPM dependencies:
npm install
- Add your
PRIVATE_KEYinhardhat.config.js. - Run
npx hardhat compileto compile the contracts. - Run
npx hardhat testto run the tests. - Run
npx hardhat run deploy/deploy.js --network saigonto deploy the contract to Saigon. - Once the contract is deployed, verify it by running
npx hardhat sourcify --endpoint https://sourcify.roninchain.com/server/ --network saigon.
NOTE: This exact process can be done to deploy the contract in Ronin (mainnet). The only modifications needed are the following: After step 3, modify the
deploy/deploy.jsscript to specify the token address (and comment theERC20Mockdeployment section). Also, changesaigontoroninin the commands to be run.
- Clone this repository
- Install Python dependencies:
pip install -r requirements.txt
(You can create a virtual environment if you don't want to install packages globally.)
The generated holders list will be provided by the dev team as a JSON file with the following name: holders.json.
In order to use this file to execute the batch transfer of the tokens, please add this file to the main folder (/batch-transfer/holders.json).
If you plan to place the file in a diferent directory, please add the corresponding path to the file in the config.ini file.
To exectute the batch transfer of the token, follow these steps:
-
Fill the
config.inifile by adding the missing fields. This will provide the access to the wallet, chain and contract to run the batch transfer. Here's a detailed view of whats needed:[event] holders = holders.json # The path to holders.json transactions = transactions.txt # The path to transactions.txt block_size = 100 # The batch size of txns [wallet] # Access to the wallet address = 0x0000000000000000000000000000000000000000 secret_key = 0x0000000000000000000000000000000000000000000000000000000000000000 [network] # Access to the blockchain network api_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # This key is provided by Moralis network = ronin # Chain: saigon or ronin [contract] # Access to the contract address = 0x0000000000000000000000000000000000000000 abi = abi/TokenBatchTransfer.json
-
Run
python run-batch-transfer.py -c config.ini. This will generate the filetransactions.txt(as specified inconfig.ini) containing the list of transactions executed in the batch transfer. -
Provide the generated
transactions.txtfile to the dev team in order to update the status of transfers in the database.
NOTE: By default it uses the path
"holders.json"to read a holders list and perform the batch transfer, but if needed, you can specify another path by modifying this in theconfig.inifile.