Annex Docs
Search…
ANN Distribution Speeds

ANN Speed

The "ANN speed" unique to each market is an unsigned integer that specifies the amount of ANN that is distributed, per block, to suppliers and borrowers in each market. This number can be changed for individual markets by calling the _setAnnexSpeed method through a successful Annex Governance proposal.
The following is the formula for calculating the rate that ANN is distributed to each supported market.
1
utility = aTokenTotalBorrows * assetPrice
2
3
utilityFraction = utility / sumOfAllAnnexdMarketUtilities
4
5
marketAnnexSpeed = annexRate * utilityFraction
Copied!

ANN Distributed Per Block (All Markets)

The Comptroller contract’s annexRate is an unsigned integer that indicates the rate at which the protocol distributes ANN to markets’ suppliers or borrowers, every Ethereum block. The value is the amount of ANN (in wei), per block, allocated for the markets. Note that not every market has ANN distributed to its participants (see Market Metadata).
The annexRate indicates how much ANN goes to the suppliers or borrowers, so doubling this number shows how much ANN goes to all suppliers and borrowers combined. The code examples implement reading the amount of ANN distributed, per Ethereum block, to all markets.
Comptroller
1
uint public annexRate;
Copied!
Solidity
1
Comptroller troll = Comptroller(0xABCD...);
2
3
// ANN issued per block to suppliers OR borrowers * (1 * 10 ^ 18)
4
uint annexRate = troll.annexRate();
5
6
// Approximate ANN issued per day to suppliers OR borrowers * (1 * 10 ^ 18)
7
uint annexRatePerDay = annexRate * 4 * 60 * 24;
8
9
// Approximate ANN issued per day to suppliers AND borrowers * (1 * 10 ^ 18)
10
uint annexRatePerDayTotal = annexRatePerDay * 2;
Copied!
Web3 1.2.6
1
const comptroller = new web3.eth.Contract(comptrollerAbi, comptrollerAddress);
2
3
let annexRate = await comptroller.methods.annexRate().call();
4
annexRate = annexRate / 1e18;
5
6
// ANN issued to suppliers OR borrowers
7
const annexRatePerDay = annexRate * 4 * 60 * 24;
8
9
// ANN issued to suppliers AND borrowers
10
const annexRatePerDayTotal = annexRatePerDay * 2;
Copied!

ANN Distributed Per Block (Single Market)

The Comptroller contract has a mapping called annexSpeeds. It maps aToken addresses to an integer of each market’s ANN distribution per Ethereum block. The integer indicates the rate at which the protocol distributes ANN to markets’ suppliers or borrowers. The value is the amount of ANN (in wei), per block, allocated for the market. Note that not every market has ANN distributed to its participants (see Market Metadata).
The speed indicates how much ANN goes to the suppliers or the borrowers, so doubling this number shows how much ANN goes to market suppliers and borrowers combined. The code examples implement reading the amount of ANN distributed, per Ethereum block, to a single market.
Comptroller
1
mapping(address => uint) public annexSpeeds;
Copied!
Solidity
1
Comptroller troll = Comptroller(0x123...);
2
address aToken = 0xabc...;
3
4
// ANN issued per block to suppliers OR borrowers * (1 * 10 ^ 18)
5
uint annexSpeed = troll.annexSpeeds(aToken);
6
7
// Approximate ANN issued per day to suppliers OR borrowers * (1 * 10 ^ 18)
8
uint annexSpeedPerDay = annexSpeed * 4 * 60 * 24;
9
10
// Approximate ANN issued per day to suppliers AND borrowers * (1 * 10 ^ 18)
11
uint annexSpeedPerDayTotal = annexSpeedPerDay * 2;
Copied!
Web3 1.2.6
1
const aTokenAddress = '0xabc...';
2
3
const comptroller = new web3.eth.Contract(comptrollerAbi, comptrollerAddress);
4
5
let annexSpeed = await comptroller.methods.annexSpeeds(aTokenAddress).call();
6
annexSpeed = annexSpeed / 1e18;
7
8
// ANN issued to suppliers OR borrowers
9
const annexSpeedPerDay = annexSpeed * 4 * 60 * 24;
10
11
// ANN issued to suppliers AND borrowers
12
const annexSpeedPerDayTotal = annexSpeedPerDay * 2;
Copied!
Last modified 4mo ago