From 84614ebeaf8d2a924e54393585a9e02c9c4dd91d Mon Sep 17 00:00:00 2001 From: Gas One Cent <86567384+gas1cent@users.noreply.github.com> Date: Mon, 6 Nov 2023 19:30:46 +0400 Subject: [PATCH] feat: add helpers for computing ids --- solidity/test/utils/Helpers.sol | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/solidity/test/utils/Helpers.sol b/solidity/test/utils/Helpers.sol index 5d7691cf..af32e439 100644 --- a/solidity/test/utils/Helpers.sol +++ b/solidity/test/utils/Helpers.sol @@ -51,4 +51,16 @@ contract Helpers is DSTestPlus { _accountingExtension.deposit(_token, _depositAmount); vm.stopPrank(); } + + function _getId(IOracle.Response memory _response) internal pure returns (bytes32 _id) { + _id = keccak256(abi.encode(_response)); + } + + function _getId(IOracle.Request memory _request) internal pure returns (bytes32 _id) { + _id = keccak256(abi.encode(_request)); + } + + function _getId(IOracle.Dispute memory _dispute) internal pure returns (bytes32 _id) { + _id = keccak256(abi.encode(_dispute)); + } }