This commit is contained in:
mingda
2020-11-05 14:10:59 +08:00
parent 4a7c5a546d
commit b31f1a30e2
8 changed files with 68 additions and 37 deletions

View File

@@ -53,11 +53,11 @@ describe("Trader", () => {
describe("trade", () => {
it("buy & sell", async () => {
console.log("BASE0 before buy", await ctx.DVM.methods._BASE0_().call())
console.log("BASE0 before buy", await ctx.DVM.methods.getBase0().call())
// buy
await logGas(ctx.Route.methods.sellQuoteOnDVM(ctx.DVM.options.address, trader, decimalStr("200"), decimalStr("1")), ctx.sendParam(trader), "buy base token")
console.log("BASE0 after buy", await ctx.DVM.methods._BASE0_().call())
console.log("BASE0 after buy", await ctx.DVM.methods.getBase0().call())
// trader balances
assert.equal(
await ctx.BASE.methods.balanceOf(trader).call(),
@@ -88,7 +88,7 @@ describe("Trader", () => {
// sell
await logGas(ctx.Route.methods.sellBaseOnDVM(ctx.DVM.options.address, trader, decimalStr("1"), decimalStr("100")), ctx.sendParam(trader), "sell base token")
console.log("BASE0 after sell", await ctx.DVM.methods._BASE0_().call())
console.log("BASE0 after sell", await ctx.DVM.methods.getBase0().call())
// trader balances
assert.equal(
await ctx.BASE.methods.balanceOf(trader).call(),