diff --git a/contracts/Ojo.sol b/contracts/Ojo.sol index f76a0d1..9c4c962 100644 --- a/contracts/Ojo.sol +++ b/contracts/Ojo.sol @@ -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}( diff --git a/contracts/OjoTypes.sol b/contracts/OjoTypes.sol index bf0f0f6..86e189b 100644 --- a/contracts/OjoTypes.sol +++ b/contracts/OjoTypes.sol @@ -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; + } }