Skip to content

Commit

Permalink
fix: PriceData decoding in _execute method
Browse files Browse the repository at this point in the history
  • Loading branch information
rbajollari committed Nov 17, 2023
1 parent 1027d12 commit 3364222
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions contracts/Ojo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import "./OjoTypes.sol";
contract Ojo is IOjo, AxelarExecutable {
IAxelarGasService public immutable gasReceiver;

string private ojoChain;
string public ojoChain;

string private ojoAddress;
string public ojoAddress;

mapping(bytes32 => OjoTypes.PriceData) private priceData;
mapping(bytes32 => OjoTypes.PriceData) public priceData;

constructor(
address gateway_,
Expand Down Expand Up @@ -55,17 +55,16 @@ contract Ojo is IOjo, AxelarExecutable {
bytes calldata payload
) internal override {
(
bytes memory _encodedPriceData,
OjoTypes.PriceData[] memory _priceData,
bytes32[] memory assetNames,
address contractAddress,
bytes4 commandSelector,
bytes memory commandParams
) = abi.decode(
payload,
(bytes, bytes32[], address, bytes4, bytes)
(OjoTypes.PriceData[], bytes32[], address, bytes4, bytes)
);

OjoTypes.PriceData[] memory _priceData = abi.decode(_encodedPriceData, (OjoTypes.PriceData[]));
postPriceData(_priceData);

// Call contract only if command selector is non empty
Expand Down
2 changes: 1 addition & 1 deletion test/Ojo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("Deploy OjoContract", function () {
const ojoChain = "ojoChain"
const ojoAddress = "ojoAddress"

const mockGatewayArtifact = require("/Users/ryanbajollari/ojo-evm/artifacts/contracts/test-util/MockGateway.sol/MockAxelarGateway.json");
const mockGatewayArtifact = require("~/ojo-evm/artifacts/contracts/test-util/MockGateway.sol/MockAxelarGateway.json");

const MockGateway = await ethers.getContractFactory(mockGatewayArtifact.abi, mockGatewayArtifact.bytecode);
const mockGateway = await MockGateway.deploy(authModule.address, tokenDeployer.address)
Expand Down

0 comments on commit 3364222

Please sign in to comment.