-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/101-add-supply-function
- Loading branch information
Showing
42 changed files
with
1,634 additions
and
1,183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: release-please | |
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,3 @@ coverage | |
.coverage_cache | ||
.coverage_contracts | ||
coverage.json | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: agpl-3.0 | ||
pragma solidity 0.8.7; | ||
|
||
import {RateOracle} from '../mocks/oracle/RateOracle.sol'; | ||
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol'; | ||
|
||
/** | ||
* @title RateOracleSetupHelper | ||
* @author Aave | ||
* @notice Deployment helper to setup initial borrow rates of multiple assets in one transaction. | ||
* @dev The RateOracle owner must transfer the ownership to RateOracleSetupHelper before calling to setOracleBorrowRates. | ||
* @dev The RateOracleSetupHelper is an Ownable contract, so only the deployer or future owners can call this contract. | ||
*/ | ||
contract RateOracleSetupHelper is Ownable { | ||
|
||
/** | ||
* @notice External function called by the owner account to set the initial borrow rates of the assets | ||
* @param assets The addresses of the assets | ||
* @param rates The interest rates of each asset | ||
* @param oracle The address of the RateOracle contract | ||
*/ | ||
function setOracleBorrowRates( | ||
address[] calldata assets, | ||
uint256[] calldata rates, | ||
address oracle | ||
) external onlyOwner { | ||
require(assets.length == rates.length, 'Arrays not same length'); | ||
|
||
for (uint256 i = 0; i < assets.length; i++) { | ||
// RateOracle owner must be this contract | ||
RateOracle(oracle).setMarketBorrowRate(assets[i], rates[i]); | ||
} | ||
} | ||
|
||
/** | ||
* @notice External function called by the deployer account to give ownership of the RateOracle back to the corresponding owner address. | ||
* @param oracle The address of the RateOracle contract | ||
* @param admin The corresponding owner address | ||
*/ | ||
function setOracleOwnership(address oracle, address admin) external onlyOwner { | ||
require(admin != address(0), 'owner can not be zero'); | ||
require(RateOracle(oracle).owner() == address(this), 'helper is not owner'); | ||
RateOracle(oracle).transferOwnership(admin); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-License-Identifier: agpl-3.0 | ||
pragma solidity 0.8.7; | ||
|
||
import {PoolConfigurator} from '../protocol/pool/PoolConfigurator.sol'; | ||
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol'; | ||
|
||
/** | ||
* @title ReservesSetupHelper | ||
* @author Aave | ||
* @notice Deployment helper to setup the assets risk parameters at PoolConfigurator in batch. | ||
* @dev The Pool admin or risk admin must transfer the ownership to ReservesSetupHelper before calling to setOracleBorrowRates. | ||
* @dev The ReservesSetupHelper is an Ownable contract, so only the deployer or future owners can call this contract. | ||
*/ | ||
contract ReservesSetupHelper is Ownable { | ||
struct ConfigureReserveInput { | ||
address asset; | ||
uint256 baseLTV; | ||
uint256 liquidationThreshold; | ||
uint256 liquidationBonus; | ||
uint256 reserveFactor; | ||
uint256 borrowCap; | ||
uint256 supplyCap; | ||
bool stableBorrowingEnabled; | ||
bool borrowingEnabled; | ||
} | ||
|
||
/** | ||
* @notice External function called by the owner account to setup the assets risk parameters in batch. | ||
* @param configurator The address of PoolConfigurator contract | ||
* @param inputParams An array of ConfigureReserveInput struct that contains the assets and their risk parameters | ||
*/ | ||
function configureReserves( | ||
PoolConfigurator configurator, | ||
ConfigureReserveInput[] calldata inputParams | ||
) external onlyOwner { | ||
for (uint256 i = 0; i < inputParams.length; i++) { | ||
configurator.configureReserveAsCollateral( | ||
inputParams[i].asset, | ||
inputParams[i].baseLTV, | ||
inputParams[i].liquidationThreshold, | ||
inputParams[i].liquidationBonus | ||
); | ||
|
||
if (inputParams[i].borrowingEnabled) { | ||
configurator.enableBorrowingOnReserve( | ||
inputParams[i].asset, | ||
inputParams[i].borrowCap, | ||
inputParams[i].stableBorrowingEnabled | ||
); | ||
} | ||
configurator.setSupplyCap(inputParams[i].asset, inputParams[i].supplyCap); | ||
configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.