Skip to content

Commit

Permalink
Merge pull request #37 from mangrovedao/fix/params
Browse files Browse the repository at this point in the history
fix: params invalid abi type
  • Loading branch information
maxencerb authored May 14, 2024
2 parents fbf34be + 1d2a6a9 commit 05efc6d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/young-boxes-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@mangrovedao/mgv": patch
---

Fixed Params not valid ABI type
2 changes: 2 additions & 0 deletions src/builder/kandel/populate.ts
Original file line number Diff line number Diff line change
@@ -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',
])
Expand Down
5 changes: 4 additions & 1 deletion src/builder/kandel/view.ts
Original file line number Diff line number Diff line change
@@ -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)',
Expand Down

0 comments on commit 05efc6d

Please sign in to comment.