Skip to content

Commit

Permalink
Continue review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anajuliabit committed Aug 3, 2023
1 parent 8b66743 commit 7b31d24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions contracts/protocol/facets/ExchangeHandlerFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,6 @@ contract ExchangeHandlerFacet is IBosonExchangeHandler, BuyerBase, DisputeBase {
// Token transfer order is descending
tokenId += twin.supplyAvailable;
}

// ERC-721 style transfer
data = abi.encodeWithSignature(
"safeTransferFrom(address,address,uint256,bytes)",
Expand All @@ -861,7 +860,6 @@ contract ExchangeHandlerFacet is IBosonExchangeHandler, BuyerBase, DisputeBase {
""
);
}

// Make call only if there is enough gas and code at address exists.
// If not, skip the call and mark the transfer as failed
if (gasleft() > reservedGas && twin.tokenAddress.isContract()) {
Expand Down
14 changes: 8 additions & 6 deletions test/util/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ async function populateProtocolContract(
.filter((o) => seller.offerIds.includes(Number(o.id)))
.reduce((acc, o) => acc + Number(o.quantityAvailable), 0);

for (let j = 0; j < 7; j++) {
for (let j = 0; j < 3; j++) {
twin721.tokenId = `${sellerId * 1000000 + j * 100000}`;
twin721.supplyAvailable = minSupplyAvailable;
twin721.tokenAddress = await mockTwinTokens[j % 2].getAddress(); // oscilate between twins
Expand All @@ -600,6 +600,7 @@ async function populateProtocolContract(

// fungible
const twin20 = mockTwin(await mockTwin20.getAddress(), TokenType.FungibleToken);
twin20.id = twinId;

twin20.id = twinId;
twin20.amount = sellerId;
Expand All @@ -617,6 +618,7 @@ async function populateProtocolContract(

// multitoken twin
const twin1155 = mockTwin(await mockTwin1155.getAddress(), TokenType.MultiToken);
twin1155.id = twinId;

await mockTwin1155.connect(seller.wallet).setApprovalForAll(protocolDiamondAddress, true);
for (let j = 0; j < 3; j++) {
Expand Down Expand Up @@ -672,6 +674,8 @@ async function populateProtocolContract(
.connect(buyerWallet)
.commitToConditionalOffer(await buyerWallet.getAddress(), offer.id, condition.tokenId, { value: msgValue });
} else {
// log bundle

await exchangeHandler
.connect(buyerWallet)
.commitToOffer(await buyerWallet.getAddress(), offer.id, { value: msgValue });
Expand All @@ -685,7 +689,9 @@ async function populateProtocolContract(
// redeem some vouchers #4
for (const id of [2, 5, 11, 8]) {
const exchange = exchanges[id - 1];
await exchangeHandler.connect(buyers[exchange.buyerIndex].wallet).redeemVoucher(exchange.exchangeId);
await exchangeHandler
.connect(buyers[exchange.buyerIndex].wallet)
.redeemVoucher(exchange.exchangeId, { gasLimit: 10000000 });
}

// cancel some vouchers #3
Expand All @@ -706,9 +712,6 @@ async function populateProtocolContract(
const id = 5; // must be one of redeemed ones
const exchange = exchanges[id - 1];

const [, response] = await exchangeHandler.getExchangeState(exchange.exchangeId);
console.log("exchangId", exchange.exchangeId);
console.log("Exchange state after dispute raised", response);
await disputeHandler.connect(buyers[exchange.buyerIndex].wallet).raiseDispute(exchange.exchangeId);

return { DRs, sellers, buyers, agents, offers, exchanges, bundles, groups, twins };
Expand Down Expand Up @@ -800,7 +803,6 @@ async function getAccountContractState(accountHandler, { DRs, sellers, buyers, a
let nextAccountId;
let sellersCollections = [];

console.log("Getting account contract state");
// Query even the ids where it's not expected to get the entity
for (const account of accounts) {
const id = account.id;
Expand Down

0 comments on commit 7b31d24

Please sign in to comment.