mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: borrowCap from 32 bits (4 billion max cap) to 48 bits (280 trilly)
This commit is contained in:
parent
08e14b7565
commit
c907d15e22
|
@ -19,7 +19,7 @@ library ReserveConfiguration {
|
|||
uint256 constant BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFF; // prettier-ignore
|
||||
uint256 constant STABLE_BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFF; // prettier-ignore
|
||||
uint256 constant RESERVE_FACTOR_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF; // prettier-ignore
|
||||
uint256 constant BORROW_CAP_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFF; // prettier-ignore
|
||||
uint256 constant BORROW_CAP_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFF; // prettier-ignore
|
||||
|
||||
/// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed
|
||||
uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16;
|
||||
|
@ -37,7 +37,7 @@ library ReserveConfiguration {
|
|||
uint256 constant MAX_VALID_LIQUIDATION_BONUS = 65535;
|
||||
uint256 constant MAX_VALID_DECIMALS = 255;
|
||||
uint256 constant MAX_VALID_RESERVE_FACTOR = 65535;
|
||||
uint256 constant MAX_VALID_BORROW_CAP = 4294967295;
|
||||
uint256 constant MAX_VALID_BORROW_CAP = 281474976710655;
|
||||
|
||||
/**
|
||||
* @dev Sets the Loan to Value of the reserve
|
||||
|
|
|
@ -38,7 +38,7 @@ library DataTypes {
|
|||
//bit 59: stable rate borrowing enabled
|
||||
//bit 60-63: reserved
|
||||
//bit 64-79: reserve factor
|
||||
//bit 80-111 borrow cap
|
||||
//bit 80-127 borrow cap
|
||||
uint256 data;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ export const oneEther = new BigNumber(Math.pow(10, 18));
|
|||
export const oneRay = new BigNumber(Math.pow(10, 27));
|
||||
export const MAX_UINT_AMOUNT =
|
||||
'115792089237316195423570985008687907853269984665640564039457584007913129639935';
|
||||
export const MAX_BORROW_CAP = '4294967295';
|
||||
export const MAX_BORROW_CAP = '281474976710655';
|
||||
export const ONE_YEAR = '31536000';
|
||||
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||
export const ONE_ADDRESS = '0x0000000000000000000000000000000000000001';
|
||||
|
|
|
@ -3,6 +3,7 @@ import { APPROVAL_AMOUNT_LENDING_POOL, MAX_UINT_AMOUNT, RAY, MAX_BORROW_CAP } fr
|
|||
import { convertToCurrencyDecimals } from '../../helpers/contracts-helpers';
|
||||
import { ProtocolErrors } from '../../helpers/types';
|
||||
import { strategyWETH } from '../../markets/aave/reservesConfigs';
|
||||
import { BigNumber } from '@ethersproject/bignumber';
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
|
@ -398,7 +399,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
|
|||
it('Fails to change to too high borrowCap', async () => {
|
||||
const { configurator, users, weth } = testEnv;
|
||||
await expect(
|
||||
configurator.setBorrowCap(weth.address, '4294967296'),
|
||||
configurator.setBorrowCap(weth.address, BigNumber.from(MAX_BORROW_CAP).add(1)),
|
||||
CALLER_NOT_POOL_ADMIN
|
||||
).to.be.revertedWith(RC_INVALID_BORROW_CAP);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user