From 3364222ecf21e91e5e5f722bef1c571379452503 Mon Sep 17 00:00:00 2001 From: rbajollari Date: Fri, 17 Nov 2023 09:49:55 -0500 Subject: [PATCH] fix: PriceData decoding in _execute method --- contracts/Ojo.sol | 11 +++++------ test/Ojo.ts | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/contracts/Ojo.sol b/contracts/Ojo.sol index d417c09..ea2ff72 100644 --- a/contracts/Ojo.sol +++ b/contracts/Ojo.sol @@ -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_, @@ -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 diff --git a/test/Ojo.ts b/test/Ojo.ts index d882284..3d9eab1 100644 --- a/test/Ojo.ts +++ b/test/Ojo.ts @@ -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)