Skip to content

Commit

Permalink
feat: get idle speeds (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
KedziaPawel authored Sep 17, 2023
1 parent 309550b commit fb670a1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ export { getGrossAssetValueInAsset } from "./reads/getGrossAssetValueInAsset.js"
// ./reads/getIdleRate.js
export { getIdleRate } from "./reads/getIdleRate.js";

// ./reads/getIdleSpeeds.js
export { getIdleSpeeds } from "./reads/getIdleSpeeds.js";

// ./reads/getLabelForPositionType.js
export { getLabelForExternalPositionType } from "./reads/getLabelForPositionType.js";

Expand Down
26 changes: 26 additions & 0 deletions packages/sdk/src/reads/getIdleSpeeds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { type ReadContractParameters, readContractParameters } from "../utils/viem.js";
import type { Address, PublicClient } from "viem";

const abi = {
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "idleSpeeds",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function",
} as const;

export function getIdleSpeeds(
client: PublicClient,
args: ReadContractParameters<{
idleController: Address;
idlePool: Address;
}>,
) {
return client.readContract({
...readContractParameters(args),
abi: [abi],
functionName: "idleSpeeds",
address: args.idleController,
args: [args.idlePool],
});
}

0 comments on commit fb670a1

Please sign in to comment.