transfer close test
This commit is contained in:
@@ -10,13 +10,16 @@ import { logGas } from '../utils/Log';
|
||||
import { VDODOContext, getVDODOContext } from '../utils/VDODOContext';
|
||||
import { assert } from 'chai';
|
||||
import BigNumber from 'bignumber.js';
|
||||
const truffleAssert = require('truffle-assertions');
|
||||
|
||||
let account0: string;
|
||||
let account1: string;
|
||||
let defaultSuperAddress: string;
|
||||
|
||||
async function init(ctx: VDODOContext): Promise<void> {
|
||||
account0 = ctx.SpareAccounts[0];
|
||||
account1 = ctx.SpareAccounts[1];
|
||||
defaultSuperAddress = ctx.Maintainer
|
||||
|
||||
await ctx.mintTestToken(account0, decimalStr("1000"));
|
||||
await ctx.mintTestToken(account1, decimalStr("1000"));
|
||||
@@ -62,44 +65,39 @@ describe("vDODO-erc20", () => {
|
||||
});
|
||||
|
||||
it("transfer - close", async () => {
|
||||
|
||||
await ctx.VDODO.methods.mint(decimalStr("10"),defaultSuperAddress).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")
|
||||
);
|
||||
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(),
|
||||
decimalStr("0")
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
||||
// it("vdodo owner can transfer", async () => {
|
||||
|
||||
// await ctx.VDODO.methods.mint(decimalStr("10"),"0x0000000000000000000000000000000000000000").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("10")
|
||||
// );
|
||||
// assert.equal(
|
||||
// await ctx.VDODO.methods.balanceOf(account0).call(),
|
||||
// decimalStr("0.1")
|
||||
// );
|
||||
// assert.equal(
|
||||
// await ctx.VDODO.methods.balanceOf(account1).call(),
|
||||
// decimalStr("0")
|
||||
// );
|
||||
|
||||
|
||||
// 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(),
|
||||
// decimalStr("0")
|
||||
// );
|
||||
|
||||
// });
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user