Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new vDODOCirculationHelper #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions contracts/DODOToken/DODONewCirculationHelper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*

Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0

*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

contract DODONewCirculationHelper {

function getDodoWithdrawFeeRatio() external pure returns (uint256 ratio) {
return 0;
}

}
1 change: 1 addition & 0 deletions test/utils/Contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const DODO_GOVERNANCE = "Governance"
export const DODO_PROXY_NAME = "DODOV2Proxy02"
export const ERC20_MINE = "ERC20Mine"
export const VDODO_MINE = "vDODOMine"
export const VDODO_NO_FEE = "DODONewCirculationHelper"

export const NFT_VAULT = "NFTCollateralVault"
export const NFT_FEE = "FeeDistributor"
Expand Down
7 changes: 6 additions & 1 deletion test/utils/VDODOContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class VDODOContext {
DODOApproveProxy: Contract;

DODOCirculationHelper: Contract;
DODONewCirculationHelper: Contract;
// Governance: Contract;

lastRewardBlock: number;
Expand Down Expand Up @@ -91,6 +92,10 @@ export class VDODOContext {
]
);

this.DODONewCirculationHelper = await contracts.newContract(
contracts.VDODO_NO_FEE
);

// await this.Governance.methods.initOwner(
// this.Deployer
// ).send(this.sendParam(this.Deployer))
Expand All @@ -108,7 +113,7 @@ export class VDODOContext {
).send(this.sendParam(this.Deployer))


await this.VDODO.methods.updateDODOCirculationHelper(this.DODOCirculationHelper.options.address).send(this.sendParam(this.Deployer));
await this.VDODO.methods.updateDODOCirculationHelper(this.DODONewCirculationHelper.options.address).send(this.sendParam(this.Deployer));
await this.mintTestToken(allAccounts[8], decimalStr("10000"));
await this.approveProxy(allAccounts[8]);

Expand Down
40 changes: 23 additions & 17 deletions test/vDODO/mintRedeem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ describe("VDODO", () => {

let [dodoReceive, burnDodoAmount, withdrawFeeDodoAmount] = await ctx.VDODO.methods.getWithdrawResult(decimalStr("1")).call();

assert.equal(dodoReceive, decimalStr("0.85"));
assert.equal(dodoReceive, decimalStr("1")); // 0.15
assert.equal(burnDodoAmount, decimalStr("0"));
assert.equal(withdrawFeeDodoAmount, decimalStr("0.15"));
assert.equal(withdrawFeeDodoAmount, decimalStr("0")); //0.85

});


Expand All @@ -235,8 +236,8 @@ describe("VDODO", () => {
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, "1015242271212274241");
assert.equal(alpha, "1000090909090909090"); // 1015242271212274241
assert.equal(userInfo.stakingPower, "9000090900827197526589");
assert.equal(userInfo.superiorSP, "900009090082719752659");
assert.equal(userInfo.credit, "0");
Expand All @@ -247,8 +248,8 @@ describe("VDODO", () => {
assert.equal(superiorInfo.credit, "900000000000000000001");
assert.equal(superiorInfo.superior, "0x0000000000000000000000000000000000000000");

assert.equal(dodo_u, "90850000000000000000000")

assert.equal(dodo_u, "91000000000000000000000") // 90850000000000000000000
});


Expand All @@ -265,15 +266,16 @@ describe("VDODO", () => {
await dodoBalance(ctx, dodoTeam, "before")

let dodoTeamVdodoAmount = await ctx.VDODO.methods.balanceOf(dodoTeam).call()
assert.equal(dodoTeamVdodoAmount, 2727272727272726);

await logGas(await ctx.VDODO.methods.redeem((dodoTeamVdodoAmount - 3000) + "", false), ctx.sendParam(dodoTeam), "redeem-partial-NotMint");

let [alpha,] = await getGlobalState(ctx, "after");
let [alpha,] = await getGlobalState(ctx, "after"); // nofee:1.019005171524637248 fee15:1.01909911791414464
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, "1019099117914144640");
let [, dodo_u] = await dodoBalance(ctx, dodoTeam, "after") // nofee:10399.7272727272730274 fee15:10399.76818181818207329
assert.equal(alpha, "1019005171524637248"); //1019099117914144640
assert.equal(userInfo.stakingPower, "39343185109576338546");
assert.equal(userInfo.superiorSP, "0");
assert.equal(userInfo.credit, "39999999999999999997");
Expand All @@ -284,7 +286,8 @@ describe("VDODO", () => {
assert.equal(superiorInfo.credit, "0");
assert.equal(superiorInfo.superior, dodoTeam);

assert.equal(dodo_u, "231818181817926710")
assert.equal(dodo_u, "272727272726972600"); // 231818181817926710

});


Expand All @@ -304,8 +307,8 @@ describe("VDODO", () => {
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, "1001544677264954465");
assert.equal(alpha, "1000180918172818090"); // 1001544677264954465
assert.equal(userInfo.stakingPower, "0");
assert.equal(userInfo.superiorSP, "0");
assert.equal(userInfo.credit, "0");
Expand All @@ -316,8 +319,8 @@ describe("VDODO", () => {
assert.equal(superiorInfo.credit, "999999099990999910008");
assert.equal(superiorInfo.superior, "0x0000000000000000000000000000000000000000");

assert.equal(dodo_u, "985007650076500764931")

assert.equal(dodo_u, "1000009000090000899918") // 985007650076500764931
});


Expand All @@ -340,7 +343,10 @@ describe("VDODO", () => {
let superiorInfo = await getUserInfo(ctx, account3, "One of referer after")
let [, dodo_u] = await dodoBalance(ctx, dodoTeam, "after")

assert.equal(alpha, "1019130459045726342");
console.log(alpha, "1019130459045726342");
console.log(dodo_u, "309090909090909029");

assert.equal(alpha, "1019005171524637248"); //1019130459045726342
assert.equal(userInfo.stakingPower, "39253971537899000903");
assert.equal(userInfo.superiorSP, "0");
assert.equal(userInfo.credit, "39999999999999999997");
Expand All @@ -351,7 +357,7 @@ describe("VDODO", () => {
assert.equal(superiorInfo.credit, "0");
assert.equal(superiorInfo.superior, dodoTeam);

assert.equal(dodo_u, "309090909090909029")
assert.equal(dodo_u, "363636363636363563") // 309090909090909029
});
})
});
2 changes: 1 addition & 1 deletion truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var infuraId = process.env.infuraId;
require("ts-node/register"); // eslint-disable-line
require("dotenv-flow").config(); // eslint-disable-line

const { LINEASCAN_API_KEY, BASESCAN_API_KEY } = process.env;
const { LINEASCAN_API_KEY, BASESCAN_API_KEY, SCROLL_API_KEY } = process.env;

module.exports = {
/**
Expand Down