Skip to content

Commit

Permalink
Merge pull request #2 from bgd-labs/feat/stable-rate-removal
Browse files Browse the repository at this point in the history
Stable rate removal
  • Loading branch information
sakulstra authored Sep 19, 2024
2 parents 55c9bc9 + 0645793 commit dd50736
Show file tree
Hide file tree
Showing 113 changed files with 2,485 additions and 5,073 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${a
git-diff :
@mkdir -p diffs
@npx prettier ${before} ${after} --write
@printf '%s\n%s\n%s\n' "\`\`\`diff" "$$(git diff --no-index --diff-algorithm=patience --ignore-space-at-eol ${before} ${after})" "\`\`\`" > diffs/${out}.md
@printf '%s\n%s\n%s\n' "\`\`\`diff" "$$(git diff --no-index --ignore-space-at-eol ${before} ${after})" "\`\`\`" > diffs/${out}.md

2 changes: 0 additions & 2 deletions certora/conf/NEW-pool-no-summarizations.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"files": [
"certora/harness/ATokenHarness.sol",
"certora/harness/PoolHarness.sol",
"certora/harness/StableDebtTokenHarness.sol",
"certora/harness/SimpleERC20.sol",
"src/contracts/instances/VariableDebtTokenInstance.sol",
"src/contracts/helpers/AaveProtocolDataProvider.sol",
Expand All @@ -20,7 +19,6 @@
],
"struct_link": [
"PoolHarness:aTokenAddress=ATokenHarness",
"PoolHarness:stableDebtTokenAddress=StableDebtTokenHarness",
"PoolHarness:variableDebtTokenAddress=VariableDebtTokenInstance",
"PoolHarness:interestRateStrategyAddress=DefaultReserveInterestRateStrategyV2",
],
Expand Down
2 changes: 0 additions & 2 deletions certora/conf/NEW-pool-simple-properties.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"files": [
"certora/harness/ATokenHarness.sol",
"certora/harness/PoolHarness.sol",
"certora/harness/StableDebtTokenHarness.sol",
"certora/harness/SimpleERC20.sol",
"src/contracts/instances/VariableDebtTokenInstance.sol",
"src/contracts/helpers/AaveProtocolDataProvider.sol",
Expand All @@ -17,7 +16,6 @@
],
"struct_link": [
"PoolHarness:aTokenAddress=ATokenHarness",
"PoolHarness:stableDebtTokenAddress=StableDebtTokenHarness",
"PoolHarness:variableDebtTokenAddress=VariableDebtTokenInstance",
"PoolHarness:interestRateStrategyAddress=DefaultReserveInterestRateStrategyV2",
],
Expand Down
19 changes: 0 additions & 19 deletions certora/conf/StableDebtToken.conf

This file was deleted.

7 changes: 1 addition & 6 deletions certora/harness/PoolHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ contract PoolHarness is PoolInstance {

function getTotalDebt(address asset) public view returns (uint256) {
uint256 totalVariable = IERC20(_reserves[asset].variableDebtTokenAddress).totalSupply();
uint256 totalStable = IERC20(_reserves[asset].stableDebtTokenAddress).totalSupply();
return totalVariable + totalStable;
return totalVariable;
}

function getTotalATokenSupply(address asset) public view returns (uint256) {
Expand All @@ -35,10 +34,6 @@ contract PoolHarness is PoolInstance {
return _reserves[asset].liquidityIndex;
}

function getReserveStableBorrowRate(address asset) public view returns (uint256) {
return _reserves[asset].currentStableBorrowRate;
}

function getReserveVariableBorrowIndex(address asset) public view returns (uint256) {
return _reserves[asset].variableBorrowIndex;
}
Expand Down
20 changes: 2 additions & 18 deletions certora/harness/ReserveConfigurationHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,6 @@ contract ReserveConfigurationHarness {
return ReserveConfiguration.getBorrowingEnabled(reservesConfig);
}

// Enables or disables stable rate borrowing on the reserve
function setStableRateBorrowingEnabled(bool enabled) public {
DataTypes.ReserveConfigurationMap memory configNew = reservesConfig;
ReserveConfiguration.setStableRateBorrowingEnabled(configNew, enabled);
reservesConfig.data = configNew.data;
}

// Gets the stable rate borrowing state of the reserve
function getStableRateBorrowingEnabled() public view returns (bool) {
return ReserveConfiguration.getStableRateBorrowingEnabled(reservesConfig);
}

// Sets the reserve factor of the reserve
function setReserveFactor(uint256 reserveFactor) public {
DataTypes.ReserveConfigurationMap memory configNew = reservesConfig;
Expand Down Expand Up @@ -302,16 +290,14 @@ contract ReserveConfigurationHarness {

// Executes a setter of a bool parameter according to the given id
function executeBoolSetterById(uint256 id, bool val) public {
require(id >= 0 && id <= 5);
require(id >= 0 && id <= 4);
if (id == 0) {
setActive(val);
} else if (id == 1) {
setFrozen(val);
} else if (id == 2) {
setBorrowingEnabled(val);
} else if (id == 3) {
setStableRateBorrowingEnabled(val);
} else if (id == 4) {
setPaused(val);
} else {
setBorrowableInIsolation(val);
Expand All @@ -320,16 +306,14 @@ contract ReserveConfigurationHarness {

// Executes a getter of a bool parameter according to the given id
function executeBoolGetterById(uint256 id) public view returns (bool) {
require(id >= 0 && id <= 5);
require(id >= 0 && id <= 4);
if (id == 0) {
return getActive();
} else if (id == 1) {
return getFrozen();
} else if (id == 2) {
return getBorrowingEnabled();
} else if (id == 3) {
return getStableRateBorrowingEnabled();
} else if (id == 4) {
return getPaused();
} else {
return getBorrowableInIsolation();
Expand Down
18 changes: 0 additions & 18 deletions certora/harness/StableDebtTokenHarness.sol

This file was deleted.

5 changes: 0 additions & 5 deletions certora/specs/NEW-pool-base.spec
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ methods {
function _.getACLManager() external => DISPATCHER(true);
//function _.isBridge(address) external => DISPATCHER(true);

// StableDebt
function _.mint(address user, address onBehalfOf, uint256 amount, uint256 rate) external => DISPATCHER(true);
function _.burn(address user, uint256 amount) external => DISPATCHER(true);
function _.getSupplyData() external => DISPATCHER(true);

// variableDebt
function _.burn(address user, uint256 amount, uint256 index) external => DISPATCHER(true);

Expand Down
6 changes: 2 additions & 4 deletions certora/specs/NEW-pool-no-summarizations.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ methods {

// function _.executeOperation(address[] a, uint256[]b, uint256[]c, address d, bytes e) external => DISPATCHER(true);

function _.getAverageStableRate() external => DISPATCHER(true);
function _.isPoolAdmin(address a) external => DISPATCHER(true);
function _.getConfiguration(address a) external => DISPATCHER(true);

Expand All @@ -37,11 +36,10 @@ function ghostUpdate() returns bool {
}
function calculateInterestRatesMock(DataTypes.CalculateInterestRatesParams params) returns (uint256, uint256, uint256) {
function calculateInterestRatesMock(DataTypes.CalculateInterestRatesParams params) returns (uint256, uint256) {
uint256 liquidityRate = 1;
uint256 stableBorrowRate = 1;
uint256 variableBorrowRate = 1;
return (liquidityRate, stableBorrowRate, variableBorrowRate);
return (liquidityRate, variableBorrowRate);
}
Expand Down
8 changes: 0 additions & 8 deletions certora/specs/ReserveConfiguration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ methods {
function getSiloedBorrowing() external returns (bool) envfree;
function setBorrowingEnabled(bool) external envfree;
function getBorrowingEnabled() external returns (bool) envfree;
function setStableRateBorrowingEnabled(bool) external envfree;
function getStableRateBorrowingEnabled() external returns (bool) envfree;
function setReserveFactor(uint256) external envfree;
function getReserveFactor() external returns (uint256) envfree;
function setBorrowCap(uint256) external envfree;
Expand Down Expand Up @@ -104,12 +102,6 @@ rule setBorrowingEnabledIntegrity(bool enabled) {
assert getBorrowingEnabled() == enabled;
}

// checks the integrity of set StableRateBorrowingEnabled function and correct retrieval of the corresponding getter.
rule setStableRateBorrowingEnabledIntegrity(bool enabled) {
setStableRateBorrowingEnabled(enabled);
assert getStableRateBorrowingEnabled() == enabled;
}

// checks the integrity of set ReserveFactor function and correct retrieval of the corresponding getter.
rule setReserveFactorIntegrity(uint256 reserveFactor) {
setReserveFactor(reserveFactor);
Expand Down
Loading

0 comments on commit dd50736

Please sign in to comment.