Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
lidangzzz committed May 11, 2023
1 parent 2027d8f commit bf703ba
Showing 1 changed file with 47 additions and 18 deletions.
65 changes: 47 additions & 18 deletions darc-protocol/test/operationUnitTest/batch_mint_token_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ describe.only("batch_mint_token_test", function () {


const programOperatorAddress = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266";

// batch mint token to another addresses
const addr1 = "0x90F79bf6EB2c4f870365E785982E1f101E93b906";
const addr2 = '0x976EA74026E726554dB657fA54763abd0C3a0aa9';
const addr3 = '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199';

// create a token class first
await darc.entrance({
Expand Down Expand Up @@ -60,11 +63,11 @@ describe.only("batch_mint_token_test", function () {
PARAMETER_ARRAY: [],
PLUGIN_ARRAY: [],
UINT256_2DARRAY: [
[BigNumber.from(0), BigNumber.from(1), BigNumber.from(0), BigInt(0)], // token class = 0
[BigNumber.from(100), BigNumber.from(200), BigNumber.from(300), BigInt(16)], // amount = 100
[BigNumber.from(0), BigNumber.from(1), BigNumber.from(0), BigInt(0), BigInt(1)], // token class = 0
[BigNumber.from(100), BigNumber.from(200), BigNumber.from(300), BigInt(16), BigInt(5)], // amount = 100
],
ADDRESS_2DARRAY: [
[programOperatorAddress,programOperatorAddress, programOperatorAddress, programOperatorAddress], // to = programOperatorAddress
[programOperatorAddress,programOperatorAddress, programOperatorAddress, addr1, addr2], // to = programOperatorAddress
]
}
}],
Expand All @@ -74,18 +77,42 @@ describe.only("batch_mint_token_test", function () {
const balance0 = await darc.getTokenOwnerBalance(0, programOperatorAddress);
const balance1 = await darc.getTokenOwnerBalance(1, programOperatorAddress);

expect(balance0.toBigInt().toString()).to.equal("416");
expect(balance1.toBigInt().toString()).to.equal("200");
expect(await darc.getTokenOwners(0)).to.have.lengthOf(1);
expect(await darc.getTokenOwners(1)).to.have.lengthOf(1);


// batch mint token to another addresses
const addr1 = "0x90F79bf6EB2c4f870365E785982E1f101E93b906";
const addr2 = '0x976EA74026E726554dB657fA54763abd0C3a0aa9';
const addr3 = '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199';

const result_entrance2 = darc.entrance({
console.log("Token owner list of token 0 after op: ");
console.log(await darc.getTokenOwners(0));
console.log("Token owner list of token 1 after op: ");
console.log(await darc.getTokenOwners(1));
// expect(balance0.toBigInt().toString()).to.equal("400");
// expect(balance1.toBigInt().toString()).to.equal("200");
// expect(await darc.getTokenOwners(0)).to.have.lengthOf(1);
// expect(await darc.getTokenOwners(1)).to.have.lengthOf(1);
console.log(JSON.stringify(result_entrance));

// const result_entrance2 = darc.entrance({
// programOperatorAddress: programOperatorAddress,
// operations: [{
// operatorAddress: programOperatorAddress,
// opcode: 1, // mint token
// param: {
// UINT256_ARRAY: [],
// ADDRESS_ARRAY: [],
// STRING_ARRAY: [],
// BOOL_ARRAY: [],
// VOTING_RULE_ARRAY: [],
// PARAMETER_ARRAY: [],
// PLUGIN_ARRAY: [],
// UINT256_2DARRAY: [
// [BigNumber.from(0), BigNumber.from(0), BigNumber.from(0), BigNumber.from(0)], // token class = 0
// [BigNumber.from(100), BigNumber.from(200), BigNumber.from(300), BigNumber.from(16)], // amount = 100
// ],
// ADDRESS_2DARRAY: [
// [addr3,addr3, addr3, addr3], // to = programOperatorAddress
// ]
// }
// }],
// });

const result_entrance2 = await darc.entrance({
programOperatorAddress: programOperatorAddress,
operations: [{
operatorAddress: programOperatorAddress,
Expand All @@ -99,11 +126,11 @@ describe.only("batch_mint_token_test", function () {
PARAMETER_ARRAY: [],
PLUGIN_ARRAY: [],
UINT256_2DARRAY: [
[BigNumber.from(0), BigNumber.from(0), BigNumber.from(0), BigNumber.from(0)], // token class = 0
[BigNumber.from(100), BigNumber.from(200), BigNumber.from(300), BigNumber.from(16)], // amount = 100
[BigNumber.from(0), BigNumber.from(1), BigNumber.from(0), BigInt(0), BigInt(1)], // token class = 0
[BigNumber.from(100), BigNumber.from(200), BigNumber.from(300), BigInt(16), BigInt(5)], // amount = 100
],
ADDRESS_2DARRAY: [
[addr1,addr2, addr3, programOperatorAddress], // to = programOperatorAddress
[programOperatorAddress,programOperatorAddress, programOperatorAddress, addr1, addr1], // to = programOperatorAddress
]
}
}],
Expand All @@ -113,5 +140,7 @@ describe.only("batch_mint_token_test", function () {
console.log(await darc.getTokenOwners(0));
console.log("Token owner list of token 1 after op: ");
console.log(await darc.getTokenOwners(1));

console.log(JSON.stringify(result_entrance2));
});
});

0 comments on commit bf703ba

Please sign in to comment.