Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hvthhien committed Jun 12, 2024
1 parent 1b8902e commit 1e50e63
Showing 1 changed file with 57 additions and 57 deletions.
114 changes: 57 additions & 57 deletions test/feralfile_exhibition_v4_2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const FeralfileExhibitionV4_2 = artifacts.require("FeralfileExhibitionV4_2");
const FeralfileVault = artifacts.require("FeralfileVault");
const FeralfileVault = artifacts.require("FeralfileVaultV2");

const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
const COST_RECEIVER = "0x46f2B641d8702f29c45f6D06292dC34Eb9dB1801";
Expand Down Expand Up @@ -595,7 +595,7 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {
});

it("should buy bulk artworks successfully", async function () {
const contract = this.contract[3];
const contract = this.contracts[3];

// Mint artworks to the contract
const owner = contract.address;
Expand All @@ -609,26 +609,26 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {

// Generate signature
const expiryTime = (new Date().getTime() / 1000 + 300).toFixed(0);
const saleData = {
price: BigInt(0.25 * 1e18).toString(),
cost: BigInt(0.02 * 1e18).toString(),
const saleData = [
BigInt(0.25 * 1e18).toString(),
BigInt(0.02 * 1e18).toString(),
expiryTime,
destination: accounts[2],
nonce: 0,
seriesID: this.seriesIds[3],
quantity: 2,
revenueShares: [
{ recipient: accounts[3], bps: 8000 },
{ recipient: accounts[4], bps: 2000 }
accounts[2],
0,
this.seriesIds[3],
2,
[
[accounts[3], 8000],
[accounts[4], 2000],
],
payByVaultContract: false
};
false,
];

const signParams = web3.eth.abi.encodeParameters(
[
"uint",
"address",
"tuple(uint256,uint256,uint256,address,uint256,uint256,tuple(address,uint256)[],bool)",
"tuple(uint256,uint256,uint256,address,uint256,uint256,uint16,tuple(address,uint256)[],bool)",
],
[
BigInt(await web3.eth.getChainId()).toString(),
Expand Down Expand Up @@ -688,7 +688,7 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {
});

it("should fail to buy bulk artworks with invalid signature", async function () {
const contract = this.contract[10];
const contract = this.contracts[10];

// Mint artworks to the contract
const owner = contract.address;
Expand All @@ -702,26 +702,26 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {

// Generate signature
const expiryTime = (new Date().getTime() / 1000 + 300).toFixed(0);
const saleData = {
price: BigInt(0.25 * 1e18).toString(),
cost: BigInt(0.02 * 1e18).toString(),
const saleData = [
BigInt(0.25 * 1e18).toString(),
BigInt(0.02 * 1e18).toString(),
expiryTime,
destination: accounts[2],
nonce: 0,
seriesID: this.seriesIds[3],
quantity: 2,
revenueShares: [
{ recipient: accounts[3], bps: 8000 },
{ recipient: accounts[4], bps: 2000 }
accounts[2],
0,
this.seriesIds[3],
2,
[
[accounts[3], 8000],
[accounts[4], 2000],
],
payByVaultContract: false
};
false,
];

const signParams = web3.eth.abi.encodeParameters(
[
"uint",
"address",
"tuple(uint256,uint256,uint256,address,uint256,uint256,tuple(address,uint256)[],bool)",
"tuple(uint256,uint256,uint256,address,uint256,uint256,uint16,tuple(address,uint256)[],bool)",
],
[
BigInt(await web3.eth.getChainId()).toString(),
Expand Down Expand Up @@ -753,7 +753,7 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {
});

it("should fail to buy bulk artworks with incorrect payment", async function () {
const contract = this.contract[11];
const contract = this.contracts[11];

// Mint artworks to the contract
const owner = contract.address;
Expand All @@ -767,26 +767,26 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {

// Generate signature
const expiryTime = (new Date().getTime() / 1000 + 300).toFixed(0);
const saleData = {
price: BigInt(0.25 * 1e18).toString(),
cost: BigInt(0.02 * 1e18).toString(),
const saleData = [
BigInt(0.25 * 1e18).toString(),
BigInt(0.02 * 1e18).toString(),
expiryTime,
destination: accounts[2],
nonce: 0,
seriesID: this.seriesIds[3],
quantity: 2,
revenueShares: [
{ recipient: accounts[3], bps: 8000 },
{ recipient: accounts[4], bps: 2000 }
accounts[2],
0,
this.seriesIds[3],
2,
[
[accounts[3], 8000],
[accounts[4], 2000],
],
payByVaultContract: false
};
false,
];

const signParams = web3.eth.abi.encodeParameters(
[
"uint",
"address",
"tuple(uint256,uint256,uint256,address,uint256,uint256,tuple(address,uint256)[],bool)",
"tuple(uint256,uint256,uint256,address,uint256,uint256,uint16,tuple(address,uint256)[],bool)",
],
[
BigInt(await web3.eth.getChainId()).toString(),
Expand Down Expand Up @@ -818,7 +818,7 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {
});

it("should fail to buy bulk artworks with invalid series ID", async function () {
const contract = this.contract;
const contract = this.contracts[2];

// Mint artworks to the contract
const owner = contract.address;
Expand All @@ -832,26 +832,26 @@ contract("FeralfileExhibitionV4_2", async (accounts) => {

// Generate signature
const expiryTime = (new Date().getTime() / 1000 + 300).toFixed(0);
const saleData = {
price: BigInt(0.25 * 1e18).toString(),
cost: BigInt(0.02 * 1e18).toString(),
const saleData = [
BigInt(0.25 * 1e18).toString(),
BigInt(0.02 * 1e18).toString(),
expiryTime,
destination: accounts[2],
nonce: 0,
seriesID: 999999, // Invalid series ID
quantity: 2,
revenueShares: [
{ recipient: accounts[3], bps: 8000 },
{ recipient: accounts[4], bps: 2000 }
accounts[2],
0,
999999, // Invalid series ID
2,
[
[accounts[3], 8000],
[accounts[4], 2000],
],
payByVaultContract: false
};
false,
];

const signParams = web3.eth.abi.encodeParameters(
[
"uint",
"address",
"tuple(uint256,uint256,uint256,address,uint256,uint256,tuple(address,uint256)[],bool)",
"tuple(uint256,uint256,uint256,address,uint256,uint256,uint16,tuple(address,uint256)[],bool)",
],
[
BigInt(await web3.eth.getChainId()).toString(),
Expand Down

0 comments on commit 1e50e63

Please sign in to comment.