Skip to content

Commit

Permalink
Remove explicit extra return values
Browse files Browse the repository at this point in the history
  • Loading branch information
zajck committed Apr 20, 2023
1 parent 6e03be1 commit ae3226f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion test/protocol/ExchangeHandlerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe("IBosonExchangeHandler", function () {
protocolConfig: [, , { percentage: protocolFeePercentage }],
extraReturnValues: { bosonVoucher, voucherImplementation, accessController },
diamondAddress: protocolDiamondAddress,
} = await setupTestEnvironment(contracts, { returnClient: true, returnAccessController: true }));
} = await setupTestEnvironment(contracts));

[deployer] = await ethers.getSigners();

Expand Down
2 changes: 1 addition & 1 deletion test/protocol/FundsHandlerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe("IBosonFundsHandler", function () {
protocolConfig: [, , { percentage: protocolFeePercentage, buyerEscalationDepositPercentage }],
diamondAddress: protocolDiamondAddress,
extraReturnValues: { accessController },
} = await setupTestEnvironment(contracts, { returnAccessController: true }));
} = await setupTestEnvironment(contracts));

// make all account the same
assistant = clerk = admin;
Expand Down
2 changes: 1 addition & 1 deletion test/protocol/MetaTransactionsHandlerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe("IBosonMetaTransactionsHandler", function () {
},
extraReturnValues: { accessController },
diamondAddress: protocolDiamondAddress,
} = await setupTestEnvironment(contracts, { returnAccessController: true }));
} = await setupTestEnvironment(contracts));

// make all account the same
assistant = clerk = admin;
Expand Down
2 changes: 0 additions & 2 deletions test/protocol/clients/BosonVoucherTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ describe("IBosonVoucher", function () {
extraReturnValues: { bosonVoucher, beacon, accessController },
} = await setupTestEnvironment(contracts, {
forwarderAddress: [forwarder.address],
returnClient: true,
returnAccessController: true,
}));

// make all account the same
Expand Down
2 changes: 1 addition & 1 deletion test/protocol/clients/ClientExternalAddressesTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("IClientExternalAddresses", function () {
signers: [rando, other1, other3],
diamondAddress: protocolDiamondAddress,
extraReturnValues: { beacon },
} = await setupTestEnvironment(contracts, { returnClient: true }));
} = await setupTestEnvironment(contracts));

[deployer] = await ethers.getSigners();

Expand Down
16 changes: 5 additions & 11 deletions test/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,7 @@ function objectToArray(input) {
return result;
}

async function setupTestEnvironment(
contracts,
{ returnClient = false, returnAccessController = false, bosonTokenAddress, forwarderAddress } = {}
) {
async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAddress } = {}) {
const facetNames = [
"SellerHandlerFacet",
"BuyerHandlerFacet",
Expand Down Expand Up @@ -321,7 +318,7 @@ async function setupTestEnvironment(

// Deploy the Protocol Diamond
const [protocolDiamond, , , , accessController] = await deployProtocolDiamond(maxPriorityFeePerGas);
if (returnAccessController) extraReturnValues = { ...extraReturnValues, accessController };
extraReturnValues["accessController"] = accessController;

// Temporarily grant UPGRADER role to deployer account
await accessController.grantRole(Role.UPGRADER, deployer.address);
Expand All @@ -341,12 +338,9 @@ async function setupTestEnvironment(
);
const [beacon] = beacons;
const [proxy] = proxies;

if (returnClient) {
const [bosonVoucher] = clients;
const [voucherImplementation] = implementations;
extraReturnValues = { ...extraReturnValues, bosonVoucher, voucherImplementation, beacon };
}
const [bosonVoucher] = clients;
const [voucherImplementation] = implementations;
extraReturnValues = { ...extraReturnValues, bosonVoucher, voucherImplementation, beacon };

// set protocolFees
const protocolFeePercentage = "200"; // 2 %
Expand Down

0 comments on commit ae3226f

Please sign in to comment.