forked from bgd-labs/protocol-v3.6-upgrade
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathATokenMainnetInstanceGHO.sol
More file actions
72 lines (59 loc) · 2.69 KB
/
ATokenMainnetInstanceGHO.sol
File metadata and controls
72 lines (59 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import {IPool} from "aave-v3-origin/contracts/interfaces/IPool.sol";
import {ATokenInstance, IInitializableAToken, Errors} from "aave-v3-origin/contracts/instances/ATokenInstance.sol";
import {AaveV3EthereumAssets} from "aave-address-book/AaveV3Ethereum.sol";
import {IGhoToken} from "gho-direct-minter/interfaces/IGhoToken.sol";
import {IATokenMainnetInstanceGHO} from "./interfaces/IATokenMainnetInstanceGHO.sol";
contract ATokenMainnetInstanceGHO is ATokenInstance, IATokenMainnetInstanceGHO {
// These are additional variables that were in the v3.3 AToken for the GHO aToken
// but there is no such variables in all other aTokens in both v3.3 and v3.4
// so we need to clean them in case in future versions of aTokens it will be
// needed to add new storage variables.
// If we don't clean them, then the aToken for the GHO token will have non zero values
// in these new variables that may be added in the future.
address private _deprecated_ghoVariableDebtToken;
address private _deprecated_ghoTreasury;
constructor(IPool pool, address rewardsController, address treasury)
ATokenInstance(pool, rewardsController, treasury)
{}
/// @inheritdoc IInitializableAToken
function initialize(
IPool initializingPool,
address underlyingAsset,
uint8 aTokenDecimals,
string calldata aTokenName,
string calldata aTokenSymbol,
bytes calldata params
) public virtual override initializer {
// @note this is the default initialization function
// the same as the `ATokenInstance.initialize` function
// but contains the additional logic for deleting the deprecated variables
delete _deprecated_ghoVariableDebtToken;
delete _deprecated_ghoTreasury;
require(initializingPool == POOL, Errors.PoolAddressesDoNotMatch());
_setName(aTokenName);
_setSymbol(aTokenSymbol);
_setDecimals(aTokenDecimals);
_underlyingAsset = underlyingAsset;
_domainSeparator = _calculateDomainSeparator();
emit Initialized(
underlyingAsset,
address(POOL),
address(TREASURY),
address(REWARDS_CONTROLLER),
aTokenDecimals,
aTokenName,
aTokenSymbol,
params
);
}
/// @inheritdoc IATokenMainnetInstanceGHO
function resolveFacilitator(uint256 amount) external override onlyPoolAdmin {
// @note This action is needed to remove this aToken from facilitator list.
// In order to do this, a facilitator should have it's bucket level set to 0.
// The facilitator bucket of this token (capacity and level) will be transferred
// to a new `GhoDirectMinter` contract.
IGhoToken(AaveV3EthereumAssets.GHO_UNDERLYING).burn(amount);
}
}