Contract Helpers

Contract helpers provide essential utilities for interacting with Parabolโ€™s smart contracts. These functions handle contract address resolution, ABI management, and contract information retrieval across supported networks.

Functions

๐Ÿ“„ getContractAddress

Retrieves the deployed address for a specific contract on a given network.

Example

import {
  getContractAddress,
  ContractTarget,
  SupportedChainIds,
} from "@parabolfi/core";
 
const rspAddress = getContractAddress(
  SupportedChainIds.ZKSYNC, // zkSync Era Mainnet
  ContractTarget.ReserveStabilityPool
);

Parameters

  • chainId: The supported chain ID to retrieve the contract address from.
  • target: The target contract to retrieve the address for.

Returns

  • string: The deployed address of the specified contract.

Errors

Throws ParabolSDKError.INVALID_CONTRACT_ADDRESS if the contract address is not found for the given chain and target

๐Ÿ“„ getContractAbi

Retrieves the ABI for a specific contract type.

Example

import { getContractAbi, ContractTarget } from "@parabolfi/core";
 
const rspAbi = getContractAbi(ContractTarget.ReserveStabilityPool);

Parameters

  • target: The target contract to retrieve the ABI for.

Returns

  • Abi: The ABI of the specified contract.

Errors

Throws ParabolSDKError.INVALID_CONTRACT_ABI if the ABI is not found for the given target

๐Ÿ“„ getContractInfo

Combines address and ABI retrieval into a single convenient function.

Example

import {
  getContractInfo,
  ContractTarget,
  SupportedChainIds,
} from "@parabolfi/core";
 
const rspInfo = getContractInfo(
  SupportedChainIds.ZKSYNC, // zkSync Era Mainnet
  ContractTarget.ReserveStabilityPool
);

Parameters

  • chainId: The supported chain ID to retrieve the contract address from.
  • target: The target contract to retrieve the address and ABI for.

Returns

  • ContractInfo: An object containing the contract address and ABI.
    • address: The deployed address of the specified contract.
    • abi: The ABI of the specified contract.

Errors

  • Throws ParabolSDKError.INVALID_CONTRACT_ADDRESS if the contract address is not found for the given chain and target
  • Throws ParabolSDKError.INVALID_CONTRACT_ABI if the ABI is not found for the given target