Skip to content

Commit

Permalink
feat: receive Aave parameters in AaveAMO
Browse files Browse the repository at this point in the history
  • Loading branch information
zugdev committed Sep 17, 2024
1 parent e03c3eb commit e24e164
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
47 changes: 37 additions & 10 deletions packages/contracts/src/dollar/amo/AaveAMO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,67 @@ contract AaveAMO is Ownable {
/* ========== STATE VARIABLES ========== */

// Constants
UbiquityAMOMinter private amo_minter;
UbiquityAMOMinter public amo_minter;

// Pools and vaults
IPool private constant aave_pool =
IPool(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);
IPool public immutable aave_pool;

// Reward Tokens
ERC20 private constant AAVE =
ERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9);
ERC20 public immutable AAVE;

IRewardsController private constant AAVERewardsController =
IRewardsController(0x8164Cc65827dcFe994AB23944CBC90e0aa80bFcb);
// Rewards Controller
IRewardsController public AAVERewardsController;

IPoolDataProvider private constant AAVEPoolDataProvider =
IPoolDataProvider(0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3);
// Aave data provider
IPoolDataProvider public immutable AAVEPoolDataProvider;

// Borrowed assets
address[] public aave_borrow_asset_list;
mapping(address => bool) public aave_borrow_asset_check; // Mapping is also used for faster verification

/* ========== CONSTRUCTOR ========== */

constructor(address _owner_address, address _amo_minter_address) {
constructor(
address _owner_address,
address _amo_minter_address,
address _aave_pool,
address _aave,
address _aave_rewards_controller,
address _aave_pool_data_provider
) {
require(_owner_address != address(0), "Owner address cannot be zero");
require(
_amo_minter_address != address(0),
"AMO minter address cannot be zero"
);
require(_aave_pool != address(0), "Aave pool address cannot be zero");
require(_aave != address(0), "AAVE address cannot be zero");
require(
_aave_rewards_controller != address(0),
"AAVE rewards controller address cannot be zero"
);
require(
_aave_pool_data_provider != address(0),
"AAVE pool data provider address cannot be zero"
);

// Set owner
transferOwnership(_owner_address);

// Set AMO minter
amo_minter = UbiquityAMOMinter(_amo_minter_address);

// Set Aave pool
aave_pool = IPool(_aave_pool);

// Set AAVE
AAVE = ERC20(_aave);

// Set AAVE rewards controller
AAVERewardsController = IRewardsController(_aave_rewards_controller);

// Set AAVE pool data provider
AAVEPoolDataProvider = IPoolDataProvider(_aave_pool_data_provider);
}

/* ========== MODIFIERS ========== */
Expand Down
9 changes: 8 additions & 1 deletion packages/contracts/test/amo/UbiquityAMOMinter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ contract UbiquityAMOMinterTest is DiamondTestSetup {
);

// Deploy AaveAMO contract
aaveAMO = new AaveAMO(owner, address(amoMinter));
aaveAMO = new AaveAMO(
owner,
address(amoMinter),
address(1),
address(2),
address(3),
address(4)
);

// Enable AaveAMO as a valid AMO
vm.prank(owner);
Expand Down

0 comments on commit e24e164

Please sign in to comment.