Skip to content

Commit

Permalink
refactor: use Eid from json in mock
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMustermann2 committed Oct 14, 2024
1 parent d58883e commit c583763
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions script/18_SimulateReceive.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ contract SimulateReceive is Script, StdCheats {

using stdJson for string;

function setUp() public {
// always monkey-patch a precompile, since with LZ we need them
// TODO: AssetsMock may still complain about a few things.
deployCodeTo("AssetsMock.sol", abi.encode(uint16(40_161)), ASSETS_PRECOMPILE_ADDRESS);
deployCodeTo("DelegationMock.sol", DELEGATION_PRECOMPILE_ADDRESS);
}

function run() public {
// https://scan-testnet.layerzero-api.com/v1/messages/tx/<hash>
string memory json = vm.readFile("./scanApiResponse.json");
uint32 srcEid = uint32(json.readUint(".data[0].pathway.srcEid"));
require(srcEid != 0, "srcEid should not be empty");
// always monkey-patch a precompile, since with LZ we need them
// TODO: AssetsMock may still complain about a few things.
deployCodeTo("AssetsMock.sol", abi.encode(uint16(srcEid)), ASSETS_PRECOMPILE_ADDRESS);
deployCodeTo("DelegationMock.sol", DELEGATION_PRECOMPILE_ADDRESS);
address senderAddress = json.readAddress(".data[0].pathway.sender.address");
require(senderAddress != address(0), "senderAddress should not be empty");
uint64 nonce = uint64(json.readUint(".data[0].pathway.nonce"));
Expand Down

0 comments on commit c583763

Please sign in to comment.