-
Notifications
You must be signed in to change notification settings - Fork 1
/
setDripActive.js
37 lines (29 loc) · 1.16 KB
/
setDripActive.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const zksync = require('zksync-web3');
const utils = require('./utils.js');
// RPC
const constants = require('./constants.js');
const provider = new zksync.Provider(constants.RPCUrl);
// Signer
const secrets = require('./secrets.json');
const signer = new zksync.Wallet(secrets.privateKey).connect(provider);
// Contract
const contracts = require('./contracts.js');
const faucetABI = require('./abi/testnet_faucet.json');
const faucetContract = new zksync.Contract(contracts.testnetFaucet, faucetABI, signer);
async function setDripActive(id, active) {
console.log('Use faucet contract:', contracts.testnetFaucet);
console.log(`Set active status of drip ${id} to ${active}..`);
const handle = await faucetContract.setDripActive(id, active);
await utils.waitConfirm(handle);
}
async function execute() {
console.log('Use account: ', signer.address);
console.log('Use fee token:', constants.feeToken);
console.log('Current block:', await provider.getBlockNumber());
const args = (process.argv).slice(2);
await setDripActive(args[0], args[1]);
}
// execute tasks
execute().then(() => {
console.log('All tasks have been executed.');
});