update drops test
This commit is contained in:
@@ -95,7 +95,6 @@ module.exports = {
|
||||
DropsProxy: "0xa968a8B14174395c922347Ab593a0CD7EFf30cf1",
|
||||
|
||||
//DODODropsV2: "0x4A2b9f63AE41cF3003A494F2d8Fcd9Ed850b9A6f"
|
||||
|
||||
// DropsERC721: "0x3df8d553275781C777f432A74EEE9099226B9d13",
|
||||
// DropsERC1155: "0x3a8EcF30428bd4e33Cd7011533DFd596F7705c8F",
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ const { KOVAN_CONFIG } = require("./config/kovan-config");
|
||||
const { MBTEST_CONFIG } = require("./config/mbtest-config");
|
||||
const { MBTESTNET_CONFIG } = require("./config/mbtestnet-config");
|
||||
const { MATIC_CONFIG } = require("./config/matic-config");
|
||||
<<<<<<< HEAD
|
||||
const { ARB_CONFIG } = require("./config/arb-config");
|
||||
=======
|
||||
>>>>>>> update drops test
|
||||
const { RINKEBY_CONFIG } = require("./config/rinkeby-config");
|
||||
|
||||
exports.GetConfig = function (network, accounts) {
|
||||
|
||||
@@ -101,13 +101,6 @@ contract BaseDrops is InitializableMintableERC20, ReentrancyGuard {
|
||||
|
||||
if(sellingTimeInterval.length > 0) _setSellingInfo(sellingTimeInterval, sellingPrice, sellingAmount);
|
||||
|
||||
// if(isProbMode) {
|
||||
// // (uint256[][] memory tokenIdMap) = abi.decode(tokenIdMapBytes, (uint256[][]));
|
||||
// // if(probInterval.length > 0) _setProbInfo(probInterval, tokenIdMap);
|
||||
// }else {
|
||||
// // if(tokenIdList.length > 0) _setFixedAmountInfo(tokenIdList);
|
||||
// }
|
||||
|
||||
string memory prefix = "DROPS_";
|
||||
name = string(abi.encodePacked(prefix, addressToShortString(address(this))));
|
||||
symbol = name;
|
||||
@@ -239,10 +232,8 @@ contract BaseDrops is InitializableMintableERC20, ReentrancyGuard {
|
||||
_setSellingInfo(sellingTimeIntervals, prices, amounts);
|
||||
}
|
||||
|
||||
//TODO: 待测试
|
||||
function setProbInfo(uint256[] memory probIntervals,bytes memory tokenIdMapBytes) external notStart() onlyOwner {
|
||||
(uint256[][] memory tokenIdMap) = abi.decode(tokenIdMapBytes, (uint256[][]));
|
||||
_setProbInfo(probIntervals, tokenIdMap);
|
||||
function setProbInfo(uint256[] memory probIntervals,uint256[][] memory tokenIdMaps) external notStart() onlyOwner {
|
||||
_setProbInfo(probIntervals, tokenIdMaps);
|
||||
}
|
||||
|
||||
function setFixedAmountInfo(uint256[] memory tokenIdList) external notStart() onlyOwner {
|
||||
|
||||
@@ -320,3 +320,17 @@ Init DODONFTProxyAddress Tx: 0xb4c5fd59e7d4bf2705295aeb0a05ccb745df3603af902d6b8
|
||||
DODOApproveProxy unlockAddProxy tx: 0xe8915536c6f0b5cae8df32fc5e62ed344b1cf9eb8e8c79a59c90f78d34680a47
|
||||
DODOApproveProxy addDODOProxy tx: 0xe81647348464194ec395de39fd088f06feed5abe428209b3ed264abeed6358b6
|
||||
Add AdminList on DODONFTRegistry Tx: 0x774f02629e4635303a28faa1914460ed07516facfc2e2818d2908a93488f1b5d
|
||||
====================================================
|
||||
network type: rinkeby
|
||||
Deploy time: 2021/5/25 下午3:32:48
|
||||
Deploy type: MysteryBoxKAKA
|
||||
====================================================
|
||||
network type: rinkeby
|
||||
Deploy time: 2021/5/25 下午3:37:18
|
||||
Deploy type: MysteryBoxKAKA
|
||||
====================================================
|
||||
network type: rinkeby
|
||||
Deploy time: 2021/5/25 下午3:39:50
|
||||
Deploy type: MysteryBoxKAKA
|
||||
MysteryBoxV1Address: 0x77915e3AC19E0465F6c0895779A9A4778B56C387
|
||||
Init MysteryBoxV1 Tx: 0xc707aad96a65d12a04234b912bd466f91d5f56f99f6c849a6b2a431ada6b519b
|
||||
@@ -17,7 +17,7 @@ let user1: string;
|
||||
let user2: string;
|
||||
let user3: string;
|
||||
|
||||
async function init(ctx: DropsContext): Promise<void> {
|
||||
async function init(ctx: DropsContext, mode: Boolean): Promise<void> {
|
||||
maintainer = ctx.SpareAccounts[0];
|
||||
user1 = ctx.SpareAccounts[1];
|
||||
user2 = ctx.SpareAccounts[2];
|
||||
@@ -44,11 +44,11 @@ async function init(ctx: DropsContext): Promise<void> {
|
||||
await ctx.DropsV2.methods.init(
|
||||
addrList,
|
||||
[curTime + 10, curTime + 20, curTime + 30],
|
||||
[10000000000000, 10000000000000, 10000000000000],
|
||||
[10000000000000, 10000000000000, 0],
|
||||
[10, 10, 0],
|
||||
curTime+10,
|
||||
true,
|
||||
false
|
||||
curTime + 10,
|
||||
false,
|
||||
mode
|
||||
).send(ctx.sendParam(ctx.Deployer));
|
||||
|
||||
}
|
||||
@@ -60,7 +60,7 @@ async function getTicketsInfo(ctx: DropsContext, user: string): Promise<[string,
|
||||
return [totalTickets, userTickets];
|
||||
}
|
||||
|
||||
async function getBuyTokenBalance(ctx: DropsContext, user: string, token: Contract): Promise<[string,string]> {
|
||||
async function getBuyTokenBalance(ctx: DropsContext, user: string, token: Contract): Promise<[string, string]> {
|
||||
var userDodo = await token.methods.balanceOf(user).call();
|
||||
var dropsDodo = await token.methods.balanceOf(ctx.DropsV2.options.address).call();
|
||||
console.log("User Dodo:" + userDodo + " Drops Dodo:" + dropsDodo);
|
||||
@@ -74,7 +74,6 @@ describe("DODODropsV2", () => {
|
||||
|
||||
before(async () => {
|
||||
ctx = await getDropsContext();
|
||||
await init(ctx);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -87,22 +86,47 @@ describe("DODODropsV2", () => {
|
||||
|
||||
describe("DODODropsV2", () => {
|
||||
it("buyTicket", async () => {
|
||||
// await ctx.EVM.increaseTime(10);
|
||||
// await logGas(await ctx.DropsProxy.methods.buyTickets(ctx.DropsV2.options.address,2), ctx.sendParam(user1), "buyTickets");
|
||||
// await logGas(await ctx.DropsProxy.methods.buyTickets(ctx.DropsV2.options.address,3), ctx.sendParam(user2), "buyTickets");
|
||||
await init(ctx, false);
|
||||
await ctx.EVM.increaseTime(10);
|
||||
await logGas(await ctx.DropsProxy.methods.buyTickets(ctx.DropsV2.options.address, 2), ctx.sendParam(user1), "buyTickets-user1");
|
||||
await logGas(await ctx.DropsProxy.methods.buyTickets(ctx.DropsV2.options.address, 3), ctx.sendParam(user2), "buyTickets-user2");
|
||||
|
||||
// await getTicketsInfo(ctx, user1)
|
||||
// await getTicketsInfo(ctx, user2)
|
||||
var [totalSupply,] = await getTicketsInfo(ctx, user1)
|
||||
assert(totalSupply, '5')
|
||||
|
||||
// await getBuyTokenBalance(ctx, user1, ctx.DODO)
|
||||
// await getBuyTokenBalance(ctx, user2, ctx.DODO)
|
||||
var [, dropsDodoBalance] = await getBuyTokenBalance(ctx, user1, ctx.DODO)
|
||||
assert(dropsDodoBalance, decimalStr('0.00005'))
|
||||
});
|
||||
|
||||
it("redeemPrize", async () => {
|
||||
|
||||
});
|
||||
|
||||
//Owner 设置
|
||||
|
||||
it.only("setProbMap", async () => {
|
||||
await init(ctx, true);
|
||||
var probIntervals = [4, 10, 50, 100, 105]
|
||||
var tokenIdMaps = [
|
||||
[0],
|
||||
[1, 38],
|
||||
[3, 4, 5],
|
||||
[6, 7],
|
||||
[19,30,35,40]
|
||||
]
|
||||
await logGas(await ctx.DropsV2.methods.setProbInfo(probIntervals, tokenIdMaps), ctx.sendParam(ctx.Deployer), "setProbInfo");
|
||||
var prob = await ctx.DropsV2.methods._PROB_INTERVAL_(0).call();
|
||||
assert(prob, '4')
|
||||
var tokenId = await ctx.DropsV2.methods._TOKEN_ID_MAP_(1, 1).call();
|
||||
assert(tokenId, '38')
|
||||
})
|
||||
|
||||
it.only("setTokenList", async () => {
|
||||
await init(ctx, false);
|
||||
var tokenList = [4, 10, 50, 100, 105]
|
||||
await logGas(await ctx.DropsV2.methods.setFixedAmountInfo(tokenList), ctx.sendParam(ctx.Deployer), "setFixedAmountInfo");
|
||||
var tokenId = await ctx.DropsV2.methods._TOKEN_ID_LIST_(1).call();
|
||||
assert(tokenId, '10')
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
@@ -68,7 +68,7 @@ fi
|
||||
|
||||
if [ "$1"x = "boxV2"x ]
|
||||
then
|
||||
truffle test ./test/DODODrops/dropsV2-fixedAmount.test.ts
|
||||
truffle test ./test/DODODrops/dropsV2.test.ts
|
||||
fi
|
||||
|
||||
# if [ "$1"x = "route-incentive"x ]
|
||||
|
||||
Reference in New Issue
Block a user