Skip to content

Commit

Permalink
👨🏾‍🔧🔨Updating Test Helper (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirarthurmoney authored Jan 25, 2024
1 parent 4718fed commit a48befd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/plenty-days-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@layerzerolabs/test-devtools-evm-foundry": patch
---

Updating Test Helper to include setDstConfig for dvns
12 changes: 11 additions & 1 deletion tests/test-devtools-evm-foundry/contracts/TestHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { DoubleEndedQueue } from "@openzeppelin/contracts/utils/structs/DoubleEn
import { UlnConfig, SetDefaultUlnConfigParam } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/UlnBase.sol";
import { SetDefaultExecutorConfigParam, ExecutorConfig } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/SendLibBase.sol";
import { ReceiveUln302 } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/uln302/ReceiveUln302.sol";
import { IDVN } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/interfaces/IDVN.sol";
import { DVN, ExecuteParam } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/dvn/DVN.sol";
import { DVNFeeLib } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/dvn/DVNFeeLib.sol";
import { IExecutor } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/IExecutor.sol";
Expand Down Expand Up @@ -137,9 +138,9 @@ contract TestHelper is Test, OptionsHelper {
dvn.setWorkerFeeLib(address(dvnLib));
}

//todo: setDstGas
uint32 endpointNum = _endpointNum;
IExecutor.DstConfigParam[] memory dstConfigParams = new IExecutor.DstConfigParam[](endpointNum);
IDVN.DstConfigParam[] memory dvnConfigParams = new IDVN.DstConfigParam[](endpointNum);
for (uint8 j = 0; j < endpointNum; j++) {
if (i == j) continue;
uint32 dstEid = j + 1;
Expand Down Expand Up @@ -192,6 +193,14 @@ contract TestHelper is Test, OptionsHelper {
nativeCap: executorValueCap
});

// dvn config
dvnConfigParams[j] = IDVN.DstConfigParam({
dstEid: dstEid,
gas: 5000,
multiplierBps: 10000,
floorMarginUSD: 1e10
});

uint128 denominator = priceFeed.getPriceRatioDenominator();
ILayerZeroPriceFeed.UpdatePrice[] memory prices = new ILayerZeroPriceFeed.UpdatePrice[](1);
prices[0] = ILayerZeroPriceFeed.UpdatePrice(
Expand All @@ -201,6 +210,7 @@ contract TestHelper is Test, OptionsHelper {
priceFeed.setPrice(prices);
}
executor.setDstConfig(dstConfigParams);
dvn.setDstConfig(dvnConfigParams);
} else if (_libraryType == LibraryType.SimpleMessageLib) {
SimpleMessageLibMock messageLib = new SimpleMessageLibMock(payable(this), address(endpointList[i]));
endpointList[i].registerLibrary(address(messageLib));
Expand Down

0 comments on commit a48befd

Please sign in to comment.