-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
41 lines (33 loc) · 1.41 KB
/
Copy pathdeploy.js
File metadata and controls
41 lines (33 loc) · 1.41 KB
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
38
39
40
41
require('dotenv').config();
const { ethers } = require('ethers');
const fs = require('fs');
async function main() {
console.log('Deploying DripFeed to Arc Testnet...\n');
const rpcUrl = process.env.ARC_RPC_URL || 'https://rpc.testnet.arc.io';
const provider = new ethers.JsonRpcProvider(rpcUrl);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const usdcTokenAddress = '0x3600000000000000000000000000000000000000';
console.log('Deploying from:', wallet.address);
console.log('USDC Token:', usdcTokenAddress);
const abi = JSON.parse(fs.readFileSync('DripFeed_abi.json', 'utf8'));
const bytecodeData = JSON.parse(fs.readFileSync('DripFeed_bytecode.json', 'utf8'));
const factory = new ethers.ContractFactory(abi, bytecodeData.bytecode, wallet);
console.log('\nDeploying DripFeed...');
const contract = await factory.deploy(usdcTokenAddress);
await contract.waitForDeployment();
const address = await contract.getAddress();
console.log('\nDripFeed deployed at:', address);
const info = {
network: 'Arc Testnet',
contractAddress: address,
usdcToken: usdcTokenAddress,
deployer: wallet.address,
deployedAt: new Date().toISOString()
};
fs.writeFileSync('deployment.json', JSON.stringify(info, null, 2));
console.log('Deployment info saved to deployment.json');
}
main().catch((error) => {
console.error('Deployment failed:', error);
process.exit(1);
});