SIP-342: Add missing view functions to access current configurations and state

NetworkEthereum & Optimism
ImplementorJames Zwar (@jmzwar), Noisekit (@noisekit)
ProposalLoading status...


SIP-342 Proposes adding a few missing view functions to read current state to be used in UI, tests and other scripts:

  • getAvailableRewards to be added to the RewardsManagerModule to return an account balance for a registered distributor.
  • getPoolCollateralConfiguration to be added to the PoolModule to return a collateral configuration specific to the pool.


Currently, to retrieve the available balance of an account a static call to claimRewards is required, which throws an exception on an account have a zero balance. This is cumbersome for frontend providers to handle an the exceptions must be handled.

Collateral configuration for pool is currently only available via event PoolCollateralConfiguration which makes it impossible to query contract directly to retrieve such configuration after it has been set. This requies UIs to rely on subgraphs exclusively to access such configuration.

Technical Specification

In the RewardsManagerModule view function to be added:

    function getAvailableRewards(
        uint128 accountId, 
        uint128 poolId, 
        address collateralType, 
        address distributor
    ) external view returns (uint256 rewardAmount);

In the PoolModule view function to be added:

    function getPoolCollateralConfiguration(
        uint128 poolId,
        address collateralType
    ) external view returns (PoolCollateralConfiguration.Data memory config);

Test Case

Extra test cases to be added for new view methods:

  • getAvailableRewards in RewardsManagerModule.test.ts
  • getPoolCollateralConfiguration in PoolConfigurationModule.test.ts

Configurable Values (Via SCCP)


Copyright and related rights waived via CC0.