Skip to content

Commit

Permalink
feat: add stakewise external calls (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrocheleau authored Dec 29, 2023
1 parent a962389 commit dbab17b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-pets-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@enzymefinance/sdk": patch
---

Add StakeWise external calls
30 changes: 30 additions & 0 deletions packages/sdk/src/Portfolio/Integrations/StakeWiseV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,33 @@ export async function getClaimExitedAssetsPreview(
args: [args.receiver, args.positionTicket, args.timestamp, args.exitQueueIndex],
});
}

export async function getExitQueueIndex(
client: PublicClient,
args: Viem.ContractCallParameters<{
positionTicket: bigint;
stakeWiseVault: Address;
}>,
) {
return Viem.readContract(client, args, {
abi: parseAbi(["function getExitQueueIndex(uint256 _positionTicket) view returns (int256 exitQueueIndex_)"]),
functionName: "getExitQueueIndex",
address: args.stakeWiseVault,
args: [args.positionTicket],
});
}

export async function isHarvestRequired(
client: PublicClient,
args: Viem.ContractCallParameters<{
keeperRewards: Address;
stakeWiseVault: Address;
}>,
) {
return Viem.readContract(client, args, {
abi: parseAbi(["function isHarvestRequired(address _vault) view returns (bool harvestRequired_)"]),
functionName: "isHarvestRequired",
address: args.keeperRewards,
args: [args.stakeWiseVault],
});
}

0 comments on commit dbab17b

Please sign in to comment.