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 d875e32
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 115 deletions.
16 changes: 8 additions & 8 deletions test/feralfile_exhibition_v4_1.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ contract("FeralfileExhibitionV4_1", async (accounts) => {
sig = sig.substr(2);
const r = "0x" + sig.slice(0, 64);
const s = "0x" + sig.slice(64, 128);
const v = "0x" + sig.slice(128, 130);
const v = web3.utils.toDecimal("0x" + sig.slice(128, 130));
// Generate signature

try {
Expand All @@ -353,7 +353,7 @@ contract("FeralfileExhibitionV4_1", async (accounts) => {
await contract.buyArtworks(
r,
s,
web3.utils.toDecimal(v) + 27, // magic 27
v < 2 ? v + 27 : v, // magic 27
[
BigInt(0.25 * 1e18).toString(),
BigInt(0.02 * 1e18).toString(),
Expand Down Expand Up @@ -489,7 +489,7 @@ contract("FeralfileExhibitionV4_1", async (accounts) => {
sig = sig.substr(2);
const r = "0x" + sig.slice(0, 64);
const s = "0x" + sig.slice(64, 128);
const v = "0x" + sig.slice(128, 130);
const v = web3.utils.toDecimal("0x" + sig.slice(128, 130));
// Generate signature
try {
const acc3BalanceBefore = await web3.eth.getBalance(accounts[3]);
Expand All @@ -505,7 +505,7 @@ contract("FeralfileExhibitionV4_1", async (accounts) => {
await contract.buyArtworks(
r,
s,
web3.utils.toDecimal(v) + 27, // magic 27
v < 2 ? v + 27 : v, // magic 27
[
BigInt(0.22 * 1e18).toString(),
BigInt(0.02 * 1e18).toString(),
Expand Down Expand Up @@ -644,15 +644,15 @@ contract("FeralfileExhibitionV4_1", async (accounts) => {
sig = sig.substr(2);
const r = "0x" + sig.slice(0, 64);
const s = "0x" + sig.slice(64, 128);
const v = "0x" + sig.slice(128, 130);
const v = web3.utils.toDecimal("0x" + sig.slice(128, 130));
// Generate signature

try {
await contract.startSale();
await contract.buyArtworks(
r,
s,
web3.utils.toDecimal(v) + 27, // magic 27
v < 2 ? v + 27 : v, // magic 27
[
BigInt(0.25 * 1e18).toString(),
BigInt(0.02 * 1e18).toString(),
Expand Down Expand Up @@ -1093,7 +1093,7 @@ contract("FeralfileExhibitionV4_1", async (accounts) => {
sig = sig.substr(2);
const r = "0x" + sig.slice(0, 64);
const s = "0x" + sig.slice(64, 128);
const v = "0x" + sig.slice(128, 130);
const v = web3.utils.toDecimal("0x" + sig.slice(128, 130));

try {
const acc3BalanceBefore = await web3.eth.getBalance(accounts[3]);
Expand All @@ -1107,7 +1107,7 @@ contract("FeralfileExhibitionV4_1", async (accounts) => {
await contract.buyArtworks(
r,
s,
web3.utils.toDecimal(v) + 27, // magic 27
v < 2 ? v + 27 : v, // magic 27
[
web3.utils.toWei("1", "ether"),
"0",
Expand Down
Loading

0 comments on commit d875e32

Please sign in to comment.