This PR introduces a comprehensive suite of tests for the onEthRewardsReceived function in the Yield Accrual contract. These tests cover various scenarios to ensure the correct behavior and proper error handling of the function. The test cases include:
Test Cases for Yield Accrual
When sender is not protocol:
Should revert with "Can only be called by Protocol!"
When sender is protocol:
When rewards are positive:
When insufficient balance:
Should revert when there is not enough ETH in Asset Router for avgTreasuryFee with "Transfer to treasury failed".
Should revert when there is not enough ETH in Asset Router for avgOperatorsFee with "Transfer to yield distributor failed".
When sufficient balance:
When community rewards are positive:
Should increase balanceEthAndWeth & call onIncreaseOracleError with avgTreasuryFee=0.6, avgOperatorsFee=0.4.
Should increase balanceEthAndWeth & call onIncreaseOracleError with avgTreasuryFee=0.1, avgOperatorsFee=0.1.
Should increase balanceEthAndWeth & call onIncreaseOracleError with avgTreasuryFee=0.5, avgOperatorsFee=0.4.
Should increase balanceEthAndWeth & call onIncreaseOracleError with avgTreasuryFee=0.99, avgOperatorsFee=0.01.
Should increase balanceEthAndWeth & call onIncreaseOracleError with avgTreasuryFee=0.99999, avgOperatorsFee=0.00001.
Should increase balanceEthAndWeth & call onIncreaseOracleError with avgTreasuryFee=1, avgOperatorsFee=0.
Should increase balanceEthAndWeth & call onIncreaseOracleError with avgTreasuryFee=0, avgOperatorsFee=1.
This PR introduces a comprehensive suite of tests for the onEthRewardsReceived function in the Yield Accrual contract. These tests cover various scenarios to ensure the correct behavior and proper error handling of the function. The test cases include:
Test Cases for Yield Accrual
When sender is not protocol:
When sender is protocol:
When rewards are positive:
When insufficient balance:
avgTreasuryFee
with "Transfer to treasury failed".avgOperatorsFee
with "Transfer to yield distributor failed".When sufficient balance:
When community rewards are positive:
avgTreasuryFee=0.6
,avgOperatorsFee=0.4
.avgTreasuryFee=0.1
,avgOperatorsFee=0.1
.avgTreasuryFee=0.5
,avgOperatorsFee=0.4
.avgTreasuryFee=0.99
,avgOperatorsFee=0.01
.avgTreasuryFee=0.99999
,avgOperatorsFee=0.00001
.avgTreasuryFee=1
,avgOperatorsFee=0
.avgTreasuryFee=0
,avgOperatorsFee=1
.When community rewards are negative:
0x11
.When rewards are zero:
When rewards are negative: