add dvm sync test
This commit is contained in:
@@ -25,7 +25,6 @@ async function init(ctx: DVMContext): Promise<void> {
|
||||
await ctx.transferQuoteToDVM(lp, decimalStr("1000"))
|
||||
await ctx.DVM.methods.buyShares(lp).send(ctx.sendParam(lp));
|
||||
|
||||
console.log("deposit")
|
||||
}
|
||||
|
||||
describe("AMMLikeCase", () => {
|
||||
@@ -54,7 +53,7 @@ describe("AMMLikeCase", () => {
|
||||
describe("trade", () => {
|
||||
|
||||
it("basic state", async () => {
|
||||
console.log(await ctx.DVM.methods.getMidPrice().call())
|
||||
console.log("DVM mid price", await ctx.DVM.methods.getMidPrice().call())
|
||||
})
|
||||
|
||||
it("buy", async () => {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
import { DVMContext, getDVMContext } from '../utils/DVMContext';
|
||||
import { assert } from 'chai';
|
||||
import { decimalStr } from '../utils/Converter';
|
||||
const truffleAssert = require('truffle-assertions');
|
||||
|
||||
async function init(ctx: DVMContext): Promise<void> { }
|
||||
@@ -59,5 +60,14 @@ describe("Admin Set", () => {
|
||||
await truffleAssert.reverts(ctx.DVM.methods.sellBase(ctx.Deployer).send(ctx.sendParam(ctx.Deployer)), "TRADER_SELL_NOT_ALLOWED")
|
||||
})
|
||||
|
||||
it("sync", async () => {
|
||||
await ctx.BASE.methods.mint(ctx.DVM.options.address, decimalStr("123")).send(ctx.sendParam(ctx.Deployer))
|
||||
await ctx.QUOTE.methods.mint(ctx.DVM.options.address, decimalStr("456")).send(ctx.sendParam(ctx.Deployer))
|
||||
|
||||
await ctx.DVM.methods.sync().send(ctx.sendParam(ctx.Deployer))
|
||||
assert.equal(await ctx.DVM.methods._BASE_RESERVE_().call(), decimalStr("123"))
|
||||
assert.equal(await ctx.DVM.methods._QUOTE_RESERVE_().call(), decimalStr("456"))
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user