重新发布测试合约
This commit is contained in:
parent
accb37616e
commit
7eaafeb998
@ -49,7 +49,7 @@ const mint = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const staking = {
|
const staking = {
|
||||||
cec: '0xe34c5ea0c3083d11a735dc0609533b92130319f5',
|
cec: '0xfa1223747bae6d519580c53Cbb9C11a45b13c6b7',
|
||||||
// stake cec时, 每质押一个cec, 每年可获得的收益
|
// stake cec时, 每质押一个cec, 每年可获得的收益
|
||||||
// rewardPerSecond: BigInt(1.5 * 10 ** 18) / BigInt(365 * 24 * 60 * 60),
|
// rewardPerSecond: BigInt(1.5 * 10 ** 18) / BigInt(365 * 24 * 60 * 60),
|
||||||
rewardPerSecond: BigInt(1.5 * 10 ** 18) / BigInt(24 * 60 * 60),
|
rewardPerSecond: BigInt(1.5 * 10 ** 18) / BigInt(24 * 60 * 60),
|
||||||
|
@ -13,17 +13,15 @@ contract RewardRouter is ReentrancyGuard, Governable {
|
|||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
address public cec;
|
address public cec;
|
||||||
address public esCec;
|
|
||||||
|
|
||||||
address public stakedCecTracker;
|
address public stakedCecTracker;
|
||||||
address public cecVester;
|
address public cecVester;
|
||||||
|
|
||||||
event StakeCec(address account, address token, uint256 amount);
|
event StakeCec(address indexed account, address indexed token, uint256 amount);
|
||||||
event UnstakeCec(address account, address token, uint256 amount);
|
event UnstakeCec(address indexed account, address indexed token, uint256 amount);
|
||||||
|
|
||||||
constructor(address _cec, address _esCec, address _stakedCecTracker, address _cecVester) {
|
constructor(address _cec, address _stakedCecTracker, address _cecVester) {
|
||||||
cec = _cec;
|
cec = _cec;
|
||||||
esCec = _esCec;
|
|
||||||
stakedCecTracker = _stakedCecTracker;
|
stakedCecTracker = _stakedCecTracker;
|
||||||
cecVester = _cecVester;
|
cecVester = _cecVester;
|
||||||
}
|
}
|
||||||
@ -37,37 +35,24 @@ contract RewardRouter is ReentrancyGuard, Governable {
|
|||||||
address[] memory _accounts,
|
address[] memory _accounts,
|
||||||
uint256[] memory _amounts
|
uint256[] memory _amounts
|
||||||
) external nonReentrant onlyGov {
|
) external nonReentrant onlyGov {
|
||||||
address _cec = cec;
|
|
||||||
for (uint256 i = 0; i < _accounts.length; i++) {
|
for (uint256 i = 0; i < _accounts.length; i++) {
|
||||||
_stakeCec(msg.sender, _accounts[i], _cec, _amounts[i]);
|
_stakeCec(msg.sender, _accounts[i], cec, _amounts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stakeCecForAccount(address _account, uint256 _amount) external nonReentrant onlyGov {
|
|
||||||
_stakeCec(msg.sender, _account, cec, _amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stakeCec(uint256 _amount) external nonReentrant {
|
function stakeCec(uint256 _amount) external nonReentrant {
|
||||||
_stakeCec(msg.sender, msg.sender, cec, _amount);
|
_stakeCec(msg.sender, msg.sender, cec, _amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stakeEsCec(uint256 _amount) external nonReentrant {
|
|
||||||
_stakeCec(msg.sender, msg.sender, esCec, _amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unstakeCec(uint256 _amount) external nonReentrant {
|
function unstakeCec(uint256 _amount) external nonReentrant {
|
||||||
// check if the user has staked CEC in the vester
|
// check if the user has staked CEC in the vester
|
||||||
if (IVester(cecVester).needCheckStake()) {
|
if (cecVester != address(0) && IVester(cecVester).needCheckStake()) {
|
||||||
IVester(cecVester).updateVesting(msg.sender);
|
IVester(cecVester).updateVesting(msg.sender);
|
||||||
require(IERC20(cecVester).balanceOf(msg.sender) + _amount <= IRewardTracker(stakedCecTracker).depositBalances(msg.sender, cec), "RewardRouter: insufficient CEC balance");
|
require(IERC20(cecVester).balanceOf(msg.sender) + _amount <= IRewardTracker(stakedCecTracker).depositBalances(msg.sender, cec), "RewardRouter: insufficient CEC balance");
|
||||||
}
|
}
|
||||||
_unstakeCec(msg.sender, cec, _amount);
|
_unstakeCec(msg.sender, cec, _amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unstakeEsCec(uint256 _amount) external nonReentrant {
|
|
||||||
_unstakeCec(msg.sender, esCec, _amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
function claim() external nonReentrant {
|
function claim() external nonReentrant {
|
||||||
address account = msg.sender;
|
address account = msg.sender;
|
||||||
IRewardTracker(stakedCecTracker).claimForAccount(account, account);
|
IRewardTracker(stakedCecTracker).claimForAccount(account, account);
|
||||||
|
@ -37,9 +37,9 @@ contract Vester is IVester, IERC20, ReentrancyGuard, Governable {
|
|||||||
|
|
||||||
mapping(address handler => bool status) public isHandler;
|
mapping(address handler => bool status) public isHandler;
|
||||||
|
|
||||||
event Claim(address receiver, uint256 amount);
|
event Claim(address indexed receiver, uint256 amount);
|
||||||
event Deposit(address account, uint256 amount);
|
event Deposit(address indexed account, uint256 amount);
|
||||||
event Withdraw(address account, uint256 claimedAmount, uint256 balance);
|
event Withdraw(address indexed account, uint256 claimedAmount, uint256 balance);
|
||||||
event PairTransfer(address indexed from, address indexed to, uint256 value);
|
event PairTransfer(address indexed from, address indexed to, uint256 value);
|
||||||
event DurationUpdated(uint256 duration);
|
event DurationUpdated(uint256 duration);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnviro
|
|||||||
name: "stakedCecRouter",
|
name: "stakedCecRouter",
|
||||||
type: "logic",
|
type: "logic",
|
||||||
contractName: "RewardRouter",
|
contractName: "RewardRouter",
|
||||||
args: [cec, esCEC.address, stakedCecTracker.address, vester.address],
|
args: [cec, stakedCecTracker.address, vester.address],
|
||||||
verify: true,
|
verify: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -84,6 +84,8 @@ const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnviro
|
|||||||
// 添加转账白名单
|
// 添加转账白名单
|
||||||
tx = await esCECContract.setHandler(stakedCecTracker.address, true);
|
tx = await esCECContract.setHandler(stakedCecTracker.address, true);
|
||||||
await tx.wait();
|
await tx.wait();
|
||||||
|
tx = await esCECContract.setHandler(stakedCecDistributor.address, true);
|
||||||
|
await tx.wait();
|
||||||
console.log("==esCECContract setHandler");
|
console.log("==esCECContract setHandler");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnviro
|
|||||||
name: "stakedEsCecRouter",
|
name: "stakedEsCecRouter",
|
||||||
type: "logic",
|
type: "logic",
|
||||||
contractName: "RewardRouter",
|
contractName: "RewardRouter",
|
||||||
args: [cec, esCEC.address, stakedCecTracker.address, vester.address],
|
args: [esCEC.address, stakedCecTracker.address, ZeroAddress],
|
||||||
verify: true,
|
verify: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -70,6 +70,8 @@ const deployNFTClaim: DeployFunction = async function (hre: HardhatRuntimeEnviro
|
|||||||
// 添加转账白名单
|
// 添加转账白名单
|
||||||
tx = await esCECContract.setHandler(stakedCecTracker.address, true);
|
tx = await esCECContract.setHandler(stakedCecTracker.address, true);
|
||||||
await tx.wait();
|
await tx.wait();
|
||||||
|
tx = await esCECContract.setHandler(stakedCecDistributor.address, true);
|
||||||
|
await tx.wait();
|
||||||
console.log("==esCECContract setHandler");
|
console.log("==esCECContract setHandler");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"address": "0x994dE61dD536B22F7e3BDB77aa3ef55AeC938bFD",
|
"address": "0x6Ee091c2c242470f4f6D3d55604e1a66c6FF4ff5",
|
||||||
"abi": [
|
"abi": [
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
@ -228,25 +228,25 @@
|
|||||||
"type": "function"
|
"type": "function"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transactionHash": "0x081dc0abf2e8590307b39e4ef8e2a8aed469466345b0d1d78d2917de9dbe2b9c",
|
"transactionHash": "0x1866ed319cc55027199bf9717360c72d46f00f40539e1acbf170e11ba5a73e66",
|
||||||
"receipt": {
|
"receipt": {
|
||||||
"to": null,
|
"to": null,
|
||||||
"from": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
|
"from": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
|
||||||
"contractAddress": "0x994dE61dD536B22F7e3BDB77aa3ef55AeC938bFD",
|
"contractAddress": "0x6Ee091c2c242470f4f6D3d55604e1a66c6FF4ff5",
|
||||||
"transactionIndex": 0,
|
"transactionIndex": 0,
|
||||||
"gasUsed": "701322",
|
"gasUsed": "701322",
|
||||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"blockHash": "0x7fdbc380e3e22876b42772e7f4c71e640869956134aafc53790bdb8ed1349bfb",
|
"blockHash": "0x527c062b4f3437d116d4c119d1d417b8098322f322a22d7712b995eaae7b91ab",
|
||||||
"transactionHash": "0x081dc0abf2e8590307b39e4ef8e2a8aed469466345b0d1d78d2917de9dbe2b9c",
|
"transactionHash": "0x1866ed319cc55027199bf9717360c72d46f00f40539e1acbf170e11ba5a73e66",
|
||||||
"logs": [],
|
"logs": [],
|
||||||
"blockNumber": 43744733,
|
"blockNumber": 43749949,
|
||||||
"cumulativeGasUsed": "701322",
|
"cumulativeGasUsed": "701322",
|
||||||
"status": 1,
|
"status": 1,
|
||||||
"byzantium": true
|
"byzantium": true
|
||||||
},
|
},
|
||||||
"args": [
|
"args": [
|
||||||
"0x1FbA3F84e62163069050f1156b73C008722136A3",
|
"0x1FbA3F84e62163069050f1156b73C008722136A3",
|
||||||
"0x880aC8D394141a700855a349D865FA54227d302e"
|
"0x30cd668d0f280C404aD504bFf5d7a3Bf535f2A92"
|
||||||
],
|
],
|
||||||
"numDeployments": 1,
|
"numDeployments": 1,
|
||||||
"solcInputHash": "a5e022d74144abf232f7640cae906d26",
|
"solcInputHash": "a5e022d74144abf232f7640cae906d26",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"address": "0x880aC8D394141a700855a349D865FA54227d302e",
|
"address": "0x30cd668d0f280C404aD504bFf5d7a3Bf535f2A92",
|
||||||
"abi": [
|
"abi": [
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
@ -887,19 +887,19 @@
|
|||||||
"type": "function"
|
"type": "function"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transactionHash": "0x355deaa1ebf244eb7e570e6d74d7985a031136cd6f677ffad8f626ea048cdc85",
|
"transactionHash": "0xba731d4c49c985b23393bf18746aa5b67e85f44c60fe33ae887b29c00f45f57b",
|
||||||
"receipt": {
|
"receipt": {
|
||||||
"to": null,
|
"to": null,
|
||||||
"from": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
|
"from": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
|
||||||
"contractAddress": "0x880aC8D394141a700855a349D865FA54227d302e",
|
"contractAddress": "0x30cd668d0f280C404aD504bFf5d7a3Bf535f2A92",
|
||||||
"transactionIndex": 218,
|
"transactionIndex": 0,
|
||||||
"gasUsed": "2079969",
|
"gasUsed": "2079969",
|
||||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"blockHash": "0xbcd9e47aa2bfc72e35ec5202c4f519ed1428d4f5648e8c78cf15997119c03d09",
|
"blockHash": "0x1ef036875c2463f3b29d3a7b0794dd5340e13f7bcc78773179a6ab49917d8176",
|
||||||
"transactionHash": "0x355deaa1ebf244eb7e570e6d74d7985a031136cd6f677ffad8f626ea048cdc85",
|
"transactionHash": "0xba731d4c49c985b23393bf18746aa5b67e85f44c60fe33ae887b29c00f45f57b",
|
||||||
"logs": [],
|
"logs": [],
|
||||||
"blockNumber": 43744727,
|
"blockNumber": 43749942,
|
||||||
"cumulativeGasUsed": "8409697",
|
"cumulativeGasUsed": "2079969",
|
||||||
"status": 1,
|
"status": 1,
|
||||||
"byzantium": true
|
"byzantium": true
|
||||||
},
|
},
|
||||||
|
File diff suppressed because one or more lines are too long
@ -45,42 +45,42 @@
|
|||||||
"name": "stakedCecTracker",
|
"name": "stakedCecTracker",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/RewardTracker.json",
|
"json": "assets/contracts/RewardTracker.json",
|
||||||
"address": "0x18B41FbA9E096bc3E0A1F6aa92617B819Df6A602"
|
"address": "0x7554e677fF63212264db26dc743c67C277f219d2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stakedCecDistributor",
|
"name": "stakedCecDistributor",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/RewardDistributor.json",
|
"json": "assets/contracts/RewardDistributor.json",
|
||||||
"address": "0xA4f4452b4B91C27B84275ebcfBCca1c277FFA15b"
|
"address": "0x53153a177F4483b53b3f732Ff63eeB48c6FE89E5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vester",
|
"name": "vester",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/Vester.json",
|
"json": "assets/contracts/Vester.json",
|
||||||
"address": "0x01DeA050C23e19eC6A547f3824A9407DB9027f78"
|
"address": "0xeD00165aBA9efaCcE9e07705e474e0EE1Bb35328"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stakedCecRouter",
|
"name": "stakedCecRouter",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/RewardRouter.json",
|
"json": "assets/contracts/RewardRouter.json",
|
||||||
"address": "0xE9AFdA5939023a7B4104931030a32CFAC99f4af8"
|
"address": "0x576c3D53c6d4A19471E216c06945d41EC39f6014"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stakedEsCecTracker",
|
"name": "stakedEsCecTracker",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/RewardTracker.json",
|
"json": "assets/contracts/RewardTracker.json",
|
||||||
"address": "0x9679DE719eCe856Fe40E1f68C5ed48b344181035"
|
"address": "0x30cd668d0f280C404aD504bFf5d7a3Bf535f2A92"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stakedEsCecDistributor",
|
"name": "stakedEsCecDistributor",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/RewardDistributor.json",
|
"json": "assets/contracts/RewardDistributor.json",
|
||||||
"address": "0x11440cE5a7d6a1e6fa1e9fd790EBa93476F0DeA0"
|
"address": "0x6Ee091c2c242470f4f6D3d55604e1a66c6FF4ff5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stakedEsCecRouter",
|
"name": "stakedEsCecRouter",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/RewardRouter.json",
|
"json": "assets/contracts/RewardRouter.json",
|
||||||
"address": "0x2B656F1c485913577461e06bbf5adC999BC7743B"
|
"address": "0x19934736a578527cF725a33201445166Cbb62e52"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1 +1 @@
|
|||||||
["constructor(address,address,address,address)","event StakeCec(address,address,uint256)","event UnstakeCec(address,address,uint256)","function batchStakeCecForAccount(address[],uint256[])","function cec() view returns (address)","function cecVester() view returns (address)","function claim()","function esCec() view returns (address)","function gov() view returns (address)","function handleRewards(bool,bool,bool,bool)","function setGov(address)","function stakeCec(uint256)","function stakeCecForAccount(address,uint256)","function stakeEsCec(uint256)","function stakedCecTracker() view returns (address)","function unstakeCec(uint256)","function unstakeEsCec(uint256)","function withdrawToken(address,address,uint256)"]
|
["constructor(address,address,address)","event StakeCec(address indexed,address indexed,uint256)","event UnstakeCec(address indexed,address indexed,uint256)","function batchStakeCecForAccount(address[],uint256[])","function cec() view returns (address)","function cecVester() view returns (address)","function claim()","function gov() view returns (address)","function setGov(address)","function stakeCec(uint256)","function stakedCecTracker() view returns (address)","function unstakeCec(uint256)","function withdrawToken(address,address,uint256)"]
|
@ -70,7 +70,6 @@ describe('RewardRouter', function() {
|
|||||||
const RewardRouter = await hre.ethers.getContractFactory("RewardRouter");
|
const RewardRouter = await hre.ethers.getContractFactory("RewardRouter");
|
||||||
const rewardRouter = await RewardRouter.deploy(
|
const rewardRouter = await RewardRouter.deploy(
|
||||||
cec.target,
|
cec.target,
|
||||||
esCec.target,
|
|
||||||
stakedCecTracker.target,
|
stakedCecTracker.target,
|
||||||
vester.target,
|
vester.target,
|
||||||
);
|
);
|
||||||
@ -103,12 +102,12 @@ describe('RewardRouter', function() {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await cec.connect(user0).approve(stakedCecTracker.target, expandDecimals(1000, 18))
|
await cec.connect(user0).approve(stakedCecTracker.target, expandDecimals(1000, 18))
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await expect(rewardRouter.connect(user0).stakeCecForAccount(user1.address, expandDecimals(1000, 18)))
|
await expect(rewardRouter.connect(user0).batchStakeCecForAccount([user1.address], [expandDecimals(1000, 18)]))
|
||||||
.to.be.revertedWith("Governable: forbidden")
|
.to.be.revertedWith("Governable: forbidden")
|
||||||
|
|
||||||
await rewardRouter.setGov(user0.address)
|
await rewardRouter.setGov(user0.address)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await rewardRouter.connect(user0).stakeCecForAccount(user1.address, expandDecimals(800, 18))
|
await rewardRouter.connect(user0).batchStakeCecForAccount([user1.address], [expandDecimals(800, 18)])
|
||||||
expect(await cec.balanceOf(user0.address)).eq(expandDecimals(700, 18))
|
expect(await cec.balanceOf(user0.address)).eq(expandDecimals(700, 18))
|
||||||
|
|
||||||
await cec.mint(user1.address, expandDecimals(200, 18))
|
await cec.mint(user1.address, expandDecimals(200, 18))
|
||||||
@ -142,18 +141,18 @@ describe('RewardRouter', function() {
|
|||||||
|
|
||||||
// await timelock.processMint(esCec.target, tokenManager.address, expandDecimals(500, 18))
|
// await timelock.processMint(esCec.target, tokenManager.address, expandDecimals(500, 18))
|
||||||
// await esCec.connect(tokenManager).transferFrom(tokenManager.address, user2.address, expandDecimals(500, 18))
|
// await esCec.connect(tokenManager).transferFrom(tokenManager.address, user2.address, expandDecimals(500, 18))
|
||||||
await esCec.mint(user2.address, expandDecimals(500, 18))
|
await cec.mint(user2.address, expandDecimals(500, 18))
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await esCec.connect(user2).approve(stakedCecTracker.target, expandDecimals(500, 18))
|
await cec.connect(user2).approve(stakedCecTracker.target, expandDecimals(500, 18))
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await rewardRouter.connect(user2).stakeEsCec(expandDecimals(500, 18))
|
await rewardRouter.connect(user2).stakeCec(expandDecimals(500, 18))
|
||||||
|
|
||||||
expect(await stakedCecTracker.stakedAmounts(user0.address)).eq(0)
|
expect(await stakedCecTracker.stakedAmounts(user0.address)).eq(0)
|
||||||
expect(await stakedCecTracker.depositBalances(user0.address, cec.target)).eq(0)
|
expect(await stakedCecTracker.depositBalances(user0.address, cec.target)).eq(0)
|
||||||
expect(await stakedCecTracker.stakedAmounts(user1.address)).eq(expandDecimals(1000, 18))
|
expect(await stakedCecTracker.stakedAmounts(user1.address)).eq(expandDecimals(1000, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(1000, 18))
|
expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(1000, 18))
|
||||||
expect(await stakedCecTracker.stakedAmounts(user2.address)).eq(expandDecimals(500, 18))
|
expect(await stakedCecTracker.stakedAmounts(user2.address)).eq(expandDecimals(500, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user2.address, esCec.target)).eq(expandDecimals(500, 18))
|
expect(await stakedCecTracker.depositBalances(user2.address, cec.target)).eq(expandDecimals(500, 18))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -170,7 +169,7 @@ describe('RewardRouter', function() {
|
|||||||
|
|
||||||
expect(await esCec.balanceOf(user1.address)).eq(0)
|
expect(await esCec.balanceOf(user1.address)).eq(0)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await rewardRouter.connect(user1).claimEsCec()
|
await rewardRouter.connect(user1).claim()
|
||||||
expect(await esCec.balanceOf(user1.address)).gt(expandDecimals(8, 18))
|
expect(await esCec.balanceOf(user1.address)).gt(expandDecimals(8, 18))
|
||||||
expect(await esCec.balanceOf(user1.address)).lt(expandDecimals(9, 18))
|
expect(await esCec.balanceOf(user1.address)).lt(expandDecimals(9, 18))
|
||||||
|
|
||||||
@ -178,7 +177,7 @@ describe('RewardRouter', function() {
|
|||||||
|
|
||||||
expect(await esCec.balanceOf(user2.address)).eq(0)
|
expect(await esCec.balanceOf(user2.address)).eq(0)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await rewardRouter.connect(user2).claimEsCec()
|
await rewardRouter.connect(user2).claim()
|
||||||
expect(await esCec.balanceOf(user2.address)).gt(expandDecimals(2, 18))
|
expect(await esCec.balanceOf(user2.address)).gt(expandDecimals(2, 18))
|
||||||
expect(await esCec.balanceOf(user2.address)).lt(expandDecimals(5, 18))
|
expect(await esCec.balanceOf(user2.address)).lt(expandDecimals(5, 18))
|
||||||
|
|
||||||
@ -192,44 +191,44 @@ describe('RewardRouter', function() {
|
|||||||
await increaseTime(provider, Number(secondsOneDay))
|
await increaseTime(provider, Number(secondsOneDay))
|
||||||
await mineBlock(provider)
|
await mineBlock(provider)
|
||||||
await showLog('claim cec 2day', stakedCecTracker, esCec, user1.address)
|
await showLog('claim cec 2day', stakedCecTracker, esCec, user1.address)
|
||||||
// @ts-ignore
|
// // @ts-ignore
|
||||||
await rewardRouter.connect(user1).stakeEsCec(await esCec.balanceOf(user1.address))
|
// await rewardRouter.connect(user1).stakeCec(await esCec.balanceOf(user1.address))
|
||||||
|
|
||||||
await showLog('compound', stakedCecTracker, esCec, user1.address)
|
// await showLog('compound', stakedCecTracker, esCec, user1.address)
|
||||||
expect(await stakedCecTracker.stakedAmounts(user1.address)).gt(expandDecimals(1008, 18))
|
// expect(await stakedCecTracker.stakedAmounts(user1.address)).gt(expandDecimals(1008, 18))
|
||||||
expect(await stakedCecTracker.stakedAmounts(user1.address)).lt(expandDecimals(1009, 18))
|
// expect(await stakedCecTracker.stakedAmounts(user1.address)).lt(expandDecimals(1009, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(1000, 18))
|
// expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(1000, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).gt(expandDecimals(8, 18))
|
// expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).gt(expandDecimals(8, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).lt(expandDecimals(9, 18))
|
// expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).lt(expandDecimals(9, 18))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
expect(await cec.balanceOf(user1.address)).eq(0)
|
// expect(await cec.balanceOf(user1.address)).eq(0)
|
||||||
// @ts-ignore
|
// // @ts-ignore
|
||||||
await rewardRouter.connect(user1).unstakeCec(expandDecimals(300, 18))
|
// await rewardRouter.connect(user1).unstakeCec(expandDecimals(300, 18))
|
||||||
expect(await cec.balanceOf(user1.address)).eq(expandDecimals(300, 18))
|
// expect(await cec.balanceOf(user1.address)).eq(expandDecimals(300, 18))
|
||||||
|
|
||||||
expect(await stakedCecTracker.stakedAmounts(user1.address)).gt(expandDecimals(708, 18))
|
// expect(await stakedCecTracker.stakedAmounts(user1.address)).gt(expandDecimals(708, 18))
|
||||||
expect(await stakedCecTracker.stakedAmounts(user1.address)).lt(expandDecimals(709, 18))
|
// expect(await stakedCecTracker.stakedAmounts(user1.address)).lt(expandDecimals(709, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(700, 18))
|
// expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(700, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).gt(expandDecimals(8, 18))
|
// expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).gt(expandDecimals(8, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).lt(expandDecimals(9, 18))
|
// expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).lt(expandDecimals(9, 18))
|
||||||
|
|
||||||
|
|
||||||
const esCecBalance1 = await esCec.balanceOf(user1.address)
|
// const esCecBalance1 = await esCec.balanceOf(user1.address)
|
||||||
const esCecUnstakeBalance1 = await stakedCecTracker.depositBalances(user1.address, esCec.target)
|
// const esCecUnstakeBalance1 = await stakedCecTracker.depositBalances(user1.address, esCec.target)
|
||||||
// @ts-ignore
|
// // @ts-ignore
|
||||||
await rewardRouter.connect(user1).unstakeEsCec(esCecUnstakeBalance1)
|
// await rewardRouter.connect(user1).unstakeCec(esCecUnstakeBalance1)
|
||||||
expect(await esCec.balanceOf(user1.address)).eq(esCecBalance1 + esCecUnstakeBalance1)
|
// expect(await esCec.balanceOf(user1.address)).eq(esCecBalance1 + esCecUnstakeBalance1)
|
||||||
|
|
||||||
expect(await stakedCecTracker.stakedAmounts(user1.address)).eq(expandDecimals(700, 18))
|
// expect(await stakedCecTracker.stakedAmounts(user1.address)).eq(expandDecimals(700, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(700, 18))
|
// expect(await stakedCecTracker.depositBalances(user1.address, cec.target)).eq(expandDecimals(700, 18))
|
||||||
expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).eq(0)
|
// expect(await stakedCecTracker.depositBalances(user1.address, esCec.target)).eq(0)
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
// // @ts-ignore
|
||||||
await expect(rewardRouter.connect(user1).unstakeEsCec(expandDecimals(1, 18)))
|
// await expect(rewardRouter.connect(user1).unstakeCec(expandDecimals(1, 18)))
|
||||||
.to.be.revertedWith("RewardTracker: _amount exceeds depositBalance")
|
// .to.be.revertedWith("RewardTracker: _amount exceeds depositBalance")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
Loading…
x
Reference in New Issue
Block a user