{"aip":35,"title":"Adjust interest rate to account for APY over-approximation","status":"Proposed","author":"Ahmed Naguib Aly (@ahnaguib)","shortDescription":"Adjust interest rate to account for APY over-approximation","discussions":"https://governance.aave.com/t/arc-update-ampl-interest-rate-curve-to-account-for-over-approximation-in-compounded-interest/5350","created":"2021-07-26T00:00:00.000Z","preview":"## Simple Summary\n\n- Update interest rate on AMPL market to account …","basename":"AIP-35","description":"\n\n## Simple Summary\n\n- Update interest rate on AMPL market to account for over-approximation in compounded interest computation.\n- Make use of the exponential curve due to the over-approximation to set higher max APY.\n\n\n## Motivation\n\nIn AAVEs MathUtils an over-approximation in the application of the interest rate for computing compounded interest was discovered. \n\n### In [calculateCompoundedInterest](https://github.com/aave/protocol-v2/blob/baeb455fad42d3160d571bd8d3a795948b72dd85/contracts/protocol/libraries/math/MathUtils.sol#L45) method\n\nPeriodic rate (per second) is computed as:\n\nuint256 ratePerSecond = rate / SECONDS_PER_YEAR;\n\nin comparison to the exact computation.\n\n![|281x35](https://github.com/aave/aip/blob/debf98b7ebe21b2964b3dc03843854c78709d813/content/assets/AIP-35/rate_per_second.png?raw=true)\n\nderived from:\n\n![|269x48](https://github.com/aave/aip/blob/debf98b7ebe21b2964b3dc03843854c78709d813/content/assets/AIP-35/apy_formula.jpeg?raw=true)\n\nThe deviation in the applied interest rate causes a small over-approximation for APYs <10%, but grows exponentially as can be seen below.\n\n|Expected APY|Effective APY|Expected daily rate|Effective daily rate|\n| --- | --- | --- | --- |\n|4.00%|4.08%|0.01%|0.01%|\n|5.00%|5.13%|0.01%|0.01%|\n|10.00%|10.52%|0.03%|0.03%|\n|50.00%|64.87%|0.11%|0.14%|\n|100.00%|171.83%|0.19%|0.27%|\n|200.00%|638.91%|0.31%|0.55%|\n|1000.00%|2202543.09%|0.68%|2.78%|\n|10000.00%|2.69E+43%|1.30%|31.52%|\n\nThis difference is especially noticeable in the AMPL market, where the configured interest rate can go up to 10,002% at max utilization.\n\nThe AAVE Genesis team has been made aware and they will publish more guidance on the discrepancy.\n\n## Specification\n\nAs mentioned in AIP-26, a nonlinear - logistic or exponential - interest curve is more suited for \nAMPL's market and potentially other assets on AAVE's platform.\n\nThe over-approximation mentioned above results in an exponential curve which allows for defining a \nmore suitable interest curve for AMPL. We propose the following parameters, which produces the curve below.\n\n* Optimal utilization = 80%\n* Base rate = 1%\n* Slope1 = 2%\n* Slope2 = 750%\n\n\n![|624x384](https://github.com/aave/aip/blob/debf98b7ebe21b2964b3dc03843854c78709d813/content/assets/AIP-35/curve.png?raw=true \"Chart\")\n\n##### APY table above 80% Utilization:\n\n|Utilization|APY|\n|---|---|\n|80.00%|3.05%|\n|81.00%|49.93%|\n|82.00%|118.15%|\n|83.00%|217.40%|\n|84.00%|361.82%|\n|85.00%|571.94%|\n|86.00%|877.67%|\n|87.00%|1322.50%|\n|88.00%|1969.72%|\n|89.00%|2911.43%|\n|90.00%|4281.60%|\n|91.00%|6275.19%|\n|92.00%|9175.85%|\n|93.00%|13396.29%|\n|94.00%|19536.98%|\n|95.00%|28471.63%|\n|96.00%|41471.48%|\n|97.00%|60386.14%|\n|98.00%|87906.81%|\n|99.00%|127949.14%|\n|100.00%|186210.38%|\n\n                                           \n##### The part of the curve under 80% Utilization:    \n\n**![|624x325](https://github.com/aave/aip/blob/debf98b7ebe21b2964b3dc03843854c78709d813/content/assets/AIP-35/curve_under_optimal.png?raw=true \"Chart\")**\n\n## Rationale\n\n1. Accounting for the over-approximation of the existing Slope2=10,000% interest curve requires reducing the slope2 parameter.\n2. Taking advantage of the exponential curve allows for:\n  a. Setting a higher optimal utilization rate.\n  b. Setting a higher maximum APY to reduce the potential for\n     utilization being at 100% for extended periods without creating a too steep of an interest rate increase right above the optimal utilization rate.\n\n\n## Implementation\n\nA deployment of the existing implementation of the Interest Strategy will be used, with the following parameters:\n\n    optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),\n    baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),\n    variableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),\n    variableRateSlope2: new BigNumber(7.5).multipliedBy(oneRay).toFixed(),\n\n[https://etherscan.io/address/0x84d1FaD9559b8AC1Fda17d073B8542c8Fb6986dd#readContract](https://etherscan.io/address/0x84d1FaD9559b8AC1Fda17d073B8542c8Fb6986dd#readContract)\n\n## Copyright\n\nCopyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).\n"}