|Ethereum & Optimism
|James Zwar (@jmzwar), Noisekit (@noisekit)
SIP-342 Proposes adding a few missing view functions to read current state to be used in UI, tests and other scripts:
getAvailableRewardsto be added to the
RewardsManagerModuleto return an account balance for a registered distributor.
getPoolCollateralConfigurationto be added to the
PoolModuleto 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.
RewardsManagerModule view function to be added:
) external view returns (uint256 rewardAmount);
PoolModule view function to be added:
) external view returns (PoolCollateralConfiguration.Data memory config);
Extra test cases to be added for new view methods:
Copyright and related rights waived via CC0.