修改发布脚本, cec和escec分别发一套staking合约

This commit is contained in:
CounterFire2023 2024-09-03 17:49:15 +08:00
parent 631cb3e55a
commit aff4a4b68d
11 changed files with 161 additions and 2001 deletions

View File

@ -0,0 +1,23 @@
import {HardhatRuntimeEnvironment} from "hardhat/types";
import {DeployFunction} from "hardhat-deploy/types";
import {deplayOne} from "../scripts/utils";
import {ZeroAddress} from "ethers";
const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const config = require(`../config/config_${hre.network.name}`);
const tokenName = "Escrowed CEC";
const tokenSymbol = "esCEC";
const esCEC = await deplayOne({
hre,
name: "esCEC",
type: "erc20",
contractName: "EsToken",
args: [tokenName, tokenSymbol],
verify: true,
});
};
deployNFTClaim.tags = ["EsCEC"];
export default deployNFTClaim;

View File

@ -1,27 +1,16 @@
import {HardhatRuntimeEnvironment} from "hardhat/types";
import {DeployFunction} from "hardhat-deploy/types";
import {updateArray, deplayOne} from "../scripts/utils";
import {deplayOne, loadData} from "../scripts/utils";
import {ZeroAddress} from "ethers";
const secondsPerYear = 365 * 24 * 60 * 60;
import { assert } from "chai";
const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const config = require(`../config/config_${hre.network.name}`);
const {mallFeeAddress, paymentTokens, verifier} = config.market;
const {cec, rewardPerSecond, vestingDuration} = config.staking;
const tokenName = "Escrowed CEC";
const tokenSymbol = "esCEC";
const esCEC = await deplayOne({
hre,
name: "esCEC",
type: "erc20",
contractName: "EsToken",
args: [tokenName, tokenSymbol],
verify: true,
});
const datas = loadData({ network: hre.network.name });
const esCEC = datas.find((item: any) => item.name === "esCEC");
assert(esCEC, "esCEC not found");
const stakedCecTracker = await deplayOne({
hre,
name: "stakedCecTracker",
@ -52,7 +41,7 @@ const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnviro
const rewardRouter = await deplayOne({
hre,
name: "rewardRouter",
name: "stakedCecRouter",
type: "logic",
contractName: "RewardRouter",
args: [cec, esCEC.address, stakedCecTracker.address, vester.address],
@ -98,6 +87,6 @@ const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnviro
console.log("==esCECContract setHandler");
};
deployNFTClaim.tags = ["Staking"];
deployNFTClaim.tags = ["StakingCEC"];
export default deployNFTClaim;

View File

@ -0,0 +1,78 @@
import {HardhatRuntimeEnvironment} from "hardhat/types";
import {DeployFunction} from "hardhat-deploy/types";
import {deplayOne, loadData} from "../scripts/utils";
import {ZeroAddress} from "ethers";
import { assert } from "chai";
const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const config = require(`../config/config_${hre.network.name}`);
const {cec, rewardPerSecond, vestingDuration} = config.staking;
const datas = loadData({ network: hre.network.name });
const esCEC = datas.find((item: any) => item.name === "esCEC");
const vester = datas.find((item: any) => item.name === "vester");
assert(esCEC, "esCEC not found");
assert(vester, "vester not found");
const stakedCecTracker = await deplayOne({
hre,
name: "stakedEsCecTracker",
type: "logic",
contractName: "RewardTracker",
args: ["Staked CEC", "sCEC"],
verify: true,
});
const stakedCecDistributor = await deplayOne({
hre,
name: "stakedEsCecDistributor",
type: "logic",
contractName: "RewardDistributor",
args: [esCEC.address, stakedCecTracker.address],
verify: true,
});
const rewardRouter = await deplayOne({
hre,
name: "stakedEsCecRouter",
type: "logic",
contractName: "RewardRouter",
args: [cec, esCEC.address, stakedCecTracker.address, vester.address],
verify: true,
});
const stakedCecTrackerContract = await hre.ethers.getContractAt("RewardTracker", stakedCecTracker.address);
const stakedCecDistributorContract = await hre.ethers.getContractAt(
"RewardDistributor",
stakedCecDistributor.address,
);
let tx = await stakedCecTrackerContract.initialize([cec, esCEC.address], stakedCecDistributor.address);
await tx.wait();
console.log("==stakedEsCecTrackerContract initialized");
tx = await stakedCecTrackerContract.setInPrivateTransferMode(true);
await tx.wait();
console.log("==stakedEsCecTrackerContract setInPrivateTransferMode");
tx = await stakedCecTrackerContract.setInPrivateStakingMode(true);
await tx.wait();
console.log("==stakedEsCecTrackerContract setInPrivateStakingMode");
tx = await stakedCecDistributorContract.updateLastDistributionTime();
await tx.wait();
console.log("==stakedEsCecDistributorContract updateLastDistributionTime");
tx = await stakedCecDistributorContract.setTokensPerInterval(rewardPerSecond);
await tx.wait();
console.log("==stakedEsCecDistributorContract setTokensPerInterval");
tx = await stakedCecTrackerContract.setHandler(rewardRouter.address, true);
await tx.wait();
console.log("==stakedEsCecTrackerContract setHandler");
const esCECContract = await hre.ethers.getContractAt("EsToken", esCEC.address);
// 添加转账白名单
tx = await esCECContract.setHandler(stakedCecTracker.address, true);
await tx.wait();
console.log("==esCECContract setHandler");
};
deployNFTClaim.tags = ["StakingEsCEC"];
export default deployNFTClaim;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"address": "0x538ac34Ada48DA414424615F7BA75041815E8628",
"address": "0x67869546655e1A6A09b9877aEA858cC47444172D",
"abi": [
{
"inputs": [
@ -228,25 +228,25 @@
"type": "function"
}
],
"transactionHash": "0xd992a2e53749be47d159bf1794e8583b7a4de0d4b088d31a5e7c39693f84a9a0",
"transactionHash": "0x444bc00995d59535bc8a96ff1fcca36a2104e234e402d0970a34c224c9de47a8",
"receipt": {
"to": null,
"from": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
"contractAddress": "0x538ac34Ada48DA414424615F7BA75041815E8628",
"transactionIndex": 1,
"contractAddress": "0x67869546655e1A6A09b9877aEA858cC47444172D",
"transactionIndex": 0,
"gasUsed": "701322",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xc1ceb3148d5026609813a5b3573b5911901d7d8d540f016aa93ea036643250e3",
"transactionHash": "0xd992a2e53749be47d159bf1794e8583b7a4de0d4b088d31a5e7c39693f84a9a0",
"blockHash": "0x3acccd0660d9cb67852d07aab1d21d89300244163a3ee83fbfd4285db7615fdb",
"transactionHash": "0x444bc00995d59535bc8a96ff1fcca36a2104e234e402d0970a34c224c9de47a8",
"logs": [],
"blockNumber": 43540335,
"cumulativeGasUsed": "722322",
"blockNumber": 43545404,
"cumulativeGasUsed": "701322",
"status": 1,
"byzantium": true
},
"args": [
"0x4dF834064455D4BA48B98D5B6b8E19f43673e948",
"0xE8450f2A601cc54fcE48704Dc194b92DF34295b7"
"0x1FbA3F84e62163069050f1156b73C008722136A3",
"0x3299431803704C63941531d9d894CB095D15C4bC"
],
"numDeployments": 1,
"solcInputHash": "35d1d20dc9b7194768908e34f12939fd",

View File

@ -1,5 +1,5 @@
{
"address": "0x68D5260cC9CC1cBD693C3576D04bAd0f023f7607",
"address": "0x775d7Dbc06835c78437C8783fE11937E46F9ec6e",
"abi": [
{
"inputs": [
@ -302,27 +302,27 @@
"type": "function"
}
],
"transactionHash": "0xe755e9d70b3507476e57f5f7e8a89e3125a357ad2b808ad96ad422d167f0a4f4",
"transactionHash": "0xe8862dbb54901ea831b2a37a1a2a8dbc8306cb34b9bf43d7f6665f1c3a34ed3e",
"receipt": {
"to": null,
"from": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
"contractAddress": "0x68D5260cC9CC1cBD693C3576D04bAd0f023f7607",
"contractAddress": "0x775d7Dbc06835c78437C8783fE11937E46F9ec6e",
"transactionIndex": 0,
"gasUsed": "1036133",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xf95207c0235cac45fac6c94ef3d8fe2ced33ddbfdec99341f89e8dda84d86e32",
"transactionHash": "0xe755e9d70b3507476e57f5f7e8a89e3125a357ad2b808ad96ad422d167f0a4f4",
"blockHash": "0x2b30f259ee2e72b9987ce33377eb3637c008e8372d7a0230c0b8cb027539aabd",
"transactionHash": "0xe8862dbb54901ea831b2a37a1a2a8dbc8306cb34b9bf43d7f6665f1c3a34ed3e",
"logs": [],
"blockNumber": 43540355,
"blockNumber": 43545413,
"cumulativeGasUsed": "1036133",
"status": 1,
"byzantium": true
},
"args": [
"0xe34c5ea0c3083d11a735dc0609533b92130319f5",
"0x4dF834064455D4BA48B98D5B6b8E19f43673e948",
"0xE8450f2A601cc54fcE48704Dc194b92DF34295b7",
"0xd4253007DB8eFbc94E9330961BD563ac86Eab9dd"
"0x1FbA3F84e62163069050f1156b73C008722136A3",
"0x3299431803704C63941531d9d894CB095D15C4bC",
"0x49dcb6Ba542374147278efe9163a6E94e5E40762"
],
"numDeployments": 1,
"solcInputHash": "97451620892e0f98db18b69f812fe0de",

View File

@ -1,5 +1,5 @@
{
"address": "0xE8450f2A601cc54fcE48704Dc194b92DF34295b7",
"address": "0x3299431803704C63941531d9d894CB095D15C4bC",
"abi": [
{
"inputs": [
@ -887,18 +887,18 @@
"type": "function"
}
],
"transactionHash": "0x43c95316b46324f3685762ed20529da10c87881976f89b2cbbcc04f333b1dd54",
"transactionHash": "0x9f1a3c7f05fc517869c1485810071d08b4ce950734cf8465f16ff83aade79b00",
"receipt": {
"to": null,
"from": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
"contractAddress": "0xE8450f2A601cc54fcE48704Dc194b92DF34295b7",
"contractAddress": "0x3299431803704C63941531d9d894CB095D15C4bC",
"transactionIndex": 0,
"gasUsed": "2079921",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xedd5566f9fc3ae25cd068280ae2d693c44276ba75607c84fa78075be5b599b43",
"transactionHash": "0x43c95316b46324f3685762ed20529da10c87881976f89b2cbbcc04f333b1dd54",
"blockHash": "0xb96e491263641de15972ebab7b2356e0c6ea78387a71af1482d6afcbb3712bab",
"transactionHash": "0x9f1a3c7f05fc517869c1485810071d08b4ce950734cf8465f16ff83aade79b00",
"logs": [],
"blockNumber": 43540327,
"blockNumber": 43545395,
"cumulativeGasUsed": "2079921",
"status": 1,
"byzantium": true

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,12 +23,6 @@
"json": "assets/contracts/FT.json",
"address": "0xe34c5ea0c3083d11a735dc0609533b92130319f5"
},
{
"name": "rewardTracker",
"type": "logic",
"json": "assets/contracts/RewardTracker.json",
"address": "0x5aB49C4b7e21e35fD4fd05affB019320a95cb03D"
},
{
"name": "TokenClaim",
"type": "logic",
@ -39,30 +33,48 @@
"name": "esCEC",
"type": "erc20",
"json": "assets/contracts/EsToken.json",
"address": "0x4dF834064455D4BA48B98D5B6b8E19f43673e948"
"address": "0x1FbA3F84e62163069050f1156b73C008722136A3"
},
{
"name": "stakedCecTracker",
"type": "logic",
"json": "assets/contracts/RewardTracker.json",
"address": "0xE8450f2A601cc54fcE48704Dc194b92DF34295b7"
"address": "0x409890BEEf967e63b52F7BB13A986eD4900691Ed"
},
{
"name": "stakedCecDistributor",
"type": "logic",
"json": "assets/contracts/RewardDistributor.json",
"address": "0x538ac34Ada48DA414424615F7BA75041815E8628"
"address": "0x613884c63F9c9e7Aa02c659364E060AaA1c8dB33"
},
{
"name": "vester",
"type": "logic",
"json": "assets/contracts/Vester.json",
"address": "0xd4253007DB8eFbc94E9330961BD563ac86Eab9dd"
"address": "0x49dcb6Ba542374147278efe9163a6E94e5E40762"
},
{
"name": "rewardRouter",
"name": "stakedCecRouter",
"type": "logic",
"json": "assets/contracts/RewardRouter.json",
"address": "0x68D5260cC9CC1cBD693C3576D04bAd0f023f7607"
"address": "0xCB3dBb5d893743CE6f7c959CbBb44AfE0b83a04F"
},
{
"name": "stakedEsCecTracker",
"type": "logic",
"json": "assets/contracts/RewardTracker.json",
"address": "0x3299431803704C63941531d9d894CB095D15C4bC"
},
{
"name": "stakedEsCecDistributor",
"type": "logic",
"json": "assets/contracts/RewardDistributor.json",
"address": "0x67869546655e1A6A09b9877aEA858cC47444172D"
},
{
"name": "stakedEsCecRouter",
"type": "logic",
"json": "assets/contracts/RewardRouter.json",
"address": "0x775d7Dbc06835c78437C8783fE11937E46F9ec6e"
}
]

View File

@ -18,7 +18,10 @@
"deploy:airdrop": "hardhat deploy --tags AirdropToken --network imtbl_test --reset",
"deploy:tokenclaim": "hardhat deploy --tags TokenClaim --network bsc_test --reset",
"deploy:gameitemmall": "hardhat deploy --tags GameItemMall --network imtbl_test --reset",
"deploy:staking": "hardhat deploy --tags Staking --network bsc_test --reset",
"deploy:staking:token": "hardhat deploy --tags EsCEC --network bsc_test --reset",
"deploy:staking:cec": "hardhat deploy --tags StakingCEC --network bsc_test --reset",
"deploy:staking:escec": "hardhat deploy --tags StakingEsCEC --network bsc_test --reset",
"deploy:staking": "npm run deploy:staking:token && npm run deploy:staking:cec && npm run deploy:staking:escec",
"solhint": "solhint --config ./.solhint.json",
"show_verify_list": "npx hardhat verify --list-networks",
"convert-abi": "npx hardhat run scripts/convert-abi.js",