Skip to content

Commit

Permalink
Merge pull request #100 from aave/feat/99-controller-multi-collector
Browse files Browse the repository at this point in the history
feat: Add ability to specify collector
  • Loading branch information
miguelmtzinf authored Oct 20, 2022
2 parents b0c30d2 + e946268 commit 448f864
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
18 changes: 9 additions & 9 deletions contracts/treasury/CollectorController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,49 @@ import {ICollector} from './interfaces/ICollector.sol';
/**
* @title CollectorController
* @notice The CollectorController contracts allows the owner of the contract
to approve or transfer tokens from the collector proxy contract.
to approve or transfer tokens from the specified collector proxy contract.
The admin of the Collector proxy can't be the same as the fundsAdmin address.
This is needed due the usage of transparent proxy pattern.
* @author Aave
**/
contract CollectorController is Ownable {
ICollector public immutable COLLECTOR;

/**
* @dev Constructor setups the ownership of the contract and the collector proxy
* @dev Constructor setups the ownership of the contract
* @param owner The address of the owner of the CollectorController
* @param collectorProxy The address of the Collector transparent proxy
*/
constructor(address owner, address collectorProxy) {
constructor(address owner) {
transferOwnership(owner);
COLLECTOR = ICollector(collectorProxy);
}

/**
* @dev Transfer an amount of tokens to the recipient.
* @param collector The address of the collector contract
* @param token The address of the asset
* @param recipient The address of the entity to transfer the tokens.
* @param amount The amount to be transferred.
*/
function approve(
address collector,
IERC20 token,
address recipient,
uint256 amount
) external onlyOwner {
COLLECTOR.approve(token, recipient, amount);
ICollector(collector).approve(token, recipient, amount);
}

/**
* @dev Transfer an amount of tokens to the recipient.
* @param collector The address of the collector contract to retrieve funds from (e.g. Aave ecosystem reserve)
* @param token The address of the asset
* @param recipient The address of the entity to transfer the tokens.
* @param amount The amount to be transferred.
*/
function transfer(
address collector,
IERC20 token,
address recipient,
uint256 amount
) external onlyOwner {
COLLECTOR.transfer(token, recipient, amount);
ICollector(collector).transfer(token, recipient, amount);
}
}
39 changes: 21 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aave/periphery-v3",
"version": "1.19.2",
"version": "1.19.2-beta.0",
"description": "Aave Protocol V3 periphery smart contracts",
"files": [
"contracts",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"license": "AGPLv3",
"devDependencies": {
"@aave/deploy-v3": "1.27.0",
"@aave/deploy-v3": "1.27.0-beta.1",
"@ethersproject/abi": "^5.1.0",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.2",
"@nomiclabs/hardhat-ethers": "^2.1.0",
Expand Down Expand Up @@ -89,6 +89,6 @@
"url": "git://github.com/aave/aave-v3-periphery"
},
"dependencies": {
"@aave/core-v3": "^1.14.3-beta.0"
"@aave/core-v3": "1.16.2"
}
}

0 comments on commit 448f864

Please sign in to comment.