Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: encode abi data #7

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update encodedata fn
adamewozniak committed Nov 13, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 56f168a6b6747c241681a21c90e1a198f4caf7fc
14 changes: 9 additions & 5 deletions contracts/Ojo.sol
Original file line number Diff line number Diff line change
@@ -33,13 +33,17 @@ contract Ojo is IOjo, AxelarExecutable {
bytes4 commandSelector,
bytes calldata commandParams
) external payable {
OjoTypes.EncodedData memory packet = OjoTypes.EncodedData({
assetNames: assetNames,
contractAddress: contractAddress,
commandSelector: commandSelector,
commandParams: commandParams,
timestamp: block.timestamp
});

bytes memory payloadWithVersion = abi.encodePacked(
bytes4(uint32(0)), // version number
assetNames,
contractAddress,
commandSelector,
commandParams,
block.timestamp // used for resolve time
abi.encode(packet) // payload
);

gasReceiver.payNativeGasForContractCall{value: msg.value}(
13 changes: 13 additions & 0 deletions contracts/OjoTypes.sol
Original file line number Diff line number Diff line change
@@ -33,4 +33,17 @@ library OjoTypes {
// Quote asset of asset pair
uint256 quoteResolveTime;
}

struct EncodedData {
// Assets that you would like to encode & relay
bytes32[] assetNames;
// Address for the contract to call later
address contractAddress;
// Command selector
bytes4 commandSelector;
// Params to send back to the execute contract
bytes commandParams;
// Block timestamp
uint256 timestamp;
}
}