SlideShare a Scribd company logo
Optimal stable coin folding strategy
Stefan Duprey, Frederic Fayes, Tom Suter
SwissBorg
stefan@swissborg.com, frederic@swissborg.com, tom@swissborg.com
Abstract—A basic ’Lend/Borrow’ strategy on the Aave protocol
is one of the best and safest way to generate yield on your stable
coins.
Those strategies are perfect fits for multiple ’Lend/Borrow’
iterations or ’Folding’ due to the inherent pegging of stable coins
and the low liquidation risk incurred.
The question of the optimal AUM allocation between multiple
pools is a complex one.
APY dilution generate non linear effects, which can be solved
through advanced non linear optimization algorithms/solvers, but
those solvers are computationally intensive and won’t transport
easily into solidity code and limited computations due to high
gas prices.
We here propose a linearization which give a simpler constrained
quadratic optimization problem, whose solution can be expressed
analytically through Lagrange multiplier.
That analytical solution can be seamlessly computed in solildity
and live on a blockchain even with high gas prices.
I. FOLDING STRATEGY
Iteration Supply Borrow
0 A A*X
1 A*X A*X*X
...
n A*Xn
A*Xn+1
The total amount supplied after n iterations is:
S =
n
X
i=0
A ∗ Xi
= A
1 − Xn+1
1 − X
(1)
S ≈
+∞
X
i=0
A ∗ Xn
= A
1
1 − X
The total amount borrowed after n iterations is:
B =
n
X
i=0
A ∗ Xi+1
= A ∗ X
1 − Xn+1
1 − X
(2)
B ≈
+∞
X
i=0
A ∗ Xn+1
= A
X
1 − X
By defining the total APY on the supply side as the sum of
the base APY and the liquidity incentive APY, here comes :
sAPY = supply APY + incentive supply APY (3)
bAPY = borrow APY − incentive borrow APY (4)
total APY =
A
1 − X
∗ sAPY −
A ∗ X
1 − X
∗ bAPY (5)
This total APY is obviously strictly increasing as a function
of the percentage ratio X.
d
dX
(total APY) =
(sAPY − bAPY )
(1 − X)2
> 0 (6)
The upper bound for X is only set by type of pools according
to the incurred liquidation threshold.
For stable coin pools with historicaly prooved pegging, X can
be chosen as high as 72%.
II. ALLOCATING BETWEEN POOLS : AN OPTIMIZATION
PROBLEM
A. Aave protocol : a trade off to maximize utilization/assured
withdrawal
Aave protocol implements at its core a regulating mecha-
nism which aims at maximizing profits for liquidity supplier
while keeping them safe and always able to withdraw their
liquidity.
The utilization rate, which is just the ratio of the total borrowed
divided by the total supplied:
U =
Bt
Lt
(7)
is algorithmically targeted to stay close to an optimal Uoptimal
fixed by Aave governance per different pools.
The targeting mechanism can be summed up to the definition
of two different borrow rate growth regime according to the
value of U under or above Uoptimal.
Rb =
(
Rb0
+ U
Uoptimal
∗ Rslope1, if U ≤ Uoptimal
Rb0
+ Rslope1 +
U−Uoptimal
1−Uoptimal
∗ Rslope2, U ≥ Uoptimal
Rb is the borrow rate, which will rise sharply after
U > Uoptimal to prevent the ratio from being too close to
one, which could keep suppliers from withdrawing their fund.
Rb0 is the constant base variable borrow rate.
The supply rate is then defined as the borrow rate multiplied
by the utilization ratio.
Rs = Rb ∗ U (8)
The greater the utilization ratio, the more yield suppliers will
get.
Rs − Rb = Rb ∗ (U − 1) < 0 (9)
B. Stable coin pool parameters
Aave protocol governance has assigned the following pa-
rameters all common across stable pool reserves :
Coin Uoptimal base slope1 slope2
DAI 90% 0% 4% 60%
USDC 90% 0% 4% 60%
USDT 90% 0% 4% 60%
C. Liquidity incentives APR
1) Definition: The definition of the liquidity incentives can
be found in Aave V2 protocol white paper :
isAPR = 100∗
aEmissionPerY ear ∗ rewardPrice
totalATokenSupply ∗ tokenPrice
(10)
where the parameters match the following in the smart
contract are detailed in the solidity section
ibAPR = 100 ∗
vEmissionPerY ear ∗ rewardPrice
totalCurrentV ariableDebt ∗ tokenPrice
(11)
where the parameters match the following in the smart
contract are detailed in the solidity section
We see that from the assumption of a fixed reward price
and emission rate, the borrow APR depends on the total
current debt :
APRb =
cteb
Bt
(12)
And the supply APR depends on the total liquidity:
APRs =
ctes
Lt
(13)
2) Compounding: We will here assume that those incentive
annual APR are indeed harvested and reinvested in the
strategy leading to an annualized compounded APY:
APY = (1 +
APR
secondsPerY ear
)secondsP erY ear
− 1 (14)
The reverse equation is :
APR = ((1 + APY )
1
secondsP erY ear − 1) ∗ secondsPerY ear
(15)
D. Dilution effect
When a proportion X of an additional amount AUM is
dispatched to a specific liquidity pool. This pool will incur a
dilution effect on its liquidity.
Lt ← Lt + X ∗ AUM
E. First order approximation
We can simplify the non linear term under the assumption:
1
Lt + X ∗ AUM
=
1
Lt
∗
1
1 + X
Lt
AUM
=
1
Lt
∗
n=+∞
X
n=0
(−1)n Xn
Lt
AUM
n
If X << Lt
AUM , as a first order approximation:
1
Lt + X ∗ AUM
=
1
Lt
−
AUM
L2
t
∗ X
Here comes the new diluted utilization ratio :
U(X) =
Bt
Lt + X ∗ AUM
=
Bt
Lt
∗
1
1 + X
Lt
AUM
≈
Bt
Lt
∗(1−
X
Lt
AUM
)
(16)
Here comes the new diluted incentive APYs:
APRs(X) =
ctes
Lt + X ∗ AUM
≈ ctes ∗ (
1
Lt
−
AUM
L2
t
∗ X)
(17)
After multiple folding and , we then linearize as in 17
It comes after linearization :
APR(X) = APRs(X) + APRs(X)
=
ctes
Lt + X∗AUM
1−Xleverage
+
cteb
Bt +
Xleverage∗X∗AUM
1−Xleverage
≈ ctes ∗ (
1
Lt
−
AUM
L2
t
∗ X)
APR(X) ≈ A0 + A1 ∗ X (18)
where
A0 =
ctes
Lt
+
cteb
Bt
(19)
A1 = −
ctes ∗ AUM
L2
t ∗ (1 − Xleverage)
−
cteb ∗ AUM ∗ Xleverage
B2
t ∗ (1 − Xleverage)
(20)
F. Optimization problem
When having to allocate an amount AUM between n pools,
one will look at optimizing the total generated yield :
(ω1, ..., ωn) = arg max
Pi=n
i=1 ωi=1,0≤ωi≤1
i=n
X
i=1
ωi × tAPYi (ωi ∗ AUM)
(21)
where the total APYs APYi for each pool i are defined in
equations 3 and 4.
The 14 equation shows that the liquidity incentive APYs on
Aave are actually the main prominent reason for choosing a
specific pool.
We can in a first approximation try to solve the simpler
problem :
(ω1, ..., ωn) = arg max
Pi=n
i=1 ωi=1,0≤ωi≤1
n
X
i=1
ωi × APRi (ωi ∗ AUM)
(22)
G. Constrained quadratic optimization for the linearized
problem
Under the conditions X << Lt
AUM and U < Uoptimal, by
using the first order approximations 18 :
(ω1, ..., ωn) = arg max
Pi=n
i=1 ωi=1,0≤ωi≤1
n
X
i=1
ωi × (A0i + A1i ∗ ωi)
where A0i, A1i are the constants for the pool i.
By calling
J(x) = −
n
X
i=1
xi × (A0i + A1i ∗ xi)
The optimization problem becomes a constrained quadratic
minimization problem
min
P
xi=1,0≤xi≤1
J(x)
H. Analytical solution from Lagrange multiplier
By rewriting the constraint as :
g(x) =
n
X
i=1
xi
We can compute the optimal solution using the Lagrange
multiplier and the modified functional taking into the equality
constraints and the inequality constraints using KKT condi-
tions and slack variables:
J′
(x) = J(x) + λ (g(x) − 1)
+
X
i
θi ∗ (xi − s2
i ) +
X
i
γi ∗ (1 − t2
i − xi)
We solve the Lagrangian equations :



∇xJ′
(x) = 0
∇λJ′
(x) = 0
∇θJ′
(x) = 0
(23)
The ∇x conditions give the following :








A01 + 2 ∗ A11 ∗ x1 + λ + θ1 − γ1
.
.
.
A0i + 2 ∗ A1i ∗ xi + λ + θi − γi
.
.
.
A0n + 2 ∗ A1n ∗ xn + λ + θn − γn








=








0
.
.
.
0
.
.
.
0








First case, if all θi and γi are null, it means that all slack
variables s2
i and t2
i are positive and the constraints are not
active.
The x solution reads :
∀i ∈ [1, . . . , n] , xi = −
λ + A0i
2 ∗ A1i
(24)
and the Lagrange multiplier can then be quantified through the
constraint :
λ =
−1 −
Pn
i=1
A0i
2∗A1i
Pn
i=1
1
2∗A1i
(25)
In the case where on one xi does not respect the inequalities,
it means that either xi = 1or0 depending on if θi or γi is not
null. The solution is then obtained recursively by reiterating
the 24 and 25 with the remaining xis until all are found
respecting the inequalities.
III. ALLOCATING BETWEEN POOLS : AN OPTIMIZATION
PROBLEM
We here present optimization results for the following
snapshot parameter for a three pools (DAI, USDC, USDT)
allocation on Aave Avalanche.
Fig. 1. Optimization parameters
Fig. 2. Non linearized exact solution
A.
Fig. 3. Approximative linearized solution
IV. SOLIDITY CODE FOR OPTIMIZATION
The new diluted incentive APYs expression 17 and both
equations 27 and 10 give us the expression for our A0i and
A1i
isAPR = 100 ∗
a ∗ r ∗ w
Lt ∗ t ∗ d
=
ctes
Lt
(26)
where ctes = 100∗ a∗r∗w
t∗d the parameters match the followings
in the smart contract :



















isAPR = incentiveDepositAPRPercent
a = aEmissionPerY ear
r = REWARDPRICEETH
w = WEIDECIMALS
t = TOKENPRICEETH
d = TOKENDECIMALS
Lt = totalATokenSupply
ibAPR = 100 ∗
v ∗ r ∗ w
Bt ∗ t ∗ d
=
cteb
Bt
(27)
where cteb = 100∗ v∗r∗w
t∗d the parameters match the followings
in the smart contract :



















ibAPR = incentiveBorrowAPRPercent
v = vEmissionPerY ear
r = REWARDPRICEETH
w = WEIDECIMALS
Bt = totalCurrentV ariableDebt
t = TOKENPRICEETH
d = TOKENDECIMALS
By using equations 20 and 19, we can compute A0i and
A1i for each pool.
Equations 25 and ?? give us then the optimal pool allocation.
V. CONCLUSION
We have managed to simplify the optimization problem
and transport it to EVM like blockchain languages.
The solution can scale up to at least ten pools without being
too computationally intensive.
REFERENCES
[1] S. Nakamoto, “Bitcoin: A peer-to-peer electronic cash
system,” Decentralized Business Review, p. 21260, 2008.
[2] V. Buterin et al., “Ethereum white paper,” GitHub repos-
itory, vol. 1, pp. 22–23, 2013.
[3] “Aave white paper,” https://github.com/aave/protocol-
v2/blob/master/aave-v2-whitepaper.pdf.
[4] “Aave documentation,” https://docs.aave.com/portal/.

More Related Content

PDF
Axisymmetric finite element convergence results
PDF
Avellaneda Stoikov Inventory management.pdf
PDF
Dynamical smart liquidity on decentralized exchanges for lucrative market making
PDF
Smart systematic short strangle
PDF
Short Term Intraday Long Only Crypto Strategies
PDF
On Chain Weekly Rebal Low Expo Strategy
PDF
Curve_fairness_IOUs.pdf
PPTX
Financial quantitative strategies using artificial intelligence
Axisymmetric finite element convergence results
Avellaneda Stoikov Inventory management.pdf
Dynamical smart liquidity on decentralized exchanges for lucrative market making
Smart systematic short strangle
Short Term Intraday Long Only Crypto Strategies
On Chain Weekly Rebal Low Expo Strategy
Curve_fairness_IOUs.pdf
Financial quantitative strategies using artificial intelligence

More from Stefan Duprey (10)

DOCX
Intraday news event_study
PDF
Multi risk factor model
PPTX
Impact best bid/ask limit order execution
PPTX
Optimal order execution
PDF
A new axisymmetric finite element
PDF
Page rank optimization to push successful URLs or products for e-commerce
PDF
Compounded autoregressive processes for Credit Risk modelling
PDF
Thesis presentation
PDF
Algorithmic trading
PDF
Machine learning for_finance
Intraday news event_study
Multi risk factor model
Impact best bid/ask limit order execution
Optimal order execution
A new axisymmetric finite element
Page rank optimization to push successful URLs or products for e-commerce
Compounded autoregressive processes for Credit Risk modelling
Thesis presentation
Algorithmic trading
Machine learning for_finance
Ad

Recently uploaded (20)

PPTX
C1 cut-Methane and it's Derivatives.pptx
PPTX
7. General Toxicologyfor clinical phrmacy.pptx
PPTX
Application of enzymes in medicine (2).pptx
PPTX
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
PPT
6.1 High Risk New Born. Padetric health ppt
PDF
An interstellar mission to test astrophysical black holes
PPTX
Microbiology with diagram medical studies .pptx
PDF
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
PPTX
BIOMOLECULES PPT........................
PPTX
Introduction to Cardiovascular system_structure and functions-1
PDF
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
PPTX
2. Earth - The Living Planet Module 2ELS
PPTX
Introduction to Fisheries Biotechnology_Lesson 1.pptx
PPTX
Fluid dynamics vivavoce presentation of prakash
PPT
protein biochemistry.ppt for university classes
PPTX
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...
PPTX
Classification Systems_TAXONOMY_SCIENCE8.pptx
PPTX
POULTRY PRODUCTION AND MANAGEMENTNNN.pptx
PDF
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
C1 cut-Methane and it's Derivatives.pptx
7. General Toxicologyfor clinical phrmacy.pptx
Application of enzymes in medicine (2).pptx
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
6.1 High Risk New Born. Padetric health ppt
An interstellar mission to test astrophysical black holes
Microbiology with diagram medical studies .pptx
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
Taita Taveta Laboratory Technician Workshop Presentation.pptx
BIOMOLECULES PPT........................
Introduction to Cardiovascular system_structure and functions-1
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
2. Earth - The Living Planet Module 2ELS
Introduction to Fisheries Biotechnology_Lesson 1.pptx
Fluid dynamics vivavoce presentation of prakash
protein biochemistry.ppt for university classes
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...
Classification Systems_TAXONOMY_SCIENCE8.pptx
POULTRY PRODUCTION AND MANAGEMENTNNN.pptx
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
Ad

Stable_pool_optimal_allocation.pdf

  • 1. Optimal stable coin folding strategy Stefan Duprey, Frederic Fayes, Tom Suter SwissBorg stefan@swissborg.com, frederic@swissborg.com, tom@swissborg.com Abstract—A basic ’Lend/Borrow’ strategy on the Aave protocol is one of the best and safest way to generate yield on your stable coins. Those strategies are perfect fits for multiple ’Lend/Borrow’ iterations or ’Folding’ due to the inherent pegging of stable coins and the low liquidation risk incurred. The question of the optimal AUM allocation between multiple pools is a complex one. APY dilution generate non linear effects, which can be solved through advanced non linear optimization algorithms/solvers, but those solvers are computationally intensive and won’t transport easily into solidity code and limited computations due to high gas prices. We here propose a linearization which give a simpler constrained quadratic optimization problem, whose solution can be expressed analytically through Lagrange multiplier. That analytical solution can be seamlessly computed in solildity and live on a blockchain even with high gas prices. I. FOLDING STRATEGY Iteration Supply Borrow 0 A A*X 1 A*X A*X*X ... n A*Xn A*Xn+1 The total amount supplied after n iterations is: S = n X i=0 A ∗ Xi = A 1 − Xn+1 1 − X (1) S ≈ +∞ X i=0 A ∗ Xn = A 1 1 − X The total amount borrowed after n iterations is: B = n X i=0 A ∗ Xi+1 = A ∗ X 1 − Xn+1 1 − X (2) B ≈ +∞ X i=0 A ∗ Xn+1 = A X 1 − X By defining the total APY on the supply side as the sum of the base APY and the liquidity incentive APY, here comes : sAPY = supply APY + incentive supply APY (3) bAPY = borrow APY − incentive borrow APY (4) total APY = A 1 − X ∗ sAPY − A ∗ X 1 − X ∗ bAPY (5) This total APY is obviously strictly increasing as a function of the percentage ratio X. d dX (total APY) = (sAPY − bAPY ) (1 − X)2 > 0 (6) The upper bound for X is only set by type of pools according to the incurred liquidation threshold. For stable coin pools with historicaly prooved pegging, X can be chosen as high as 72%. II. ALLOCATING BETWEEN POOLS : AN OPTIMIZATION PROBLEM A. Aave protocol : a trade off to maximize utilization/assured withdrawal Aave protocol implements at its core a regulating mecha- nism which aims at maximizing profits for liquidity supplier while keeping them safe and always able to withdraw their liquidity. The utilization rate, which is just the ratio of the total borrowed divided by the total supplied: U = Bt Lt (7) is algorithmically targeted to stay close to an optimal Uoptimal fixed by Aave governance per different pools. The targeting mechanism can be summed up to the definition of two different borrow rate growth regime according to the value of U under or above Uoptimal. Rb = ( Rb0 + U Uoptimal ∗ Rslope1, if U ≤ Uoptimal Rb0 + Rslope1 + U−Uoptimal 1−Uoptimal ∗ Rslope2, U ≥ Uoptimal Rb is the borrow rate, which will rise sharply after U > Uoptimal to prevent the ratio from being too close to one, which could keep suppliers from withdrawing their fund. Rb0 is the constant base variable borrow rate. The supply rate is then defined as the borrow rate multiplied by the utilization ratio. Rs = Rb ∗ U (8) The greater the utilization ratio, the more yield suppliers will get. Rs − Rb = Rb ∗ (U − 1) < 0 (9)
  • 2. B. Stable coin pool parameters Aave protocol governance has assigned the following pa- rameters all common across stable pool reserves : Coin Uoptimal base slope1 slope2 DAI 90% 0% 4% 60% USDC 90% 0% 4% 60% USDT 90% 0% 4% 60% C. Liquidity incentives APR 1) Definition: The definition of the liquidity incentives can be found in Aave V2 protocol white paper : isAPR = 100∗ aEmissionPerY ear ∗ rewardPrice totalATokenSupply ∗ tokenPrice (10) where the parameters match the following in the smart contract are detailed in the solidity section ibAPR = 100 ∗ vEmissionPerY ear ∗ rewardPrice totalCurrentV ariableDebt ∗ tokenPrice (11) where the parameters match the following in the smart contract are detailed in the solidity section We see that from the assumption of a fixed reward price and emission rate, the borrow APR depends on the total current debt : APRb = cteb Bt (12) And the supply APR depends on the total liquidity: APRs = ctes Lt (13) 2) Compounding: We will here assume that those incentive annual APR are indeed harvested and reinvested in the strategy leading to an annualized compounded APY: APY = (1 + APR secondsPerY ear )secondsP erY ear − 1 (14) The reverse equation is : APR = ((1 + APY ) 1 secondsP erY ear − 1) ∗ secondsPerY ear (15) D. Dilution effect When a proportion X of an additional amount AUM is dispatched to a specific liquidity pool. This pool will incur a dilution effect on its liquidity. Lt ← Lt + X ∗ AUM E. First order approximation We can simplify the non linear term under the assumption: 1 Lt + X ∗ AUM = 1 Lt ∗ 1 1 + X Lt AUM = 1 Lt ∗ n=+∞ X n=0 (−1)n Xn Lt AUM n If X << Lt AUM , as a first order approximation: 1 Lt + X ∗ AUM = 1 Lt − AUM L2 t ∗ X Here comes the new diluted utilization ratio : U(X) = Bt Lt + X ∗ AUM = Bt Lt ∗ 1 1 + X Lt AUM ≈ Bt Lt ∗(1− X Lt AUM ) (16) Here comes the new diluted incentive APYs: APRs(X) = ctes Lt + X ∗ AUM ≈ ctes ∗ ( 1 Lt − AUM L2 t ∗ X) (17) After multiple folding and , we then linearize as in 17 It comes after linearization : APR(X) = APRs(X) + APRs(X) = ctes Lt + X∗AUM 1−Xleverage + cteb Bt + Xleverage∗X∗AUM 1−Xleverage ≈ ctes ∗ ( 1 Lt − AUM L2 t ∗ X) APR(X) ≈ A0 + A1 ∗ X (18) where A0 = ctes Lt + cteb Bt (19) A1 = − ctes ∗ AUM L2 t ∗ (1 − Xleverage) − cteb ∗ AUM ∗ Xleverage B2 t ∗ (1 − Xleverage) (20) F. Optimization problem When having to allocate an amount AUM between n pools, one will look at optimizing the total generated yield : (ω1, ..., ωn) = arg max Pi=n i=1 ωi=1,0≤ωi≤1 i=n X i=1 ωi × tAPYi (ωi ∗ AUM) (21) where the total APYs APYi for each pool i are defined in equations 3 and 4. The 14 equation shows that the liquidity incentive APYs on Aave are actually the main prominent reason for choosing a specific pool. We can in a first approximation try to solve the simpler problem : (ω1, ..., ωn) = arg max Pi=n i=1 ωi=1,0≤ωi≤1 n X i=1 ωi × APRi (ωi ∗ AUM) (22)
  • 3. G. Constrained quadratic optimization for the linearized problem Under the conditions X << Lt AUM and U < Uoptimal, by using the first order approximations 18 : (ω1, ..., ωn) = arg max Pi=n i=1 ωi=1,0≤ωi≤1 n X i=1 ωi × (A0i + A1i ∗ ωi) where A0i, A1i are the constants for the pool i. By calling J(x) = − n X i=1 xi × (A0i + A1i ∗ xi) The optimization problem becomes a constrained quadratic minimization problem min P xi=1,0≤xi≤1 J(x) H. Analytical solution from Lagrange multiplier By rewriting the constraint as : g(x) = n X i=1 xi We can compute the optimal solution using the Lagrange multiplier and the modified functional taking into the equality constraints and the inequality constraints using KKT condi- tions and slack variables: J′ (x) = J(x) + λ (g(x) − 1) + X i θi ∗ (xi − s2 i ) + X i γi ∗ (1 − t2 i − xi) We solve the Lagrangian equations :    ∇xJ′ (x) = 0 ∇λJ′ (x) = 0 ∇θJ′ (x) = 0 (23) The ∇x conditions give the following :         A01 + 2 ∗ A11 ∗ x1 + λ + θ1 − γ1 . . . A0i + 2 ∗ A1i ∗ xi + λ + θi − γi . . . A0n + 2 ∗ A1n ∗ xn + λ + θn − γn         =         0 . . . 0 . . . 0         First case, if all θi and γi are null, it means that all slack variables s2 i and t2 i are positive and the constraints are not active. The x solution reads : ∀i ∈ [1, . . . , n] , xi = − λ + A0i 2 ∗ A1i (24) and the Lagrange multiplier can then be quantified through the constraint : λ = −1 − Pn i=1 A0i 2∗A1i Pn i=1 1 2∗A1i (25) In the case where on one xi does not respect the inequalities, it means that either xi = 1or0 depending on if θi or γi is not null. The solution is then obtained recursively by reiterating the 24 and 25 with the remaining xis until all are found respecting the inequalities. III. ALLOCATING BETWEEN POOLS : AN OPTIMIZATION PROBLEM We here present optimization results for the following snapshot parameter for a three pools (DAI, USDC, USDT) allocation on Aave Avalanche. Fig. 1. Optimization parameters Fig. 2. Non linearized exact solution A. Fig. 3. Approximative linearized solution IV. SOLIDITY CODE FOR OPTIMIZATION The new diluted incentive APYs expression 17 and both equations 27 and 10 give us the expression for our A0i and A1i isAPR = 100 ∗ a ∗ r ∗ w Lt ∗ t ∗ d = ctes Lt (26) where ctes = 100∗ a∗r∗w t∗d the parameters match the followings in the smart contract :                    isAPR = incentiveDepositAPRPercent a = aEmissionPerY ear r = REWARDPRICEETH w = WEIDECIMALS t = TOKENPRICEETH d = TOKENDECIMALS Lt = totalATokenSupply
  • 4. ibAPR = 100 ∗ v ∗ r ∗ w Bt ∗ t ∗ d = cteb Bt (27) where cteb = 100∗ v∗r∗w t∗d the parameters match the followings in the smart contract :                    ibAPR = incentiveBorrowAPRPercent v = vEmissionPerY ear r = REWARDPRICEETH w = WEIDECIMALS Bt = totalCurrentV ariableDebt t = TOKENPRICEETH d = TOKENDECIMALS By using equations 20 and 19, we can compute A0i and A1i for each pool. Equations 25 and ?? give us then the optimal pool allocation. V. CONCLUSION We have managed to simplify the optimization problem and transport it to EVM like blockchain languages. The solution can scale up to at least ten pools without being too computationally intensive. REFERENCES [1] S. Nakamoto, “Bitcoin: A peer-to-peer electronic cash system,” Decentralized Business Review, p. 21260, 2008. [2] V. Buterin et al., “Ethereum white paper,” GitHub repos- itory, vol. 1, pp. 22–23, 2013. [3] “Aave white paper,” https://github.com/aave/protocol- v2/blob/master/aave-v2-whitepaper.pdf. [4] “Aave documentation,” https://docs.aave.com/portal/.