Skip to content

RideSolo/AaveBalancerAggregator

Repository files navigation

Aave Balancer Aggregator

Description

The developed BalancerAggregator contract automatically compute the weighted average price of a Balancer pool token following the balances of the tokens listed in the pool. Please note that the same formula is used in exitPool to compute the exit value for each token listed in the balancer pool.

BalancerAggregator contract has to be used as a source for the pool token when setting up the ChainlinkProxyPriceProvider, the required chainlink feed sources must be set in BalancerAggregator.

-----------------------------                                    --------------------           /== latestAnswer ==> ChainLinkAggregator 1   
|ChainlinkProxyPriceProvider|==== latestAnswer =================>|BalancerAggregator|===========|== latestAnswer ==> ChainLinkAggregator 2   
-----------------------------                                    --------------------           \== latestAnswer ==> ChainLinkAggregator 3   
			||                     -------------                   ||
			=== getAssetPrice == > |PriceOracle| <== getAssetPrice===
                                               -------------

The implemented contract act as a middle aggregator between Aave and ChainLink feeds. BalancerAggregator uses the fallback price oracle managed by the Aave to get the token prices if the ChainLinks feeds return zero.

If a chainlink feed returns zero and the Aave managed price oracle returns zero for the same asset the BalancerAggregator for a specific balancer pool will return zero, even if all other tokens are set correctly. In the previous case ChainlinkProxyPriceProvider has to fallback to the managed price oracle to get the price of the pool token.

The implemented test shows the different deployment steps, the error cases and fallback cases to Aave price oracle.

Setup

Dependencies

  • node v10.20.1
  • npm 6.14.4
  • truffle

Installation

$ git clone https://github.com/ridesolo/AaveBalancerAggregator.git
$ cd AaveBalancerAggregator
$ npm install

Coverage Test

$ npm run test-coverage

coverage printout

Verification

$ npm run compile
$ npm run test 

Important Code

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published