add events from user bid/cancel in crowdpooling

This commit is contained in:
牛涛涛
2021-01-05 23:43:27 +08:00
parent 1bc41f9a61
commit 5a81c6a404
5 changed files with 49 additions and 44 deletions

View File

@@ -32,15 +32,15 @@ describe("Funding", () => {
before(async () => {
config = {
totalBase: decimalStr("10000"),
poolQuoteCap: decimalStr("80000"),
k: decimalStr("0.5"),
poolQuoteCap: decimalStr("50000"),
k: decimalStr("0"),
i: decimalStr("10"),
lpFeeRate: decimalStr("0.002"),
bidDuration: new BigNumber(86400),
calmDuration: new BigNumber(86400),
freezeDuration: new BigNumber(86400),
vestingDuration: new BigNumber(86400),
cliffRate: decimalStr("0.1"),
cliffRate: decimalStr("1"),
}
ctx = new CPContext();
await ctx.init(config);
@@ -69,18 +69,18 @@ describe("Funding", () => {
var poolAddress = await ctx.CP.methods._POOL_().call()
var pool = getContractWithAddress(DVM_NAME, poolAddress)
assert.equal(await pool.methods.getMidPrice().call(), "64921894064178782")
assert.equal(await ctx.CP.methods._AVG_SETTLED_PRICE_().call(), "15403124237432848687")
assert.equal(await pool.methods.getMidPrice().call(), "10000000003162277660")
assert.equal(await ctx.CP.methods._AVG_SETTLED_PRICE_().call(), "10000000000000000000")
assert.equal(await ctx.CP.methods._UNUSED_QUOTE_().call(), decimalStr("19900"))
assert.equal(await ctx.CP.methods._UNUSED_BASE_().call(), "5193751525134302627024")
assert.equal(await ctx.CP.methods._UNUSED_QUOTE_().call(), decimalStr("49900"))
assert.equal(await ctx.CP.methods._UNUSED_BASE_().call(), "5000000000000000000000")
assert.equal(await ctx.BASE.methods.balanceOf(poolAddress).call(), "4806248474865697372976")
assert.equal(await ctx.BASE.methods.balanceOf(ctx.CP.options.address).call(), "5193751525134302627024")
assert.equal(await ctx.BASE.methods.balanceOf(poolAddress).call(), "5000000000000000000000")
assert.equal(await ctx.BASE.methods.balanceOf(ctx.CP.options.address).call(), "5000000000000000000000")
assert.equal(await ctx.QUOTE.methods.balanceOf(poolAddress).call(), decimalStr("80000"))
assert.equal(await ctx.QUOTE.methods.balanceOf(ctx.CP.options.address).call(), decimalStr("19900"))
assert.equal(await ctx.QUOTE.methods.balanceOf(poolAddress).call(), decimalStr("50000"))
assert.equal(await ctx.QUOTE.methods.balanceOf(ctx.CP.options.address).call(), decimalStr("49900"))
})
})
})
})