2021-04-14 23:04:28 +00:00
|
|
|
import { run, ethers } from "hardhat";
|
2021-04-14 23:14:13 +00:00
|
|
|
import "@nomiclabs/hardhat-ethers";
|
2021-04-14 23:04:28 +00:00
|
|
|
|
|
|
|
async function main() {
|
|
|
|
await run("compile");
|
|
|
|
|
|
|
|
const DioneToken = await ethers.getContractFactory("DioneToken");
|
|
|
|
const DioneOracle = await ethers.getContractFactory("DioneOracle");
|
|
|
|
const DioneDispute = await ethers.getContractFactory("DioneDispute");
|
|
|
|
const DioneStaking = await ethers.getContractFactory("DioneStaking");
|
2021-04-19 19:46:49 +00:00
|
|
|
const Mediator = await ethers.getContractFactory("Mediator");
|
2021-04-14 23:04:28 +00:00
|
|
|
|
|
|
|
const dioneToken = await DioneToken.deploy();
|
|
|
|
await dioneToken.deployed();
|
|
|
|
console.log("DioneToken deployed to:", dioneToken.address);
|
|
|
|
|
|
|
|
const dioneStaking = await DioneStaking.deploy(dioneToken.address, ethers.constants.WeiPerEther.mul(100), 0, ethers.constants.WeiPerEther.mul(5000));
|
|
|
|
await dioneStaking.deployed();
|
2021-04-19 19:46:49 +00:00
|
|
|
console.log("staking_contract_address = \"" + dioneStaking.address+ "\"");
|
2021-04-14 23:04:28 +00:00
|
|
|
|
2021-04-20 21:39:47 +00:00
|
|
|
const dioneDispute = await DioneDispute.deploy(dioneStaking.address, 5);
|
2021-04-14 23:04:28 +00:00
|
|
|
await dioneDispute.deployed();
|
2021-04-19 19:46:49 +00:00
|
|
|
console.log("dispute_contract_address = \"" + dioneDispute.address+ "\"");
|
2021-04-14 23:04:28 +00:00
|
|
|
|
|
|
|
const dioneOracle = await DioneOracle.deploy(dioneStaking.address);
|
|
|
|
await dioneOracle.deployed();
|
2021-04-19 19:46:49 +00:00
|
|
|
console.log("oracle_contract_address = \"" + dioneOracle.address+ "\"");
|
|
|
|
|
|
|
|
const mediator = await Mediator.deploy(dioneOracle.address);
|
|
|
|
await mediator.deployed();
|
|
|
|
console.log("mediator_contract_address = \"" + mediator.address +"\"")
|
2021-04-14 23:04:28 +00:00
|
|
|
|
|
|
|
await dioneStaking.setOracleContractAddress(dioneOracle.address);
|
2021-04-20 21:39:47 +00:00
|
|
|
await dioneStaking.setDisputeContractAddress(dioneDispute.address);
|
2021-04-14 23:04:28 +00:00
|
|
|
|
|
|
|
const addresses = ["0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "0x70997970c51812dc3a010c7d01b50e0d17dc79c8", "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", "0x90F79bf6EB2c4f870365E785982E1f101E93b906"]
|
|
|
|
await dioneToken.mint(addresses[0], ethers.constants.WeiPerEther.mul(50000));
|
|
|
|
for (const address of addresses) {
|
|
|
|
if(address == "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266") {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
await dioneToken.transfer(address, ethers.constants.WeiPerEther.mul(6000));
|
|
|
|
}
|
|
|
|
|
2021-04-19 19:46:49 +00:00
|
|
|
await dioneToken.transferOwnership(dioneStaking.address);
|
|
|
|
|
2021-04-14 23:04:28 +00:00
|
|
|
const signers = await ethers.getSigners();
|
|
|
|
for (var i = 0; i < addresses.length; i++) {
|
|
|
|
const staking = dioneStaking.connect(signers[i]);
|
|
|
|
const token = dioneToken.connect(signers[i]);
|
|
|
|
await token.approve(dioneStaking.address, ethers.constants.WeiPerEther.mul(5000));
|
|
|
|
await staking.stake(ethers.constants.WeiPerEther.mul(5000));
|
|
|
|
const stake = await dioneStaking.minerStake(addresses[i]);
|
|
|
|
console.log(addresses[i], stake.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
.then(() => process.exit(0))
|
|
|
|
.catch((error) => {
|
|
|
|
console.error(error);
|
|
|
|
process.exit(1);
|
|
|
|
});
|