-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path2_deploy_iao_factory.js
79 lines (68 loc) · 2.18 KB
/
2_deploy_iao_factory.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const IAOUpgradeProxy = artifacts.require("IAOUpgradeProxy");
const IAOLinearVestingFactory = artifacts.require("IAOLinearVestingFactory");
const IAOLinearVesting = artifacts.require("IAOLinearVesting");
const ethers = require('ethers');
const { getNetworkConfig } = require('../deploy-config')
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org'));
module.exports = async function (deployer, network, accounts) {
const ADDRESS_0 = '0x0000000000000000000000000000000000000000';
const { adminAddress, proxyAdminAddress, rpcProvider } = getNetworkConfig(network, accounts);
// Find current block
const provider = new ethers.providers.JsonRpcProvider(rpcProvider);
const block = await provider.getBlock('latest');
/// Deploy initial implementation
await deployer.deploy(IAOLinearVesting);
const iaoLinearVesting = await IAOLinearVesting.at(IAOLinearVesting.address);
await iaoLinearVesting.initialize(
ADDRESS_0,
ADDRESS_0,
block.number + 10,
1,
1,
0,
0,
adminAddress
)
await deployer.deploy(IAOLinearVestingFactory);
const abiEncodeData = web3.eth.abi.encodeFunctionCall({
"inputs": [
{
"internalType": "address",
"name": "_factoryAdmin",
"type": "address"
},
{
"internalType": "address",
"name": "_iaoProxyAdmin",
"type": "address"
},
{
"internalType": "address",
"name": "_iaoAdmin",
"type": "address"
},
{
"internalType": "contract IIAOLinearVesting",
"name": "_implementation",
"type": "address"
},
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}, [
adminAddress, // Factory admin
proxyAdminAddress, // IAO Proxy Admin
adminAddress, // IAO Admin
IAOLinearVesting.address
]);
await deployer.deploy(IAOUpgradeProxy, proxyAdminAddress, IAOLinearVestingFactory.address, abiEncodeData);
console.dir({
IAOLinearVesting: IAOLinearVesting.address,
IAOLinearVestingFactory: IAOLinearVestingFactory.address,
adminAddress,
proxyAdminAddress,
})
};