finish vdodo test && update
This commit is contained in:
@@ -107,17 +107,19 @@ export class VDODOContext {
|
||||
this.Deployer
|
||||
).send(this.sendParam(this.Deployer))
|
||||
|
||||
await this.VDODO.methods.changePerReward(decimalStr("1")).send(this.sendParam(this.Deployer));
|
||||
|
||||
await this.VDODO.methods.updateDODOCirculationHelper(this.DODOCirculationHelper.options.address).send(this.sendParam(this.Deployer));
|
||||
await this.mintTestToken(this.VDODO.options.address, decimalStr("100000"));
|
||||
await this.mintTestToken(allAccounts[8], decimalStr("10000"));
|
||||
await this.approveProxy(allAccounts[8]);
|
||||
|
||||
this.alpha = await this.VDODO.methods.alpha().call();
|
||||
this.lastRewardBlock = await this.VDODO.methods.lastRewardBlock().call();
|
||||
await this.VDODO.methods.preDepositedBlockReward(decimalStr("10000")).send(this.sendParam(allAccounts[8]));
|
||||
|
||||
var lastRewardBlock = await this.VDODO.methods._LAST_REWARD_BLOCK_().call();
|
||||
var curBlock = await this.Web3.eth.getBlockNumber();
|
||||
console.log("init-block:" + lastRewardBlock + " blockNumber:" + curBlock)
|
||||
|
||||
await this.VDODO.methods.changePerReward(decimalStr("1")).send(this.sendParam(this.Deployer));
|
||||
console.log(log.blueText("[Init VDODO context]"));
|
||||
|
||||
console.log("init alpha = " + this.alpha);
|
||||
console.log("init lastRewardBlock = " + this.lastRewardBlock);
|
||||
}
|
||||
|
||||
sendParam(sender, value = "0") {
|
||||
|
||||
@@ -16,10 +16,12 @@ let account0: string;
|
||||
let account1: string;
|
||||
let account2: string;
|
||||
let account3: string;
|
||||
let dodoTeam: string;
|
||||
let defaultSuperAddress: string;
|
||||
let owner: string;
|
||||
|
||||
async function init(ctx: VDODOContext): Promise<void> {
|
||||
dodoTeam = ctx.Deployer;
|
||||
account0 = ctx.SpareAccounts[0];
|
||||
account1 = ctx.SpareAccounts[1];
|
||||
account2 = ctx.SpareAccounts[2];
|
||||
@@ -28,7 +30,9 @@ async function init(ctx: VDODOContext): Promise<void> {
|
||||
owner = ctx.Deployer
|
||||
|
||||
await ctx.mintTestToken(account0, decimalStr("1000"));
|
||||
await ctx.mintTestToken(account1, decimalStr("1000"));
|
||||
await ctx.mintTestToken(account2, decimalStr("1000"));
|
||||
await ctx.mintTestToken(account3, decimalStr("1000"));
|
||||
|
||||
await ctx.approveProxy(account0);
|
||||
await ctx.approveProxy(account1);
|
||||
@@ -39,39 +43,39 @@ async function init(ctx: VDODOContext): Promise<void> {
|
||||
}
|
||||
|
||||
async function getGlobalState(ctx: VDODOContext, logInfo?: string) {
|
||||
var alpha = await ctx.VDODO.methods.getLatestAlpha().call();
|
||||
var lastRewardBlock = await ctx.VDODO.methods.lastRewardBlock().call();
|
||||
let [alpha,] = await ctx.VDODO.methods.getLatestAlpha().call();
|
||||
var lastRewardBlock = await ctx.VDODO.methods._LAST_REWARD_BLOCK_().call();
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
// console.log(logInfo + " alpha:" + fromWei(alpha, 'ether') + " lastRewardBlock:" + lastRewardBlock + " totalSuppy:" + fromWei(totalSuppy, 'ether'));
|
||||
return [alpha, lastRewardBlock,totalSuppy]
|
||||
}
|
||||
|
||||
async function dodoBalance(ctx: VDODOContext, user: string, logInfo?: string) {
|
||||
return [alpha, lastRewardBlock, totalSuppy]
|
||||
}
|
||||
|
||||
async function dodoBalance(ctx: VDODOContext, user: string, logInfo?: string) {
|
||||
var dodo_contract = await ctx.DODO.methods.balanceOf(ctx.VDODO.options.address).call();
|
||||
var dodo_account = await ctx.DODO.methods.balanceOf(user).call();
|
||||
|
||||
|
||||
// console.log(logInfo + " DODO:" + fromWei(dodo_contract, 'ether') + " account:" + fromWei(dodo_account, 'ether'));
|
||||
return [dodo_contract, dodo_account]
|
||||
}
|
||||
|
||||
async function getUserInfo(ctx: VDODOContext, user: string, logInfo?: string) {
|
||||
}
|
||||
|
||||
async function getUserInfo(ctx: VDODOContext, user: string, logInfo?: string) {
|
||||
var info = await ctx.VDODO.methods.userInfo(user).call();
|
||||
var res = {
|
||||
"VDODOAmount": info.VDODOAmount,
|
||||
"superiorVDODO": info.superiorVDODO,
|
||||
"superior": info.superior,
|
||||
"credit": info.credit
|
||||
"stakingPower": info.stakingPower,
|
||||
"superiorSP": info.superiorSP,
|
||||
"superior": info.superior,
|
||||
"credit": info.credit
|
||||
}
|
||||
// console.log(logInfo + " VDODOAmount:" + fromWei(info.VDODOAmount, 'ether') + " superiorVDODO:" + fromWei(info.superiorVDODO, 'ether') + " superior:" + info.superior + " credit:" + fromWei(info.credit, 'ether'));
|
||||
// console.log(logInfo + " stakingPower:" + fromWei(info.stakingPower, 'ether') + " superiorSP:" + fromWei(info.superiorSP, 'ether') + " superior:" + info.superior + " credit:" + fromWei(info.credit, 'ether'));
|
||||
return res
|
||||
}
|
||||
|
||||
async function mint(ctx: VDODOContext, user: string, mintAmount: string, superior: string) {
|
||||
}
|
||||
|
||||
async function mint(ctx: VDODOContext, user: string, mintAmount: string, superior: string) {
|
||||
await ctx.VDODO.methods.mint(
|
||||
mintAmount,
|
||||
superior
|
||||
mintAmount,
|
||||
superior
|
||||
).send(ctx.sendParam(user));
|
||||
}
|
||||
}
|
||||
|
||||
describe("vDODO-erc20", () => {
|
||||
let snapshotId: string;
|
||||
@@ -93,214 +97,171 @@ describe("vDODO-erc20", () => {
|
||||
|
||||
describe("vdodo-erc20", () => {
|
||||
|
||||
it("totalSupply", async () => {
|
||||
var lastRewardBlock = await ctx.VDODO.methods._LAST_REWARD_BLOCK_().call();
|
||||
var curBlock = await ctx.Web3.eth.getBlockNumber();
|
||||
console.log("init-block:" + lastRewardBlock + " blockNumber:" + curBlock)
|
||||
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
assert(totalSuppy, decimalStr("0.09"))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), dodoTeam).send(ctx.sendParam(account0))
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
assert(totalSuppy, decimalStr("0.2"))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), dodoTeam).send(ctx.sendParam(account0))
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
assert(totalSuppy, decimalStr("0.31"))
|
||||
})
|
||||
|
||||
|
||||
it("transfer-vdodo", async () => {
|
||||
//检查四个人 【包括from, to 以及各自的上级】,info变化
|
||||
//alpha lastRewardBlock
|
||||
//各自dodo余额变化
|
||||
|
||||
let [,lastRewardBlockStart,] = await getGlobalState(ctx, "before");
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"),account1).send(ctx.sendParam(account0))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"),account3).send(ctx.sendParam(account2))
|
||||
let [, lastRewardBlockStart,] = await getGlobalState(ctx, "before");
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), dodoTeam).send(ctx.sendParam(account0))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), account0).send(ctx.sendParam(account1))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), account1).send(ctx.sendParam(account2))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), account2).send(ctx.sendParam(account3))
|
||||
|
||||
//增加一个区块
|
||||
await ctx.mintTestToken(account0, decimalStr("0"));
|
||||
let [alpha,lastRewardBlock,] = await getGlobalState(ctx, "after");
|
||||
|
||||
assert.equal(lastRewardBlock,Number(lastRewardBlockStart)+11);
|
||||
let [alpha, lastRewardBlock,] = await getGlobalState(ctx, "after");
|
||||
|
||||
assert.equal(alpha, "113833992094861660108");
|
||||
|
||||
assert.equal(alpha, "1195775916960005765");
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
assert.equal(
|
||||
totalSuppy
|
||||
, decimalStr("0.210833333333333332"));
|
||||
|
||||
|
||||
assert.equal(totalSuppy, "540000000000000000");
|
||||
|
||||
let userInfo0 = await getUserInfo(ctx, account0, "User0 ");
|
||||
assert.equal(userInfo0.VDODOAmount, decimalStr("0.1"));
|
||||
assert.equal(userInfo0.superiorVDODO, decimalStr("0.01"));
|
||||
assert.equal(userInfo0.credit, "0");
|
||||
let userInfo1 = await getUserInfo(ctx, account1, "User0 Superior ")
|
||||
assert.equal(userInfo1.VDODOAmount, decimalStr("0.01"));
|
||||
assert.equal(userInfo1.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo1.credit, decimalStr("1"));
|
||||
assert.equal(userInfo0.stakingPower, "10916666666666666666");
|
||||
assert.equal(userInfo0.superiorSP, decimalStr("1"));
|
||||
assert.equal(userInfo0.credit, "999999999999999999");
|
||||
|
||||
let userInfo1 = await getUserInfo(ctx, account1, "User1 ")
|
||||
assert.equal(userInfo1.stakingPower, "10045138888888888889");
|
||||
assert.equal(userInfo1.superiorSP, "916666666666666666");
|
||||
assert.equal(userInfo1.credit, "999999999999999999");
|
||||
|
||||
let userInfo2 = await getUserInfo(ctx, account2, "User2 ");
|
||||
assert.equal(userInfo2.VDODOAmount, decimalStr("0.091666666666666666"));
|
||||
assert.equal(userInfo2.superiorVDODO, decimalStr("0.009166666666666666"));
|
||||
assert.equal(userInfo2.credit, decimalStr("0"));
|
||||
let userInfo3 = await getUserInfo(ctx, account3, "User2 Superior");
|
||||
assert.equal(userInfo3.VDODOAmount, decimalStr("0.009166666666666666"));
|
||||
assert.equal(userInfo3.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo3.credit, decimalStr("0.999999999999999928"));
|
||||
assert.equal(userInfo2.stakingPower, "9638792438271604945");
|
||||
assert.equal(userInfo2.superiorSP, "878472222222222222");
|
||||
assert.equal(userInfo2.credit, "999999999999999999");
|
||||
|
||||
let userInfo3 = await getUserInfo(ctx, account3, "User3 ");
|
||||
assert.equal(userInfo3.stakingPower, "8540702160493827171");
|
||||
assert.equal(userInfo3.superiorSP, "854070216049382717");
|
||||
assert.equal(userInfo3.credit, decimalStr("0"));
|
||||
|
||||
|
||||
let [, dodo_u0] = await dodoBalance(ctx, account0, "start")
|
||||
assert.equal(dodo_u0, "990000000000000000000");
|
||||
let [, dodo_u1] = await dodoBalance(ctx, account1, "start")
|
||||
assert.equal(dodo_u1, "0");
|
||||
assert.equal(dodo_u1, "990000000000000000000");
|
||||
let [, dodo_u2] = await dodoBalance(ctx, account2, "start")
|
||||
assert.equal(dodo_u2, "990000000000000000000");
|
||||
let [, dodo_u3] = await dodoBalance(ctx, account3, "start")
|
||||
assert.equal(dodo_u3, "0");
|
||||
assert.equal(dodo_u3, "990000000000000000000");
|
||||
|
||||
let account1Balance = await ctx.VDODO.methods.balanceOf(account1).call()
|
||||
await logGas(await ctx.VDODO.methods.transfer(
|
||||
account2,
|
||||
decimalStr("0.1")
|
||||
), ctx.sendParam(account0), "transfer");
|
||||
|
||||
|
||||
// await ctx.VDODO.methods.transfer(account2,decimalStr("0.1")).send(ctx.sendParam(account0))
|
||||
account3,
|
||||
account1Balance
|
||||
), ctx.sendParam(account1), "transfer");
|
||||
|
||||
let userInfo0_after = await getUserInfo(ctx, account0, "userInfo0_after");
|
||||
let userInfo1_after = await getUserInfo(ctx, account1, "userInfo1_after");
|
||||
let userInfo2_after = await getUserInfo(ctx, account2, "userInfo2_after");
|
||||
let userInfo3_after = await getUserInfo(ctx, account3, "userInfo3_after");
|
||||
|
||||
|
||||
assert.equal(userInfo0_after.VDODOAmount, "0");
|
||||
assert.equal(userInfo0_after.superiorVDODO, "0");
|
||||
assert.equal(userInfo0_after.stakingPower, "10097456459435626102");
|
||||
assert.equal(userInfo0_after.superiorSP, decimalStr("1"));
|
||||
assert.equal(userInfo0_after.credit, "0");
|
||||
|
||||
assert.equal(userInfo1_after.VDODOAmount, decimalStr("0.001566666666666667"));
|
||||
assert.equal(userInfo1_after.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo1_after.credit, "0");
|
||||
assert.equal(userInfo1_after.stakingPower, "1024213041698160810");
|
||||
assert.equal(userInfo1_after.superiorSP, "14574081947593859");
|
||||
assert.equal(userInfo1_after.credit, "999999999999999999");
|
||||
|
||||
assert.equal(userInfo2_after.VDODOAmount, decimalStr("0.191666666666666666"));
|
||||
assert.equal(userInfo2_after.superiorVDODO, decimalStr("0.019166666666666666"));
|
||||
assert.equal(userInfo2_after.credit, "0");
|
||||
assert.equal(userInfo2_after.stakingPower, "10540885022990677752");
|
||||
assert.equal(userInfo2_after.superiorSP, "878472222222222222");
|
||||
assert.equal(userInfo2_after.credit, "2101173516585172447");
|
||||
|
||||
assert.equal(userInfo3_after.VDODOAmount, decimalStr("0.019166666666666666"));
|
||||
assert.equal(userInfo3_after.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo3_after.credit, decimalStr("2.185770750988142222"));
|
||||
assert.equal(userInfo3_after.stakingPower, "17561628007684555250");
|
||||
assert.equal(userInfo3_after.superiorSP, "1756162800768455524");
|
||||
assert.equal(userInfo3_after.credit, "0");
|
||||
|
||||
|
||||
|
||||
let [alphaEnd,lastRewardBlockEnd,totalSuppyEnd] = await getGlobalState(ctx, "end");
|
||||
assert.equal(alphaEnd, decimalStr("118.577075098814229308"));
|
||||
assert.equal(totalSuppyEnd, decimalStr("0.212399999999999999"));
|
||||
assert.equal(lastRewardBlockEnd,Number(lastRewardBlock)+2);
|
||||
|
||||
|
||||
let [, dodo_u0_end] = await dodoBalance(ctx, account0, "end")
|
||||
assert.equal(dodo_u0_end, "990000000000000000000");
|
||||
let [, dodo_u1_end] = await dodoBalance(ctx, account1, "end")
|
||||
assert.equal(dodo_u1_end, "0");
|
||||
let [, dodo_u2_end] = await dodoBalance(ctx, account2, "end")
|
||||
assert.equal(dodo_u2_end, "990000000000000000000");
|
||||
let [, dodo_u3_end] = await dodoBalance(ctx, account3, "end")
|
||||
assert.equal(dodo_u3_end, "0");
|
||||
|
||||
let [alphaEnd, lastRewardBlockEnd, totalSuppyEnd] = await getGlobalState(ctx, "end");
|
||||
assert.equal(alphaEnd, "1220687915230005885");
|
||||
assert.equal(totalSuppyEnd, "550000000000000000");
|
||||
assert.equal(lastRewardBlockEnd, Number(lastRewardBlock) + 2);
|
||||
});
|
||||
|
||||
it("transferFrom-vdodo", async () => {
|
||||
//检查四个人 【包括from, to 以及各自的上级】,info变化
|
||||
//alpha lastRewardBlock
|
||||
//各自dodo余额变化
|
||||
//approve 状态变化
|
||||
|
||||
let [,lastRewardBlockStart,] = await getGlobalState(ctx, "before");
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"),account1).send(ctx.sendParam(account0))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"),account3).send(ctx.sendParam(account2))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), dodoTeam).send(ctx.sendParam(account0))
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), dodoTeam).send(ctx.sendParam(account1))
|
||||
|
||||
//增加一个区块
|
||||
await ctx.mintTestToken(account0, decimalStr("0"));
|
||||
let [alpha,lastRewardBlock,] = await getGlobalState(ctx, "after");
|
||||
|
||||
assert.equal(lastRewardBlock,Number(lastRewardBlockStart)+11);
|
||||
let [alpha, lastRewardBlock,] = await getGlobalState(ctx, "after");
|
||||
|
||||
assert.equal(alpha, "113833992094861660108");
|
||||
assert.equal(alpha, "1138339920948616600");
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
assert.equal(
|
||||
totalSuppy
|
||||
, decimalStr("0.210833333333333332"));
|
||||
|
||||
|
||||
assert.equal(totalSuppy, "320000000000000000");
|
||||
|
||||
let userInfo0 = await getUserInfo(ctx, account0, "User0 ");
|
||||
assert.equal(userInfo0.VDODOAmount, decimalStr("0.1"));
|
||||
assert.equal(userInfo0.superiorVDODO, decimalStr("0.01"));
|
||||
assert.equal(userInfo0.stakingPower, decimalStr("10"));
|
||||
assert.equal(userInfo0.superiorSP, decimalStr("1"));
|
||||
assert.equal(userInfo0.credit, "0");
|
||||
let userInfo1 = await getUserInfo(ctx, account1, "User0 Superior ")
|
||||
assert.equal(userInfo1.VDODOAmount, decimalStr("0.01"));
|
||||
assert.equal(userInfo1.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo1.credit, decimalStr("1"));
|
||||
|
||||
let userInfo2 = await getUserInfo(ctx, account2, "User2 ");
|
||||
assert.equal(userInfo2.VDODOAmount, decimalStr("0.091666666666666666"));
|
||||
assert.equal(userInfo2.superiorVDODO, decimalStr("0.009166666666666666"));
|
||||
assert.equal(userInfo2.credit, decimalStr("0"));
|
||||
let userInfo3 = await getUserInfo(ctx, account3, "User2 Superior");
|
||||
assert.equal(userInfo3.VDODOAmount, decimalStr("0.009166666666666666"));
|
||||
assert.equal(userInfo3.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo3.credit, decimalStr("0.999999999999999928"));
|
||||
let userInfo1 = await getUserInfo(ctx, account1, "User1 ")
|
||||
assert.equal(userInfo1.stakingPower, "9166666666666666667");
|
||||
assert.equal(userInfo1.superiorSP, "916666666666666666");
|
||||
assert.equal(userInfo1.credit, decimalStr("0"));
|
||||
|
||||
|
||||
let [, dodo_u0] = await dodoBalance(ctx, account0, "start")
|
||||
assert.equal(dodo_u0, "990000000000000000000");
|
||||
let [, dodo_u1] = await dodoBalance(ctx, account1, "start")
|
||||
assert.equal(dodo_u1, "0");
|
||||
let [, dodo_u2] = await dodoBalance(ctx, account2, "start")
|
||||
assert.equal(dodo_u2, "990000000000000000000");
|
||||
let [, dodo_u3] = await dodoBalance(ctx, account3, "start")
|
||||
assert.equal(dodo_u3, "0");
|
||||
|
||||
assert.equal(dodo_u1, "990000000000000000000");
|
||||
|
||||
let account0Balance = await ctx.VDODO.methods.balanceOf(account0).call()
|
||||
await logGas(await ctx.VDODO.methods.approve(
|
||||
account3,
|
||||
decimalStr("0.1")
|
||||
account2,
|
||||
account0Balance
|
||||
), ctx.sendParam(account0), "approve");
|
||||
|
||||
await logGas(await ctx.VDODO.methods.transferFrom(
|
||||
account0,
|
||||
account2,
|
||||
decimalStr("0.1")
|
||||
), ctx.sendParam(account3), "transferFrom");
|
||||
account1,
|
||||
account0Balance
|
||||
), ctx.sendParam(account2), "transferFrom");
|
||||
|
||||
let userInfo0_after = await getUserInfo(ctx, account0, "userInfo0_after");
|
||||
let userInfo1_after = await getUserInfo(ctx, account1, "userInfo1_after");
|
||||
let userInfo2_after = await getUserInfo(ctx, account2, "userInfo2_after");
|
||||
let userInfo3_after = await getUserInfo(ctx, account3, "userInfo3_after");
|
||||
|
||||
|
||||
assert.equal(userInfo0_after.VDODOAmount, "0");
|
||||
assert.equal(userInfo0_after.superiorVDODO, "0");
|
||||
assert.equal(userInfo0_after.stakingPower, "769230769230769236");
|
||||
assert.equal(userInfo0_after.superiorSP, "76923076923076924");
|
||||
assert.equal(userInfo0_after.credit, "0");
|
||||
|
||||
assert.equal(userInfo1_after.VDODOAmount, decimalStr("0.001891025641025642"));
|
||||
assert.equal(userInfo1_after.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo1_after.stakingPower, "18397435897435897431");
|
||||
assert.equal(userInfo1_after.superiorSP, "1839743589743589742");
|
||||
assert.equal(userInfo1_after.credit, "0");
|
||||
|
||||
assert.equal(userInfo2_after.VDODOAmount, decimalStr("0.191666666666666666"));
|
||||
assert.equal(userInfo2_after.superiorVDODO, decimalStr("0.019166666666666666"));
|
||||
assert.equal(userInfo2_after.stakingPower, "0");
|
||||
assert.equal(userInfo2_after.superiorSP, "0");
|
||||
assert.equal(userInfo2_after.credit, "0");
|
||||
|
||||
assert.equal(userInfo3_after.VDODOAmount, decimalStr("0.019166666666666666"));
|
||||
assert.equal(userInfo3_after.superiorVDODO, decimalStr("0"));
|
||||
assert.equal(userInfo3_after.credit, decimalStr("2.233201581027667914"));
|
||||
|
||||
|
||||
|
||||
let [alphaEnd,lastRewardBlockEnd,totalSuppyEnd] = await getGlobalState(ctx, "end");
|
||||
assert.equal(alphaEnd, decimalStr("123.320158102766798508"));
|
||||
assert.equal(totalSuppyEnd, decimalStr("0.212724358974358974"));
|
||||
assert.equal(lastRewardBlockEnd,Number(lastRewardBlock)+3);
|
||||
|
||||
|
||||
let [, dodo_u0_end] = await dodoBalance(ctx, account0, "end")
|
||||
assert.equal(dodo_u0_end, "990000000000000000000");
|
||||
let [, dodo_u1_end] = await dodoBalance(ctx, account1, "end")
|
||||
assert.equal(dodo_u1_end, "0");
|
||||
let [, dodo_u2_end] = await dodoBalance(ctx, account2, "end")
|
||||
assert.equal(dodo_u2_end, "990000000000000000000");
|
||||
let [, dodo_u3_end] = await dodoBalance(ctx, account3, "end")
|
||||
assert.equal(dodo_u3_end, "0");
|
||||
|
||||
let [alphaEnd, lastRewardBlockEnd, totalSuppyEnd] = await getGlobalState(ctx, "end");
|
||||
assert.equal(alphaEnd, "1233201581027667984");
|
||||
assert.equal(totalSuppyEnd, "340000000000000000");
|
||||
assert.equal(lastRewardBlockEnd, Number(lastRewardBlock) + 3);
|
||||
|
||||
//再次transferFrom 预期revert
|
||||
//预期revert
|
||||
await truffleAssert.reverts(
|
||||
ctx.VDODO.methods.transferFrom(account0,account2,decimalStr("0.1")).send(ctx.sendParam(account3)),
|
||||
ctx.VDODO.methods.transferFrom(account0, account1, 1).send(ctx.sendParam(account2)),
|
||||
"ALLOWANCE_NOT_ENOUGH"
|
||||
)
|
||||
});
|
||||
@@ -308,39 +269,41 @@ describe("vDODO-erc20", () => {
|
||||
it("transfer - close", async () => {
|
||||
|
||||
await ctx.VDODO.methods.setCantransfer(false).send(ctx.sendParam(owner))
|
||||
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"),defaultSuperAddress).send(ctx.sendParam(account0))
|
||||
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"), dodoTeam).send(ctx.sendParam(account0))
|
||||
assert.equal(
|
||||
await ctx.DODO.methods.balanceOf(account0).call(),
|
||||
decimalStr("990")
|
||||
);
|
||||
assert.equal(
|
||||
await ctx.DODO.methods.balanceOf(ctx.VDODO.options.address).call(),
|
||||
decimalStr("100010")
|
||||
decimalStr("10010")
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
await ctx.VDODO.methods.balanceOf(account0).call(),
|
||||
decimalStr("0.1")
|
||||
);
|
||||
|
||||
|
||||
assert.equal(
|
||||
await ctx.VDODO.methods.balanceOf(account1).call(),
|
||||
decimalStr("0")
|
||||
);
|
||||
//预期revert
|
||||
await truffleAssert.reverts(
|
||||
ctx.VDODO.methods.transfer(account1,decimalStr("0.1")).send(ctx.sendParam(account0)),
|
||||
"vDODOToken: not allowed transfer"
|
||||
)
|
||||
assert.equal(
|
||||
await ctx.VDODO.methods.balanceOf(account0).call(),
|
||||
decimalStr("0.1")
|
||||
);
|
||||
assert.equal(
|
||||
await ctx.VDODO.methods.balanceOf(account1).call(),
|
||||
await ctx.VDODO.methods.balanceOf(dodoTeam).call(),
|
||||
decimalStr("0")
|
||||
);
|
||||
|
||||
//预期revert
|
||||
await truffleAssert.reverts(
|
||||
ctx.VDODO.methods.transfer(account1, 1).send(ctx.sendParam(account0)),
|
||||
"vDODOToken: not allowed transfer"
|
||||
)
|
||||
//revert 触发产生区块,造成vdodo增加
|
||||
assert.equal(
|
||||
await ctx.VDODO.methods.balanceOf(account0).call(),
|
||||
"109090909090909090"
|
||||
);
|
||||
assert.equal(
|
||||
await ctx.VDODO.methods.balanceOf(account1).call(),
|
||||
decimalStr("0")
|
||||
);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@@ -13,8 +13,10 @@ import BigNumber from 'bignumber.js';
|
||||
|
||||
let account0: string;
|
||||
let account1: string;
|
||||
let dodoTeam: string;
|
||||
|
||||
async function init(ctx: VDODOContext): Promise<void> {
|
||||
dodoTeam = ctx.Deployer;
|
||||
account0 = ctx.SpareAccounts[0];
|
||||
account1 = ctx.SpareAccounts[1];
|
||||
|
||||
@@ -26,13 +28,14 @@ async function init(ctx: VDODOContext): Promise<void> {
|
||||
}
|
||||
|
||||
async function getGlobalState(ctx: VDODOContext, logInfo?: string) {
|
||||
var alpha = await ctx.VDODO.methods.getLatestAlpha().call();
|
||||
var lastRewardBlock = await ctx.VDODO.methods.lastRewardBlock().call();
|
||||
let [alpha,] = await ctx.VDODO.methods.getLatestAlpha().call();
|
||||
var lastRewardBlock = await ctx.VDODO.methods._LAST_REWARD_BLOCK_().call();
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
var dodoPerBlock = await ctx.VDODO.methods.dodoPerBlock().call();
|
||||
// console.log(logInfo + "==> alpha:" + fromWei(alpha, 'ether') + " lastRewardBlock:" + lastRewardBlock + " totalSuppy:" + fromWei(totalSuppy, 'ether')+ " dodoPerBlock:" + fromWei(dodoPerBlock, 'ether'));
|
||||
return [alpha, lastRewardBlock,dodoPerBlock]
|
||||
}
|
||||
var dodoPerBlock = await ctx.VDODO.methods._DODO_PER_BLOCK_().call();
|
||||
console.log(logInfo + "==> alpha:" + fromWei(alpha, 'ether') + " lastRewardBlock:" + lastRewardBlock + " totalSuppy:" + fromWei(totalSuppy, 'ether') + " dodoPerBlock:" + fromWei(dodoPerBlock, 'ether'));
|
||||
return [alpha, lastRewardBlock, dodoPerBlock]
|
||||
}
|
||||
|
||||
describe("vDODO-owner", () => {
|
||||
let snapshotId: string;
|
||||
let ctx: VDODOContext;
|
||||
@@ -54,79 +57,84 @@ describe("vDODO-owner", () => {
|
||||
|
||||
it("change-reward", async () => {
|
||||
//改变前alpha lastRewardBlock 状态
|
||||
let [alpha,lastRewardBlock,dodoPerBlock] = await getGlobalState(ctx, "before");
|
||||
|
||||
let [alpha, lastRewardBlock, dodoPerBlock] = await getGlobalState(ctx, "before");
|
||||
//change-reward
|
||||
await ctx.VDODO.methods.changePerReward(decimalStr("2")).send(ctx.sendParam(ctx.Deployer))
|
||||
//改变后状态
|
||||
let [alphaAfter,lastRewardBlockAfter,dodoPerBlockAfter] = await getGlobalState(ctx, "after");
|
||||
let [alphaAfter, lastRewardBlockAfter, dodoPerBlockAfter] = await getGlobalState(ctx, "after");
|
||||
|
||||
assert.equal(
|
||||
await lastRewardBlock,
|
||||
Number(lastRewardBlockAfter)-7
|
||||
);
|
||||
assert.equal(//totalSupply==0
|
||||
await alpha,
|
||||
alphaAfter
|
||||
alpha,
|
||||
"1000000000000000000"
|
||||
);
|
||||
|
||||
assert.notEqual(
|
||||
await dodoPerBlock,
|
||||
dodoPerBlockAfter
|
||||
"2000000000000000000"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it("donate", async () => {
|
||||
//改变前alpha lastRewardBlock 状态
|
||||
let [before,lastRewardBlock,] = await getGlobalState(ctx, "before");
|
||||
|
||||
await logGas(await ctx.VDODO.methods.mint(
|
||||
decimalStr("100"),
|
||||
account1
|
||||
), ctx.sendParam(account0), "mint-fisrt");
|
||||
|
||||
dodoTeam
|
||||
), ctx.sendParam(account0), "mint-fisrt");
|
||||
|
||||
let [alphaBefore, lastRewardBlock,] = await getGlobalState(ctx, "before");
|
||||
|
||||
await logGas(await ctx.VDODO.methods.donate(
|
||||
decimalStr("100")
|
||||
), ctx.sendParam(account0), "donate");
|
||||
|
||||
|
||||
let [alphaAfter,lastRewardBlockAfter,] = await getGlobalState(ctx, "after");
|
||||
assert.notEqual(
|
||||
before,
|
||||
alphaAfter
|
||||
|
||||
let [alphaAfter, lastRewardBlockAfter,] = await getGlobalState(ctx, "after");
|
||||
|
||||
assert.equal(
|
||||
alphaBefore,
|
||||
"1000000000000000000"
|
||||
);
|
||||
assert.equal(
|
||||
alphaAfter,
|
||||
"191818181818181818180"//newAlpha +amount/totalSupply
|
||||
alphaAfter,
|
||||
"1918181818181818180"//newAlpha +amount/totalSupply
|
||||
);
|
||||
assert.equal(
|
||||
lastRewardBlock,
|
||||
Number(lastRewardBlockAfter)-7
|
||||
lastRewardBlockAfter
|
||||
);
|
||||
});
|
||||
|
||||
it("read-helper", async () => {
|
||||
//不同amount对应的feeRatio (5 5-15 15)
|
||||
let ratio0 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("0.2")).call()//<=1 ->5
|
||||
let ratio0 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("0.51")).call()
|
||||
assert.equal(
|
||||
ratio0,
|
||||
decimalStr("0.05")
|
||||
);
|
||||
|
||||
let ratio1 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("11")).call()//>=10 ->15
|
||||
let ratio1 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("0.5")).call()
|
||||
assert.equal(
|
||||
ratio1,
|
||||
decimalStr("0.05")
|
||||
);
|
||||
|
||||
let ratio2 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("0.09")).call()
|
||||
assert.equal(
|
||||
ratio2,
|
||||
decimalStr("0.15")
|
||||
);
|
||||
|
||||
let ratio2 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("6")).call()//-->5-15
|
||||
let ratio3 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("0.1")).call()
|
||||
assert.equal(
|
||||
ratio2,
|
||||
decimalStr("0.066852058071690192")
|
||||
ratio3,
|
||||
decimalStr("0.15")
|
||||
);
|
||||
|
||||
let ratio4 = await ctx.DODOCirculationHelper.methods.geRatioValue(decimalStr("0.3")).call()
|
||||
assert.equal(
|
||||
ratio4,
|
||||
decimalStr("0.1")
|
||||
);
|
||||
// console.log("ratio2 = "+ fromWei(ratio2, 'ether'));
|
||||
assert.isAbove(Number(ratio2),Number(ratio0))
|
||||
assert.isBelow(Number(ratio2),Number(ratio1))
|
||||
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@@ -39,8 +39,8 @@ async function init(ctx: VDODOContext): Promise<void> {
|
||||
}
|
||||
|
||||
async function getGlobalState(ctx: VDODOContext, logInfo?: string) {
|
||||
var alpha = await ctx.VDODO.methods.getLatestAlpha().call();
|
||||
var lastRewardBlock = await ctx.VDODO.methods.lastRewardBlock().call();
|
||||
let [alpha,] = await ctx.VDODO.methods.getLatestAlpha().call();
|
||||
var lastRewardBlock = await ctx.VDODO.methods._LAST_REWARD_BLOCK_().call();
|
||||
var totalSuppy = await ctx.VDODO.methods.totalSupply().call();
|
||||
console.log(logInfo + " alpha:" + fromWei(alpha, 'ether') + " lastRewardBlock:" + lastRewardBlock + " totalSuppy:" + fromWei(totalSuppy, 'ether'));
|
||||
return [alpha, lastRewardBlock]
|
||||
@@ -57,12 +57,12 @@ async function dodoBalance(ctx: VDODOContext, user: string, logInfo?: string) {
|
||||
async function getUserInfo(ctx: VDODOContext, user: string, logInfo?: string) {
|
||||
var info = await ctx.VDODO.methods.userInfo(user).call();
|
||||
var res = {
|
||||
"VDODOAmount": info.VDODOAmount,
|
||||
"superiorVDODO": info.superiorVDODO,
|
||||
"stakingPower": info.stakingPower,
|
||||
"superiorSP": info.superiorSP,
|
||||
"superior": info.superior,
|
||||
"credit": info.credit
|
||||
}
|
||||
console.log(logInfo + " VDODOAmount:" + fromWei(info.VDODOAmount, 'ether') + " superiorVDODO:" + fromWei(info.superiorVDODO, 'ether') + " superior:" + info.superior + " credit:" + fromWei(info.credit, 'ether'));
|
||||
console.log(logInfo + " stakingPower:" + fromWei(info.stakingPower, 'ether') + " superiorSP:" + fromWei(info.superiorSP, 'ether') + " superior:" + info.superior + " credit:" + fromWei(info.credit, 'ether'));
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -112,14 +112,14 @@ describe("VDODO", () => {
|
||||
let superiorInfo = await getUserInfo(ctx, dodoTeam, "Superior after")
|
||||
let [, dodo_u] = await dodoBalance(ctx, account0, "after")
|
||||
|
||||
assert.equal(alpha, "101818181818181818181");
|
||||
assert.equal(userInfo.VDODOAmount, "1000000000000000000");
|
||||
assert.equal(userInfo.superiorVDODO, "100000000000000000");
|
||||
assert.equal(alpha, "1018181818181818181");
|
||||
assert.equal(userInfo.stakingPower, "100000000000000000000");
|
||||
assert.equal(userInfo.superiorSP, "10000000000000000000");
|
||||
assert.equal(userInfo.credit, "0");
|
||||
assert.equal(userInfo.superior, dodoTeam);
|
||||
|
||||
assert.equal(superiorInfo.VDODOAmount, "100000000000000000");
|
||||
assert.equal(superiorInfo.superiorVDODO, "0");
|
||||
assert.equal(superiorInfo.stakingPower, "10000000000000000000");
|
||||
assert.equal(superiorInfo.superiorSP, "0");
|
||||
assert.equal(superiorInfo.credit, "10000000000000000000");
|
||||
assert.equal(superiorInfo.superior, "0x0000000000000000000000000000000000000000");
|
||||
|
||||
@@ -147,15 +147,15 @@ describe("VDODO", () => {
|
||||
let superiorInfo = await getUserInfo(ctx, dodoTeam, "Superior after")
|
||||
let [, dodo_u] = await dodoBalance(ctx, account0, "after")
|
||||
|
||||
assert.equal(alpha, "101365693130399012751");
|
||||
assert.equal(userInfo.VDODOAmount, "1990990990990990990");
|
||||
assert.equal(userInfo.superiorVDODO, "199099099099099099");
|
||||
assert.equal(alpha, "1013656931303990126");
|
||||
assert.equal(userInfo.stakingPower, "199099099099099099188");
|
||||
assert.equal(userInfo.superiorSP, "19909909909909909918");
|
||||
assert.equal(userInfo.credit, "0");
|
||||
assert.equal(userInfo.superior, dodoTeam);
|
||||
|
||||
assert.equal(superiorInfo.VDODOAmount, "199099099099099099");
|
||||
assert.equal(superiorInfo.superiorVDODO, "0");
|
||||
assert.equal(superiorInfo.credit, "19999999999999999990");
|
||||
assert.equal(superiorInfo.stakingPower, "19909909909909909918");
|
||||
assert.equal(superiorInfo.superiorSP, "0");
|
||||
assert.equal(superiorInfo.credit, "19999999999999999999");
|
||||
assert.equal(superiorInfo.superior, "0x0000000000000000000000000000000000000000");
|
||||
|
||||
assert.equal(dodo_u, "99800000000000000000000")
|
||||
@@ -185,15 +185,15 @@ describe("VDODO", () => {
|
||||
let superiorInfo = await getUserInfo(ctx, dodoTeam, "Superior after")
|
||||
let [, dodo_u] = await dodoBalance(ctx, account0, "after")
|
||||
|
||||
assert.equal(alpha, "101671011483201419416");
|
||||
assert.equal(userInfo.VDODOAmount, "1986527067608148689");
|
||||
assert.equal(userInfo.superiorVDODO, "198652706760814868");
|
||||
assert.equal(alpha, "1016710114832014192");
|
||||
assert.equal(userInfo.stakingPower, "198652706760814869070");
|
||||
assert.equal(userInfo.superiorSP, "19865270676081486907");
|
||||
assert.equal(userInfo.credit, "0");
|
||||
assert.equal(userInfo.superior, dodoTeam);
|
||||
|
||||
assert.equal(superiorInfo.VDODOAmount, "297751805859913967");
|
||||
assert.equal(superiorInfo.superiorVDODO, "0");
|
||||
assert.equal(superiorInfo.credit, "29999999999999999897");
|
||||
assert.equal(superiorInfo.stakingPower, "29775180585991396825");
|
||||
assert.equal(superiorInfo.superiorSP, "0");
|
||||
assert.equal(superiorInfo.credit, "29999999999999999998");
|
||||
assert.equal(superiorInfo.superior, "0x0000000000000000000000000000000000000000")
|
||||
|
||||
|
||||
@@ -201,8 +201,8 @@ describe("VDODO", () => {
|
||||
|
||||
let otherInfo = await getUserInfo(ctx, account1, "Superior after")
|
||||
|
||||
assert.equal(otherInfo.VDODOAmount, "990990990990990990");
|
||||
assert.equal(otherInfo.superiorVDODO, "99099099099099099");
|
||||
assert.equal(otherInfo.stakingPower, "99099099099099099188");
|
||||
assert.equal(otherInfo.superiorSP, "9909909909909909918");
|
||||
assert.equal(otherInfo.credit, "0");
|
||||
assert.equal(otherInfo.superior, dodoTeam)
|
||||
|
||||
@@ -213,11 +213,11 @@ describe("VDODO", () => {
|
||||
it("redeem-amount-read", async () => {
|
||||
await mint(ctx, account0, decimalStr("100"), dodoTeam)
|
||||
|
||||
let [dodoReceive, burnDodoAmount, withdrawFeeDodoAmount] = await ctx.VDODO.methods.getWithdrawAmount(decimalStr("1")).call();
|
||||
let [dodoReceive, burnDodoAmount, withdrawFeeDodoAmount] = await ctx.VDODO.methods.getWithdrawResult(decimalStr("1")).call();
|
||||
|
||||
assert.equal(dodoReceive, decimalStr("85"));
|
||||
assert.equal(dodoReceive, decimalStr("0.85"));
|
||||
assert.equal(burnDodoAmount, decimalStr("0"));
|
||||
assert.equal(withdrawFeeDodoAmount, decimalStr("15"));
|
||||
assert.equal(withdrawFeeDodoAmount, decimalStr("0.15"));
|
||||
});
|
||||
|
||||
|
||||
@@ -229,25 +229,25 @@ describe("VDODO", () => {
|
||||
await getUserInfo(ctx, dodoTeam, "Superior before")
|
||||
await dodoBalance(ctx, account0, "before")
|
||||
|
||||
await logGas(await ctx.VDODO.methods.redeem(decimalStr("10")), ctx.sendParam(account0), "redeem-partial-haveMint");
|
||||
await logGas(await ctx.VDODO.methods.redeem(decimalStr("10"), false), ctx.sendParam(account0), "redeem-partial-haveMint");
|
||||
|
||||
let [alpha,] = await getGlobalState(ctx, "after");
|
||||
let userInfo = await getUserInfo(ctx, account0, "User after");
|
||||
let superiorInfo = await getUserInfo(ctx, dodoTeam, "Superior after")
|
||||
let [, dodo_u] = await dodoBalance(ctx, account0, "after")
|
||||
|
||||
assert.equal(alpha, "101524380165289256197");
|
||||
assert.equal(userInfo.VDODOAmount, "90000000000000000000");
|
||||
assert.equal(userInfo.superiorVDODO, "9000000000000000000");
|
||||
assert.equal(alpha, "1015242271212274241");
|
||||
assert.equal(userInfo.stakingPower, "9000090900827197526589");
|
||||
assert.equal(userInfo.superiorSP, "900009090082719752659");
|
||||
assert.equal(userInfo.credit, "0");
|
||||
assert.equal(userInfo.superior, dodoTeam);
|
||||
|
||||
assert.equal(superiorInfo.VDODOAmount, "9000000000000000000");
|
||||
assert.equal(superiorInfo.superiorVDODO, "0");
|
||||
assert.equal(superiorInfo.credit, "899990909090909090910");
|
||||
assert.equal(superiorInfo.stakingPower, "900009090082719752659");
|
||||
assert.equal(superiorInfo.superiorSP, "0");
|
||||
assert.equal(superiorInfo.credit, "900000000000000000001");
|
||||
assert.equal(superiorInfo.superior, "0x0000000000000000000000000000000000000000");
|
||||
|
||||
assert.equal(dodo_u, "90850077272727272727265")
|
||||
assert.equal(dodo_u, "90850000000000000000000")
|
||||
|
||||
});
|
||||
|
||||
@@ -266,25 +266,25 @@ describe("VDODO", () => {
|
||||
|
||||
let dodoTeamVdodoAmount = await ctx.VDODO.methods.balanceOf(dodoTeam).call()
|
||||
|
||||
await logGas(await ctx.VDODO.methods.redeem((dodoTeamVdodoAmount - 3000) + ""), ctx.sendParam(dodoTeam), "redeem-partial-NotMint");
|
||||
await logGas(await ctx.VDODO.methods.redeem((dodoTeamVdodoAmount - 3000) + "", false), ctx.sendParam(dodoTeam), "redeem-partial-NotMint");
|
||||
|
||||
let [alpha,] = await getGlobalState(ctx, "after");
|
||||
let userInfo = await getUserInfo(ctx, dodoTeam, "User after");
|
||||
let superiorInfo = await getUserInfo(ctx, account3, "One of referer after")
|
||||
let [, dodo_u] = await dodoBalance(ctx, dodoTeam, "after")
|
||||
|
||||
assert.equal(alpha, "101909933011338172201");
|
||||
assert.equal(userInfo.VDODOAmount, "393425809544634067");
|
||||
assert.equal(userInfo.superiorVDODO, "0");
|
||||
assert.equal(userInfo.credit, "39999999999999999876");
|
||||
assert.equal(alpha, "1019099117914144640");
|
||||
assert.equal(userInfo.stakingPower, "39343185109576338546");
|
||||
assert.equal(userInfo.superiorSP, "0");
|
||||
assert.equal(userInfo.credit, "39999999999999999997");
|
||||
assert.equal(userInfo.superior, "0x0000000000000000000000000000000000000000");
|
||||
|
||||
assert.equal(superiorInfo.VDODOAmount, "986527067608148689");
|
||||
assert.equal(superiorInfo.superiorVDODO, "98652706760814868");
|
||||
assert.equal(superiorInfo.stakingPower, "98652706760814869070");
|
||||
assert.equal(superiorInfo.superiorSP, "9865270676081486907");
|
||||
assert.equal(superiorInfo.credit, "0");
|
||||
assert.equal(superiorInfo.superior, dodoTeam);
|
||||
|
||||
assert.equal(dodo_u, "232341473424735076")
|
||||
assert.equal(dodo_u, "231818181817926710")
|
||||
});
|
||||
|
||||
|
||||
@@ -298,27 +298,25 @@ describe("VDODO", () => {
|
||||
await getUserInfo(ctx, dodoTeam, "Superior before")
|
||||
await dodoBalance(ctx, account1, "before")
|
||||
|
||||
let account1VdodoAmount = await ctx.VDODO.methods.balanceOf(account1).call()
|
||||
|
||||
await logGas(await ctx.VDODO.methods.redeem(account1VdodoAmount), ctx.sendParam(account1), "redeem-all-haveMint");
|
||||
await logGas(await ctx.VDODO.methods.redeem(0, true), ctx.sendParam(account1), "redeem-all-haveMint");
|
||||
|
||||
let [alpha,] = await getGlobalState(ctx, "after");
|
||||
let userInfo = await getUserInfo(ctx, account1, "User after");
|
||||
let superiorInfo = await getUserInfo(ctx, dodoTeam, "Superior after")
|
||||
let [, dodo_u] = await dodoBalance(ctx, account1, "after")
|
||||
|
||||
assert.equal(alpha, "100154467726495446770");
|
||||
assert.equal(userInfo.VDODOAmount, "0");
|
||||
assert.equal(userInfo.superiorVDODO, "0");
|
||||
assert.equal(alpha, "1001544677264954465");
|
||||
assert.equal(userInfo.stakingPower, "0");
|
||||
assert.equal(userInfo.superiorSP, "0");
|
||||
assert.equal(userInfo.credit, "0");
|
||||
assert.equal(userInfo.superior, dodoTeam);
|
||||
|
||||
assert.equal(superiorInfo.VDODOAmount, "10000000000000000000");
|
||||
assert.equal(superiorInfo.superiorVDODO, "0");
|
||||
assert.equal(superiorInfo.credit, "999999099990999910000");
|
||||
assert.equal(superiorInfo.stakingPower, "1000000000000000000000");
|
||||
assert.equal(superiorInfo.superiorSP, "0");
|
||||
assert.equal(superiorInfo.credit, "999999099990999910008");
|
||||
assert.equal(superiorInfo.superior, "0x0000000000000000000000000000000000000000");
|
||||
|
||||
assert.equal(dodo_u, "985007650076500764963")
|
||||
assert.equal(dodo_u, "985007650076500764931")
|
||||
|
||||
});
|
||||
|
||||
@@ -335,27 +333,25 @@ describe("VDODO", () => {
|
||||
await getUserInfo(ctx, account3, "One of referer before");
|
||||
await dodoBalance(ctx, dodoTeam, "before")
|
||||
|
||||
let dodoTeamVdodoAmount = await ctx.VDODO.methods.balanceOf(dodoTeam).call()
|
||||
|
||||
await logGas(await ctx.VDODO.methods.redeem(dodoTeamVdodoAmount), ctx.sendParam(dodoTeam), "redeem-all-NotMint");
|
||||
await logGas(await ctx.VDODO.methods.redeem(0, true), ctx.sendParam(dodoTeam), "redeem-all-NotMint");
|
||||
|
||||
let [alpha,] = await getGlobalState(ctx, "after");
|
||||
let userInfo = await getUserInfo(ctx, dodoTeam, "User after");
|
||||
let superiorInfo = await getUserInfo(ctx, account3, "One of referer after")
|
||||
let [, dodo_u] = await dodoBalance(ctx, dodoTeam, "after")
|
||||
|
||||
assert.equal(alpha, "101909933011338182738");
|
||||
assert.equal(userInfo.VDODOAmount, "393425809544631067");
|
||||
assert.equal(userInfo.superiorVDODO, "0");
|
||||
assert.equal(userInfo.credit, "39999999999999999876");
|
||||
assert.equal(alpha, "1019130459045726342");
|
||||
assert.equal(userInfo.stakingPower, "39253971537899000903");
|
||||
assert.equal(userInfo.superiorSP, "0");
|
||||
assert.equal(userInfo.credit, "39999999999999999997");
|
||||
assert.equal(userInfo.superior, "0x0000000000000000000000000000000000000000");
|
||||
|
||||
assert.equal(superiorInfo.VDODOAmount, "986527067608148689");
|
||||
assert.equal(superiorInfo.superiorVDODO, "98652706760814868");
|
||||
assert.equal(superiorInfo.stakingPower, "98652706760814869070");
|
||||
assert.equal(superiorInfo.superiorSP, "9865270676081486907");
|
||||
assert.equal(superiorInfo.credit, "0");
|
||||
assert.equal(superiorInfo.superior, dodoTeam);
|
||||
|
||||
assert.equal(dodo_u, "232341473424994923")
|
||||
assert.equal(dodo_u, "309090909090909029")
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user