Skip to content

Commit

Permalink
retractParams: rename from and to args
Browse files Browse the repository at this point in the history
Signed-off-by: belbazanas <[email protected]>
  • Loading branch information
anasbelbaz committed Jun 19, 2024
1 parent 5ea3e27 commit 16d14ae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-candles-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@mangrovedao/mgv": patch
---

rename retractParams (from,to) args
38 changes: 19 additions & 19 deletions src/builder/kandel/retract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,41 @@ import {
type ContractFunctionParameters,
maxUint256,
parseAbi,
} from 'viem'
} from "viem";

export const restractKandelABI = parseAbi([
'function retractAndWithdraw(uint from, uint to, uint baseAmount, uint quoteAmount, uint freeWei, address recipient) external',
])
"function retractAndWithdraw(uint from, uint to, uint baseAmount, uint quoteAmount, uint freeWei, address recipient) external",
]);

export type RetractParams = {
from?: bigint | undefined
to: bigint
baseAmount?: bigint | undefined
quoteAmount?: bigint | undefined
freeWei?: bigint | undefined
recipient: Address
}
fromIndex?: bigint | undefined;
toIndex: bigint;
baseAmount?: bigint | undefined;
quoteAmount?: bigint | undefined;
freeWei?: bigint | undefined;
recipient: Address;
};

export function retractParams(params: RetractParams) {
const {
from = 0n,
to,
fromIndex = 0n,
toIndex,
baseAmount = 0n,
quoteAmount = 0n,
freeWei = maxUint256,
recipient,
} = params
} = params;

return {
abi: restractKandelABI,
functionName: 'retractAndWithdraw',
args: [from, to, baseAmount, quoteAmount, freeWei, recipient],
functionName: "retractAndWithdraw",
args: [fromIndex, toIndex, baseAmount, quoteAmount, freeWei, recipient],
} satisfies Omit<
ContractFunctionParameters<
typeof restractKandelABI,
'nonpayable',
'retractAndWithdraw'
"nonpayable",
"retractAndWithdraw"
>,
'address'
>
"address"
>;
}

0 comments on commit 16d14ae

Please sign in to comment.