Skip to content

Commit

Permalink
bug fixes on offchain service
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtiki committed Aug 22, 2024
1 parent 5072ff0 commit 646dc7e
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 272 deletions.
13 changes: 10 additions & 3 deletions packages/hardhat/contracts/L1FloxiSfrxEth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,24 @@ contract L1FloxiSfrxEth is ReentrancyGuard, Ownable {
_remoteContract,
_reservedAssets
);

require(updateTotalAssetsL2() == true, "Failed to update L2 assets");
}

function updateTotalAssetsL2() external {
function updateTotalAssetsL2() internal returns (bool) {
bytes memory message = abi.encodeWithSignature("updateL1Assets(uint256)", totalAssets());

// Send the message to L2 via the Cross Domain Messenger
ICrossDomainMessenger(_l1CrossDomainMessenger).sendMessage(
try ICrossDomainMessenger(_l1CrossDomainMessenger).sendMessage(
_remoteContract, // Address of the L2 contract to call
message, // Encoded message data
2000000 // Gas limit for the message execution on L2
);
) {
return true;
}
catch {
revert("Failed to send xDomain message");
}
}

// for POC only
Expand Down
2 changes: 1 addition & 1 deletion packages/offchain-service/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const getMainnetWalletClient = (env: string) => {
} else {
return createWalletClient({
chain: holesky,
transport: http(`https://eth-holesky.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`),
transport: http(`https://holesky.drpc.org`),
});
}
};
Loading

0 comments on commit 646dc7e

Please sign in to comment.