From 8ef28f66dd5fc8b0e323be644ba9e9b296f16b1e Mon Sep 17 00:00:00 2001 From: eli-d <64763513+eli-d@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:06:24 +1030 Subject: [PATCH] correctly wrap leo `collect` return type with tuple --- pkg/sol/ILeo.sol | 8 +- web/src/config/abi/ILeo.ts | 301 +++++++++++++++++++++++++++++-------- 2 files changed, 245 insertions(+), 64 deletions(-) diff --git a/pkg/sol/ILeo.sol b/pkg/sol/ILeo.sol index 27739954..640a739a 100644 --- a/pkg/sol/ILeo.sol +++ b/pkg/sol/ILeo.sol @@ -105,6 +105,11 @@ interface ILeo is ILeoEvents { uint256 rewards; } + struct CollectRewards { + PoolRewards[] poolRewards; + CampaignRewards[] campaignRewards; + } + /// @notice collect rewards for a position vested in a pool with the campaigns given /// @param positionDetails to check /// @param campaignIds to check @@ -112,8 +117,7 @@ interface ILeo is ILeoEvents { PositionDetails[] memory positionDetails, bytes8[] memory campaignIds ) external returns ( - PoolRewards[] memory poolRewards, - CampaignRewards[] memory campaignRewards + CollectRewards memory collectRewards ); /// @notice divest a position, returning the position ID to the user diff --git a/web/src/config/abi/ILeo.ts b/web/src/config/abi/ILeo.ts index 6ae75abf..037c299e 100644 --- a/web/src/config/abi/ILeo.ts +++ b/web/src/config/abi/ILeo.ts @@ -3,16 +3,48 @@ export const ILeo = [ type: "function", name: "campaignDetails", inputs: [ - { name: "pool", type: "address", internalType: "address" }, - { name: "campaignId", type: "bytes8", internalType: "bytes8" }, + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "campaignId", + type: "bytes8", + internalType: "bytes8", + }, ], outputs: [ - { name: "tickLower", type: "int32", internalType: "int32" }, - { name: "tickUpper", type: "int32", internalType: "int32" }, - { name: "perSecond", type: "uint64", internalType: "uint64" }, - { name: "token", type: "address", internalType: "address" }, - { name: "distributed", type: "uint256", internalType: "uint256" }, - { name: "maximum", type: "uint256", internalType: "uint256" }, + { + name: "tickLower", + type: "int32", + internalType: "int32", + }, + { + name: "tickUpper", + type: "int32", + internalType: "int32", + }, + { + name: "perSecond", + type: "uint64", + internalType: "uint64", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "distributed", + type: "uint256", + internalType: "uint256", + }, + { + name: "maximum", + type: "uint256", + internalType: "uint256", + }, { name: "startingTimestamp", type: "uint64", @@ -30,18 +62,40 @@ export const ILeo = [ type: "function", name: "campaignRevisions", inputs: [ - { name: "pool", type: "address", internalType: "address" }, - { name: "campaignId", type: "bytes8", internalType: "bytes8" }, + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "campaignId", + type: "bytes8", + internalType: "bytes8", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, ], - outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view", }, { type: "function", name: "cancelCampaign", inputs: [ - { name: "pool", type: "address", internalType: "address" }, - { name: "campaignId", type: "bytes8", internalType: "bytes8" }, + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "campaignId", + type: "bytes8", + internalType: "bytes8", + }, ], outputs: [], stateMutability: "nonpayable", @@ -55,8 +109,16 @@ export const ILeo = [ type: "tuple[]", internalType: "struct ILeo.PositionDetails[]", components: [ - { name: "token", type: "address", internalType: "address" }, - { name: "id", type: "uint256", internalType: "uint256" }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "id", + type: "uint256", + internalType: "uint256", + }, ], }, { @@ -67,36 +129,51 @@ export const ILeo = [ ], outputs: [ { - name: "poolRewards", - type: "tuple[]", - internalType: "struct ILeo.PoolRewards[]", + name: "bababa", + type: "tuple", + internalType: "struct ILeo.blah", components: [ - { name: "pool", type: "address", internalType: "address" }, { - name: "amount0Lp", - type: "uint128", - internalType: "uint128", + name: "p", + type: "tuple[]", + internalType: "struct ILeo.PoolRewards[]", + components: [ + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "amount0Lp", + type: "uint128", + internalType: "uint128", + }, + { + name: "amount1Lp", + type: "uint128", + internalType: "uint128", + }, + ], }, { - name: "amount1Lp", - type: "uint128", - internalType: "uint128", + name: "c", + type: "tuple[]", + internalType: "struct ILeo.CampaignRewards[]", + components: [ + { + name: "campaignToken", + type: "address", + internalType: "address", + }, + { + name: "rewards", + type: "uint256", + internalType: "uint256", + }, + ], }, ], }, - { - name: "campaignRewards", - type: "tuple[]", - internalType: "struct ILeo.CampaignRewards[]", - components: [ - { - name: "campaignToken", - type: "address", - internalType: "address", - }, - { name: "rewards", type: "uint256", internalType: "uint256" }, - ], - }, ], stateMutability: "nonpayable", }, @@ -104,15 +181,51 @@ export const ILeo = [ type: "function", name: "createCampaign", inputs: [ - { name: "campaignId", type: "bytes8", internalType: "bytes8" }, - { name: "pool", type: "address", internalType: "address" }, - { name: "tickLower", type: "int32", internalType: "int32" }, - { name: "tickUpper", type: "int32", internalType: "int32" }, - { name: "perSecond", type: "uint64", internalType: "uint64" }, - { name: "token", type: "address", internalType: "address" }, - { name: "extraMax", type: "uint256", internalType: "uint256" }, - { name: "starting", type: "uint64", internalType: "uint64" }, - { name: "ending", type: "uint64", internalType: "uint64" }, + { + name: "campaignId", + type: "bytes8", + internalType: "bytes8", + }, + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "tickLower", + type: "int32", + internalType: "int32", + }, + { + name: "tickUpper", + type: "int32", + internalType: "int32", + }, + { + name: "perSecond", + type: "uint64", + internalType: "uint64", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "extraMax", + type: "uint256", + internalType: "uint256", + }, + { + name: "starting", + type: "uint64", + internalType: "uint64", + }, + { + name: "ending", + type: "uint64", + internalType: "uint64", + }, ], outputs: [], stateMutability: "nonpayable", @@ -121,8 +234,16 @@ export const ILeo = [ type: "function", name: "divestPosition", inputs: [ - { name: "pool", type: "address", internalType: "address" }, - { name: "positionId", type: "uint256", internalType: "uint256" }, + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "positionId", + type: "uint256", + internalType: "uint256", + }, ], outputs: [], stateMutability: "nonpayable", @@ -130,23 +251,71 @@ export const ILeo = [ { type: "function", name: "poolLp", - inputs: [{ name: "pool", type: "address", internalType: "address" }], - outputs: [{ name: "lp", type: "uint256", internalType: "uint256" }], + inputs: [ + { + name: "pool", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "lp", + type: "uint256", + internalType: "uint256", + }, + ], stateMutability: "nonpayable", }, { type: "function", name: "updateCampaign", inputs: [ - { name: "campaignId", type: "bytes8", internalType: "bytes8" }, - { name: "pool", type: "address", internalType: "address" }, - { name: "tickLower", type: "int32", internalType: "int32" }, - { name: "tickUpper", type: "int32", internalType: "int32" }, - { name: "perSecond", type: "uint64", internalType: "uint64" }, - { name: "token", type: "address", internalType: "address" }, - { name: "extraMax", type: "uint256", internalType: "uint256" }, - { name: "starting", type: "uint64", internalType: "uint64" }, - { name: "ending", type: "uint64", internalType: "uint64" }, + { + name: "campaignId", + type: "bytes8", + internalType: "bytes8", + }, + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "tickLower", + type: "int32", + internalType: "int32", + }, + { + name: "tickUpper", + type: "int32", + internalType: "int32", + }, + { + name: "perSecond", + type: "uint64", + internalType: "uint64", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "extraMax", + type: "uint256", + internalType: "uint256", + }, + { + name: "starting", + type: "uint64", + internalType: "uint64", + }, + { + name: "ending", + type: "uint64", + internalType: "uint64", + }, ], outputs: [], stateMutability: "nonpayable", @@ -155,8 +324,16 @@ export const ILeo = [ type: "function", name: "vestPosition", inputs: [ - { name: "pool", type: "address", internalType: "address" }, - { name: "id", type: "uint256", internalType: "uint256" }, + { + name: "pool", + type: "address", + internalType: "address", + }, + { + name: "id", + type: "uint256", + internalType: "uint256", + }, ], outputs: [], stateMutability: "nonpayable",