-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathdeployTD.js
61 lines (51 loc) · 1.99 KB
/
deployTD.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
// Deploying the TD somewhere
// To verify it on Etherscan:
// npx hardhat verify --network sepolia <address> <constructor arg 1> <constructor arg 2>
const hre = require("hardhat");
const Str = require('@supercharge/strings')
async function main() {
// Deploying contracts
const ERC20TD = await hre.ethers.getContractFactory("ERC20TD");
const Evaluator = await hre.ethers.getContractFactory("Evaluator");
const DummyToken = await hre.ethers.getContractFactory("DummyToken");
const erc20 = await ERC20TD.deploy("TD-AMM-101","TD-AMM-101",0);
const dummytoken = await DummyToken.deploy("dummyToken", "DTK",ethers.BigNumber.from("2000000000000000000000000000000"));
await erc20.deployed();
console.log(
`ERC20TD deployed at ${erc20.address}`
);
await dummytoken.deployed();
console.log(
`DummyToken deployed at ${dummytoken.address}`
);
uniswapV2FactoryAddress = "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f"
wethAddress = "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6"
const evaluator = await Evaluator.deploy(erc20.address, dummytoken.address, uniswapV2FactoryAddress, wethAddress)
await evaluator.deployed();
console.log(
`Evaluator deployed at ${evaluator.address}`
);
// Setting the teacher
await erc20.setTeacher(evaluator.address, true)
// Setting random values
randomSupplies = []
randomTickers = []
for (i = 0; i < 20; i++)
{
randomSupplies.push(Math.floor(Math.random()*1000000000))
randomTickers.push(Str.random(5))
// randomTickers.push(web3.utils.utf8ToBytes(Str.random(5)))
// randomTickers.push(Str.random(5))
}
console.log(randomTickers)
console.log(randomSupplies)
// console.log(web3.utils)
// console.log(type(Str.random(5)0)
await evaluator.setRandomTickersAndSupply(randomSupplies, randomTickers);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});