From 1d2a6a97197901ce1fae3ee56802d176c8da2ecc Mon Sep 17 00:00:00 2001 From: Maxence Raballand Date: Tue, 14 May 2024 15:36:49 +0200 Subject: [PATCH] fix: params invalid abi type --- .changeset/young-boxes-visit.md | 5 +++++ src/builder/kandel/populate.ts | 2 ++ src/builder/kandel/view.ts | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/young-boxes-visit.md diff --git a/.changeset/young-boxes-visit.md b/.changeset/young-boxes-visit.md new file mode 100644 index 0000000..8874e6d --- /dev/null +++ b/.changeset/young-boxes-visit.md @@ -0,0 +1,5 @@ +--- +"@mangrovedao/mgv": patch +--- + +Fixed Params not valid ABI type diff --git a/src/builder/kandel/populate.ts b/src/builder/kandel/populate.ts index ef0ea9c..c4e30a3 100644 --- a/src/builder/kandel/populate.ts +++ b/src/builder/kandel/populate.ts @@ -1,6 +1,8 @@ import { type ContractFunctionParameters, parseAbi } from 'viem' +import { paramsStruct } from './view.js' export const populateABI = parseAbi([ + paramsStruct, 'function populateFromOffset(uint from, uint to, int baseQuoteTickIndex0, uint _baseQuoteTickOffset, uint firstAskIndex, uint bidGives, uint askGives, Params calldata parameters, uint baseAmount, uint quoteAmount) public payable', 'function populateChunkFromOffset(uint from, uint to, int baseQuoteTickIndex0, uint firstAskIndex, uint bidGives, uint askGives) public payable', ]) diff --git a/src/builder/kandel/view.ts b/src/builder/kandel/view.ts index 768de25..c85f71b 100644 --- a/src/builder/kandel/view.ts +++ b/src/builder/kandel/view.ts @@ -1,10 +1,13 @@ import { type ContractFunctionParameters, parseAbi } from 'viem' import { BA } from '../../lib/enums.js' +export const paramsStruct = + 'struct Params { uint32 gasprice; uint24 gasreq; uint32 stepSize; uint32 pricePoints; }' as const + // ba: 0 is bid, 1 is ask export const viewKandelABI = parseAbi([ + paramsStruct, 'function baseQuoteTickOffset() public view returns (uint)', - 'struct Params { uint32 gasprice; uint24 gasreq; uint32 stepSize; uint32 pricePoints; }', 'function params() public view returns (Params memory)', 'function offeredVolume(uint8 ba) public view returns (uint volume)', 'function getOffer(uint8 ba, uint index) public view returns (uint offer)',