@pendle/core-v2 6.9.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/interfaces/IPPTLooper.sol/IPPTLooper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPTLooper.sol/IPPTLooper.json +244 -249
- package/build/artifacts/contracts/interfaces/IPPTLooper.sol/IPPTLooperEIP712Types.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/PTLooperBase.sol/PTLooperBase.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/PTLooperBase.sol/PTLooperBase.json +244 -249
- package/build/artifacts/contracts/pt-looping/PTLooperEIP712TypesEncodeDataLib.sol/PTLooperEIP712TypesEncodeDataLib.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/PTLooperEIP712TypesEncodeDataLib.sol/PTLooperEIP712TypesEncodeDataLib.json +2 -2
- package/build/artifacts/contracts/pt-looping/PendlePTLooper.sol/PendlePTLooper.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/PendlePTLooper.sol/PendlePTLooper.json +246 -251
- package/build/artifacts/contracts/pt-looping/money-market/BaseMoneyMarket.sol/BaseMoneyMarket.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/money-market/BaseMoneyMarketView.sol/BaseMoneyMarketView.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave/AaveMoneyMarket.sol/AaveMoneyMarket.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave/AaveMoneyMarket.sol/AaveMoneyMarket.json +2 -2
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave/AaveMoneyMarketView.sol/AaveMoneyMarketView.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave/AaveMoneyMarketView.sol/AaveMoneyMarketView.json +2 -2
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MMPayloadLib.sol/AaveV4MMPayloadLib.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MMPayloadLib.sol/AaveV4MMPayloadLib.json +10 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MoneyMarket.sol/AaveV4MoneyMarket.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MoneyMarket.sol/AaveV4MoneyMarket.json +615 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MoneyMarketView.sol/AaveV4MoneyMarketView.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MoneyMarketView.sol/AaveV4MoneyMarketView.json +280 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/IAaveOracle.sol/IAaveOracle.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/IAaveOracle.sol/IAaveOracle.json +30 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/IHubBase.sol/IHubBase.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/IHubBase.sol/IHubBase.json +322 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/ISpoke.sol/ISpoke.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/ISpoke.sol/ISpoke.json +398 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/EulerMMPayloadLib.sol/EulerMMPayloadLib.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/EulerMMPayloadLib.sol/EulerMMPayloadLib.json +10 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/EulerMoneyMarket.sol/EulerMoneyMarket.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/EulerMoneyMarket.sol/EulerMoneyMarket.json +651 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/EulerMoneyMarketView.sol/EulerMoneyMarketView.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/EulerMoneyMarketView.sol/EulerMoneyMarketView.json +298 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEthereumVaultConnector.sol/IEVC.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEthereumVaultConnector.sol/IEVC.json +959 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerFactory.sol/IEulerFactory.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerFactory.sol/IEulerFactory.json +30 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerPriceOracle.sol/IEulerPriceOracle.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerPriceOracle.sol/IEulerPriceOracle.json +53 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerVault.sol/AmountCapLib.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerVault.sol/AmountCapLib.json +10 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerVault.sol/IEulerVault.dbg.json +4 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerVault.sol/IEulerVault.json +933 -0
- package/build/artifacts/contracts/pt-looping/money-market/implementations/morpho/MorphoBlueMoneyMarket.sol/MorphoBlueMoneyMarket.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/money-market/implementations/morpho/MorphoBlueMoneyMarket.sol/MorphoBlueMoneyMarket.json +2 -2
- package/build/artifacts/contracts/pt-looping/money-market/implementations/morpho/MorphoBlueMoneyMarketView.sol/MorphoBlueMoneyMarketView.dbg.json +1 -1
- package/build/artifacts/contracts/pt-looping/money-market/implementations/morpho/MorphoBlueMoneyMarketView.sol/MorphoBlueMoneyMarketView.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/IOKXDexRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/OKXScaleHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IKyberScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.json +2 -2
- package/contracts/interfaces/IPPTLooper.sol +2 -4
- package/contracts/pt-looping/PTLooperEIP712TypesEncodeDataLib.sol +6 -6
- package/contracts/pt-looping/PendlePTLooper.sol +4 -2
- package/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MMPayloadLib.sol +20 -0
- package/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MoneyMarket.sol +85 -0
- package/contracts/pt-looping/money-market/implementations/aave-v4/AaveV4MoneyMarketView.sol +180 -0
- package/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/IAaveOracle.sol +12 -0
- package/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/IHubBase.sol +72 -0
- package/contracts/pt-looping/money-market/implementations/aave-v4/dependencies/ISpoke.sol +88 -0
- package/contracts/pt-looping/money-market/implementations/euler/EulerMMPayloadLib.sol +25 -0
- package/contracts/pt-looping/money-market/implementations/euler/EulerMoneyMarket.sol +104 -0
- package/contracts/pt-looping/money-market/implementations/euler/EulerMoneyMarketView.sol +105 -0
- package/contracts/pt-looping/money-market/implementations/euler/dependencies/IEthereumVaultConnector.sol +432 -0
- package/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerFactory.sol +10 -0
- package/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerPriceOracle.sol +26 -0
- package/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerVault.sol +149 -0
- package/contracts/router/swap-aggregator/OKXScaleHelper.sol +3 -0
- package/deployments/143-core.json +4 -1
- package/deployments/42161-core.json +4 -1
- package/deployments/4663-core.json +48 -0
- package/deployments/4663-offchain-helper.json +12 -0
- package/package.json +1 -1
- package/typechain-types/AaveV4MoneyMarket.ts +573 -0
- package/typechain-types/AaveV4MoneyMarketView.ts +362 -0
- package/typechain-types/EulerMoneyMarket.ts +599 -0
- package/typechain-types/EulerMoneyMarketView.ts +375 -0
- package/typechain-types/IAaveOracle.ts +17 -149
- package/typechain-types/IEVC.ts +1647 -0
- package/typechain-types/IEulerFactory.ts +94 -0
- package/typechain-types/IEulerPriceOracle.ts +123 -0
- package/typechain-types/IEulerVault.ts +1298 -0
- package/typechain-types/IHubBase.ts +452 -0
- package/typechain-types/IPPTLooper.ts +68 -68
- package/typechain-types/ISpoke.ts +577 -0
- package/typechain-types/PTLooperBase.ts +68 -68
- package/typechain-types/PendlePTLooper.ts +68 -68
- package/typechain-types/factories/AaveMoneyMarketView__factory.ts +1 -1
- package/typechain-types/factories/AaveMoneyMarket__factory.ts +1 -1
- package/typechain-types/factories/AaveV4MoneyMarketView__factory.ts +349 -0
- package/typechain-types/factories/AaveV4MoneyMarket__factory.ts +673 -0
- package/typechain-types/factories/EulerMoneyMarketView__factory.ts +371 -0
- package/typechain-types/factories/EulerMoneyMarket__factory.ts +720 -0
- package/typechain-types/factories/IAaveOracle__factory.ts +3 -93
- package/typechain-types/factories/IEVC__factory.ts +968 -0
- package/typechain-types/factories/IEulerFactory__factory.ts +42 -0
- package/typechain-types/factories/IEulerPriceOracle__factory.ts +68 -0
- package/typechain-types/factories/IEulerVault__factory.ts +945 -0
- package/typechain-types/factories/IHubBase__factory.ts +334 -0
- package/typechain-types/factories/IPPTLooper__factory.ts +243 -248
- package/typechain-types/factories/ISpoke__factory.ts +407 -0
- package/typechain-types/factories/MorphoBlueMoneyMarketView__factory.ts +1 -1
- package/typechain-types/factories/MorphoBlueMoneyMarket__factory.ts +1 -1
- package/typechain-types/factories/PTLooperBase__factory.ts +243 -248
- package/typechain-types/factories/PendlePTLooper__factory.ts +244 -249
- package/typechain-types/factories/PendleSwap__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +99 -0
- package/typechain-types/index.ts +22 -2
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.8.0;
|
|
4
|
+
|
|
5
|
+
// https://github.com/euler-xyz/ethereum-vault-connector/blob/b9d557a8ebcd3db1fbeef4aa60282aa4059a7bbf/src/interfaces/IEthereumVaultConnector.sol#L9
|
|
6
|
+
|
|
7
|
+
/// @title IEVC
|
|
8
|
+
/// @custom:security-contact security@euler.xyz
|
|
9
|
+
/// @author Euler Labs (https://www.eulerlabs.com/)
|
|
10
|
+
/// @notice This interface defines the methods for the Ethereum Vault Connector.
|
|
11
|
+
interface IEVC {
|
|
12
|
+
/// @notice A struct representing a batch item.
|
|
13
|
+
/// @dev Each batch item represents a single operation to be performed within a checks deferred context.
|
|
14
|
+
struct BatchItem {
|
|
15
|
+
/// @notice The target contract to be called.
|
|
16
|
+
address targetContract;
|
|
17
|
+
/// @notice The account on behalf of which the operation is to be performed. msg.sender must be authorized to
|
|
18
|
+
/// act on behalf of this account. Must be address(0) if the target contract is the EVC itself.
|
|
19
|
+
address onBehalfOfAccount;
|
|
20
|
+
/// @notice The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole
|
|
21
|
+
/// balance of the EVC contract will be forwarded. Must be 0 if the target contract is the EVC itself.
|
|
22
|
+
uint256 value;
|
|
23
|
+
/// @notice The encoded data which is called on the target contract.
|
|
24
|
+
bytes data;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// @notice A struct representing the result of a batch item operation.
|
|
28
|
+
/// @dev Used only for simulation purposes.
|
|
29
|
+
struct BatchItemResult {
|
|
30
|
+
/// @notice A boolean indicating whether the operation was successful.
|
|
31
|
+
bool success;
|
|
32
|
+
/// @notice The result of the operation.
|
|
33
|
+
bytes result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// @notice A struct representing the result of the account or vault status check.
|
|
37
|
+
/// @dev Used only for simulation purposes.
|
|
38
|
+
struct StatusCheckResult {
|
|
39
|
+
/// @notice The address of the account or vault for which the check was performed.
|
|
40
|
+
address checkedAddress;
|
|
41
|
+
/// @notice A boolean indicating whether the status of the account or vault is valid.
|
|
42
|
+
bool isValid;
|
|
43
|
+
/// @notice The result of the check.
|
|
44
|
+
bytes result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// @notice Returns current raw execution context.
|
|
48
|
+
/// @dev When checks in progress, on behalf of account is always address(0).
|
|
49
|
+
/// @return context Current raw execution context.
|
|
50
|
+
function getRawExecutionContext() external view returns (uint256 context);
|
|
51
|
+
|
|
52
|
+
/// @notice Returns an account on behalf of which the operation is being executed at the moment and whether the
|
|
53
|
+
/// controllerToCheck is an enabled controller for that account.
|
|
54
|
+
/// @dev This function should only be used by external smart contracts if msg.sender is the EVC. Otherwise, the
|
|
55
|
+
/// account address returned must not be trusted.
|
|
56
|
+
/// @dev When checks in progress, on behalf of account is always address(0). When address is zero, the function
|
|
57
|
+
/// reverts to protect the consumer from ever relying on the on behalf of account address which is in its default
|
|
58
|
+
/// state.
|
|
59
|
+
/// @param controllerToCheck The address of the controller for which it is checked whether it is an enabled
|
|
60
|
+
/// controller for the account on behalf of which the operation is being executed at the moment.
|
|
61
|
+
/// @return onBehalfOfAccount An account that has been authenticated and on behalf of which the operation is being
|
|
62
|
+
/// executed at the moment.
|
|
63
|
+
/// @return controllerEnabled A boolean value that indicates whether controllerToCheck is an enabled controller for
|
|
64
|
+
/// the account on behalf of which the operation is being executed at the moment. Always false if controllerToCheck
|
|
65
|
+
/// is address(0).
|
|
66
|
+
function getCurrentOnBehalfOfAccount(address controllerToCheck)
|
|
67
|
+
external
|
|
68
|
+
view
|
|
69
|
+
returns (address onBehalfOfAccount, bool controllerEnabled);
|
|
70
|
+
|
|
71
|
+
/// @notice Checks if checks are deferred.
|
|
72
|
+
/// @return A boolean indicating whether checks are deferred.
|
|
73
|
+
function areChecksDeferred() external view returns (bool);
|
|
74
|
+
|
|
75
|
+
/// @notice Checks if checks are in progress.
|
|
76
|
+
/// @return A boolean indicating whether checks are in progress.
|
|
77
|
+
function areChecksInProgress() external view returns (bool);
|
|
78
|
+
|
|
79
|
+
/// @notice Checks if control collateral is in progress.
|
|
80
|
+
/// @return A boolean indicating whether control collateral is in progress.
|
|
81
|
+
function isControlCollateralInProgress() external view returns (bool);
|
|
82
|
+
|
|
83
|
+
/// @notice Checks if an operator is authenticated.
|
|
84
|
+
/// @return A boolean indicating whether an operator is authenticated.
|
|
85
|
+
function isOperatorAuthenticated() external view returns (bool);
|
|
86
|
+
|
|
87
|
+
/// @notice Checks if a simulation is in progress.
|
|
88
|
+
/// @return A boolean indicating whether a simulation is in progress.
|
|
89
|
+
function isSimulationInProgress() external view returns (bool);
|
|
90
|
+
|
|
91
|
+
/// @notice Checks whether the specified account and the other account have the same owner.
|
|
92
|
+
/// @dev The function is used to check whether one account is authorized to perform operations on behalf of the
|
|
93
|
+
/// other. Accounts are considered to have a common owner if they share the first 19 bytes of their address.
|
|
94
|
+
/// @param account The address of the account that is being checked.
|
|
95
|
+
/// @param otherAccount The address of the other account that is being checked.
|
|
96
|
+
/// @return A boolean flag that indicates whether the accounts have the same owner.
|
|
97
|
+
function haveCommonOwner(address account, address otherAccount) external pure returns (bool);
|
|
98
|
+
|
|
99
|
+
/// @notice Returns the address prefix of the specified account.
|
|
100
|
+
/// @dev The address prefix is the first 19 bytes of the account address.
|
|
101
|
+
/// @param account The address of the account whose address prefix is being retrieved.
|
|
102
|
+
/// @return A bytes19 value that represents the address prefix of the account.
|
|
103
|
+
function getAddressPrefix(address account) external pure returns (bytes19);
|
|
104
|
+
|
|
105
|
+
/// @notice Returns the owner for the specified account.
|
|
106
|
+
/// @dev The function returns address(0) if the owner is not registered. Registration of the owner happens on the
|
|
107
|
+
/// initial
|
|
108
|
+
/// interaction with the EVC that requires authentication of an owner.
|
|
109
|
+
/// @param account The address of the account whose owner is being retrieved.
|
|
110
|
+
/// @return owner The address of the account owner. An account owner is an EOA/smart contract which address matches
|
|
111
|
+
/// the first 19 bytes of the account address.
|
|
112
|
+
function getAccountOwner(address account) external view returns (address);
|
|
113
|
+
|
|
114
|
+
/// @notice Checks if lockdown mode is enabled for a given address prefix.
|
|
115
|
+
/// @param addressPrefix The address prefix to check for lockdown mode status.
|
|
116
|
+
/// @return A boolean indicating whether lockdown mode is enabled.
|
|
117
|
+
function isLockdownMode(bytes19 addressPrefix) external view returns (bool);
|
|
118
|
+
|
|
119
|
+
/// @notice Checks if permit functionality is disabled for a given address prefix.
|
|
120
|
+
/// @param addressPrefix The address prefix to check for permit functionality status.
|
|
121
|
+
/// @return A boolean indicating whether permit functionality is disabled.
|
|
122
|
+
function isPermitDisabledMode(bytes19 addressPrefix) external view returns (bool);
|
|
123
|
+
|
|
124
|
+
/// @notice Returns the current nonce for a given address prefix and nonce namespace.
|
|
125
|
+
/// @dev Each nonce namespace provides 256 bit nonce that has to be used sequentially. There's no requirement to use
|
|
126
|
+
/// all the nonces for a given nonce namespace before moving to the next one which allows to use permit messages in
|
|
127
|
+
/// a non-sequential manner.
|
|
128
|
+
/// @param addressPrefix The address prefix for which the nonce is being retrieved.
|
|
129
|
+
/// @param nonceNamespace The nonce namespace for which the nonce is being retrieved.
|
|
130
|
+
/// @return nonce The current nonce for the given address prefix and nonce namespace.
|
|
131
|
+
function getNonce(bytes19 addressPrefix, uint256 nonceNamespace) external view returns (uint256 nonce);
|
|
132
|
+
|
|
133
|
+
/// @notice Returns the bit field for a given address prefix and operator.
|
|
134
|
+
/// @dev The bit field is used to store information about authorized operators for a given address prefix. Each bit
|
|
135
|
+
/// in the bit field corresponds to one account belonging to the same owner. If the bit is set, the operator is
|
|
136
|
+
/// authorized for the account.
|
|
137
|
+
/// @param addressPrefix The address prefix for which the bit field is being retrieved.
|
|
138
|
+
/// @param operator The address of the operator for which the bit field is being retrieved.
|
|
139
|
+
/// @return operatorBitField The bit field for the given address prefix and operator. The bit field defines which
|
|
140
|
+
/// accounts the operator is authorized for. It is a 256-position binary array like 0...010...0, marking the account
|
|
141
|
+
/// positionally in a uint256. The position in the bit field corresponds to the account ID (0-255), where 0 is the
|
|
142
|
+
/// owner account's ID.
|
|
143
|
+
function getOperator(bytes19 addressPrefix, address operator) external view returns (uint256 operatorBitField);
|
|
144
|
+
|
|
145
|
+
/// @notice Returns whether a given operator has been authorized for a given account.
|
|
146
|
+
/// @param account The address of the account whose operator is being checked.
|
|
147
|
+
/// @param operator The address of the operator that is being checked.
|
|
148
|
+
/// @return authorized A boolean value that indicates whether the operator is authorized for the account.
|
|
149
|
+
function isAccountOperatorAuthorized(address account, address operator) external view returns (bool authorized);
|
|
150
|
+
|
|
151
|
+
/// @notice Enables or disables lockdown mode for a given address prefix.
|
|
152
|
+
/// @dev This function can only be called by the owner of the address prefix. To disable this mode, the EVC
|
|
153
|
+
/// must be called directly. It is not possible to disable this mode by using checks-deferrable call or
|
|
154
|
+
/// permit message.
|
|
155
|
+
/// @param addressPrefix The address prefix for which the lockdown mode is being set.
|
|
156
|
+
/// @param enabled A boolean indicating whether to enable or disable lockdown mode.
|
|
157
|
+
function setLockdownMode(bytes19 addressPrefix, bool enabled) external payable;
|
|
158
|
+
|
|
159
|
+
/// @notice Enables or disables permit functionality for a given address prefix.
|
|
160
|
+
/// @dev This function can only be called by the owner of the address prefix. To disable this mode, the EVC
|
|
161
|
+
/// must be called directly. It is not possible to disable this mode by using checks-deferrable call or (by
|
|
162
|
+
/// definition) permit message. To support permit functionality by default, note that the logic was inverted here. To
|
|
163
|
+
/// disable the permit functionality, one must pass true as the second argument. To enable the permit
|
|
164
|
+
/// functionality, one must pass false as the second argument.
|
|
165
|
+
/// @param addressPrefix The address prefix for which the permit functionality is being set.
|
|
166
|
+
/// @param enabled A boolean indicating whether to enable or disable the disable-permit mode.
|
|
167
|
+
function setPermitDisabledMode(bytes19 addressPrefix, bool enabled) external payable;
|
|
168
|
+
|
|
169
|
+
/// @notice Sets the nonce for a given address prefix and nonce namespace.
|
|
170
|
+
/// @dev This function can only be called by the owner of the address prefix. Each nonce namespace provides a 256
|
|
171
|
+
/// bit nonce that has to be used sequentially. There's no requirement to use all the nonces for a given nonce
|
|
172
|
+
/// namespace before moving to the next one which allows the use of permit messages in a non-sequential manner. To
|
|
173
|
+
/// invalidate signed permit messages, set the nonce for a given nonce namespace accordingly. To invalidate all the
|
|
174
|
+
/// permit messages for a given nonce namespace, set the nonce to type(uint).max.
|
|
175
|
+
/// @param addressPrefix The address prefix for which the nonce is being set.
|
|
176
|
+
/// @param nonceNamespace The nonce namespace for which the nonce is being set.
|
|
177
|
+
/// @param nonce The new nonce for the given address prefix and nonce namespace.
|
|
178
|
+
function setNonce(bytes19 addressPrefix, uint256 nonceNamespace, uint256 nonce) external payable;
|
|
179
|
+
|
|
180
|
+
/// @notice Sets the bit field for a given address prefix and operator.
|
|
181
|
+
/// @dev This function can only be called by the owner of the address prefix. Each bit in the bit field corresponds
|
|
182
|
+
/// to one account belonging to the same owner. If the bit is set, the operator is authorized for the account.
|
|
183
|
+
/// @param addressPrefix The address prefix for which the bit field is being set.
|
|
184
|
+
/// @param operator The address of the operator for which the bit field is being set. Can neither be the EVC address
|
|
185
|
+
/// nor an address belonging to the same address prefix.
|
|
186
|
+
/// @param operatorBitField The new bit field for the given address prefix and operator. Reverts if the provided
|
|
187
|
+
/// value is equal to the currently stored value.
|
|
188
|
+
function setOperator(bytes19 addressPrefix, address operator, uint256 operatorBitField) external payable;
|
|
189
|
+
|
|
190
|
+
/// @notice Authorizes or deauthorizes an operator for the account.
|
|
191
|
+
/// @dev Only the owner or authorized operator of the account can call this function. An operator is an address that
|
|
192
|
+
/// can perform actions for an account on behalf of the owner. If it's an operator calling this function, it can
|
|
193
|
+
/// only deauthorize itself.
|
|
194
|
+
/// @param account The address of the account whose operator is being set or unset.
|
|
195
|
+
/// @param operator The address of the operator that is being installed or uninstalled. Can neither be the EVC
|
|
196
|
+
/// address nor an address belonging to the same owner as the account.
|
|
197
|
+
/// @param authorized A boolean value that indicates whether the operator is being authorized or deauthorized.
|
|
198
|
+
/// Reverts if the provided value is equal to the currently stored value.
|
|
199
|
+
function setAccountOperator(address account, address operator, bool authorized) external payable;
|
|
200
|
+
|
|
201
|
+
/// @notice Returns an array of collaterals enabled for an account.
|
|
202
|
+
/// @dev A collateral is a vault for which an account's balances are under the control of the currently enabled
|
|
203
|
+
/// controller vault.
|
|
204
|
+
/// @param account The address of the account whose collaterals are being queried.
|
|
205
|
+
/// @return An array of addresses that are enabled collaterals for the account.
|
|
206
|
+
function getCollaterals(address account) external view returns (address[] memory);
|
|
207
|
+
|
|
208
|
+
/// @notice Returns whether a collateral is enabled for an account.
|
|
209
|
+
/// @dev A collateral is a vault for which account's balances are under the control of the currently enabled
|
|
210
|
+
/// controller vault.
|
|
211
|
+
/// @param account The address of the account that is being checked.
|
|
212
|
+
/// @param vault The address of the collateral that is being checked.
|
|
213
|
+
/// @return A boolean value that indicates whether the vault is an enabled collateral for the account or not.
|
|
214
|
+
function isCollateralEnabled(address account, address vault) external view returns (bool);
|
|
215
|
+
|
|
216
|
+
/// @notice Enables a collateral for an account.
|
|
217
|
+
/// @dev A collaterals is a vault for which account's balances are under the control of the currently enabled
|
|
218
|
+
/// controller vault. Only the owner or an operator of the account can call this function. Unless it's a duplicate,
|
|
219
|
+
/// the collateral is added to the end of the array. There can be at most 10 unique collaterals enabled at a time.
|
|
220
|
+
/// Account status checks are performed.
|
|
221
|
+
/// @param account The account address for which the collateral is being enabled.
|
|
222
|
+
/// @param vault The address being enabled as a collateral.
|
|
223
|
+
function enableCollateral(address account, address vault) external payable;
|
|
224
|
+
|
|
225
|
+
/// @notice Disables a collateral for an account.
|
|
226
|
+
/// @dev This function does not preserve the order of collaterals in the array obtained using the getCollaterals
|
|
227
|
+
/// function; the order may change. A collateral is a vault for which account’s balances are under the control of
|
|
228
|
+
/// the currently enabled controller vault. Only the owner or an operator of the account can call this function.
|
|
229
|
+
/// Disabling a collateral might change the order of collaterals in the array obtained using getCollaterals
|
|
230
|
+
/// function. Account status checks are performed.
|
|
231
|
+
/// @param account The account address for which the collateral is being disabled.
|
|
232
|
+
/// @param vault The address of a collateral being disabled.
|
|
233
|
+
function disableCollateral(address account, address vault) external payable;
|
|
234
|
+
|
|
235
|
+
/// @notice Swaps the position of two collaterals so that they appear switched in the array of collaterals for a
|
|
236
|
+
/// given account obtained by calling getCollaterals function.
|
|
237
|
+
/// @dev A collateral is a vault for which account’s balances are under the control of the currently enabled
|
|
238
|
+
/// controller vault. Only the owner or an operator of the account can call this function. The order of collaterals
|
|
239
|
+
/// can be changed by specifying the indices of the two collaterals to be swapped. Indices are zero-based and must
|
|
240
|
+
/// be in the range of 0 to the number of collaterals minus 1. index1 must be lower than index2. Account status
|
|
241
|
+
/// checks are performed.
|
|
242
|
+
/// @param account The address of the account for which the collaterals are being reordered.
|
|
243
|
+
/// @param index1 The index of the first collateral to be swapped.
|
|
244
|
+
/// @param index2 The index of the second collateral to be swapped.
|
|
245
|
+
function reorderCollaterals(address account, uint8 index1, uint8 index2) external payable;
|
|
246
|
+
|
|
247
|
+
/// @notice Returns an array of enabled controllers for an account.
|
|
248
|
+
/// @dev A controller is a vault that has been chosen for an account to have special control over the account's
|
|
249
|
+
/// balances in enabled collaterals vaults. A user can have multiple controllers during a call execution, but at
|
|
250
|
+
/// most one can be selected when the account status check is performed.
|
|
251
|
+
/// @param account The address of the account whose controllers are being queried.
|
|
252
|
+
/// @return An array of addresses that are the enabled controllers for the account.
|
|
253
|
+
function getControllers(address account) external view returns (address[] memory);
|
|
254
|
+
|
|
255
|
+
/// @notice Returns whether a controller is enabled for an account.
|
|
256
|
+
/// @dev A controller is a vault that has been chosen for an account to have special control over account’s
|
|
257
|
+
/// balances in the enabled collaterals vaults.
|
|
258
|
+
/// @param account The address of the account that is being checked.
|
|
259
|
+
/// @param vault The address of the controller that is being checked.
|
|
260
|
+
/// @return A boolean value that indicates whether the vault is enabled controller for the account or not.
|
|
261
|
+
function isControllerEnabled(address account, address vault) external view returns (bool);
|
|
262
|
+
|
|
263
|
+
/// @notice Enables a controller for an account.
|
|
264
|
+
/// @dev A controller is a vault that has been chosen for an account to have special control over account’s
|
|
265
|
+
/// balances in the enabled collaterals vaults. Only the owner or an operator of the account can call this function.
|
|
266
|
+
/// Unless it's a duplicate, the controller is added to the end of the array. Transiently, there can be at most 10
|
|
267
|
+
/// unique controllers enabled at a time, but at most one can be enabled after the outermost checks-deferrable
|
|
268
|
+
/// call concludes. Account status checks are performed.
|
|
269
|
+
/// @param account The address for which the controller is being enabled.
|
|
270
|
+
/// @param vault The address of the controller being enabled.
|
|
271
|
+
function enableController(address account, address vault) external payable;
|
|
272
|
+
|
|
273
|
+
/// @notice Disables a controller for an account.
|
|
274
|
+
/// @dev A controller is a vault that has been chosen for an account to have special control over account’s
|
|
275
|
+
/// balances in the enabled collaterals vaults. Only the vault itself can call this function. Disabling a controller
|
|
276
|
+
/// might change the order of controllers in the array obtained using getControllers function. Account status checks
|
|
277
|
+
/// are performed.
|
|
278
|
+
/// @param account The address for which the calling controller is being disabled.
|
|
279
|
+
function disableController(address account) external payable;
|
|
280
|
+
|
|
281
|
+
/// @notice Executes signed arbitrary data by self-calling into the EVC.
|
|
282
|
+
/// @dev Low-level call function is used to execute the arbitrary data signed by the owner or the operator on the
|
|
283
|
+
/// EVC contract. During that call, EVC becomes msg.sender.
|
|
284
|
+
/// @param signer The address signing the permit message (ECDSA) or verifying the permit message signature
|
|
285
|
+
/// (ERC-1271). It's also the owner or the operator of all the accounts for which authentication will be needed
|
|
286
|
+
/// during the execution of the arbitrary data call.
|
|
287
|
+
/// @param sender The address of the msg.sender which is expected to execute the data signed by the signer. If
|
|
288
|
+
/// address(0) is passed, the msg.sender is ignored.
|
|
289
|
+
/// @param nonceNamespace The nonce namespace for which the nonce is being used.
|
|
290
|
+
/// @param nonce The nonce for the given account and nonce namespace. A valid nonce value is considered to be the
|
|
291
|
+
/// value currently stored and can take any value between 0 and type(uint256).max - 1.
|
|
292
|
+
/// @param deadline The timestamp after which the permit is considered expired.
|
|
293
|
+
/// @param value The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole
|
|
294
|
+
/// balance of the EVC contract will be forwarded.
|
|
295
|
+
/// @param data The encoded data which is self-called on the EVC contract.
|
|
296
|
+
/// @param signature The signature of the data signed by the signer.
|
|
297
|
+
function permit(
|
|
298
|
+
address signer,
|
|
299
|
+
address sender,
|
|
300
|
+
uint256 nonceNamespace,
|
|
301
|
+
uint256 nonce,
|
|
302
|
+
uint256 deadline,
|
|
303
|
+
uint256 value,
|
|
304
|
+
bytes calldata data,
|
|
305
|
+
bytes calldata signature
|
|
306
|
+
) external payable;
|
|
307
|
+
|
|
308
|
+
/// @notice Calls into a target contract as per data encoded.
|
|
309
|
+
/// @dev This function defers the account and vault status checks (it's a checks-deferrable call). If the outermost
|
|
310
|
+
/// call ends, the account and vault status checks are performed.
|
|
311
|
+
/// @dev This function can be used to interact with any contract while checks are deferred. If the target contract
|
|
312
|
+
/// is msg.sender, msg.sender is called back with the calldata provided and the context set up according to the
|
|
313
|
+
/// account provided. If the target contract is not msg.sender, only the owner or the operator of the account
|
|
314
|
+
/// provided can call this function.
|
|
315
|
+
/// @dev This function can be used to recover the remaining value from the EVC contract.
|
|
316
|
+
/// @param targetContract The address of the contract to be called.
|
|
317
|
+
/// @param onBehalfOfAccount If the target contract is msg.sender, the address of the account which will be set
|
|
318
|
+
/// in the context. It assumes msg.sender has authenticated the account themselves. If the target contract is
|
|
319
|
+
/// not msg.sender, the address of the account for which it is checked whether msg.sender is authorized to act
|
|
320
|
+
/// on behalf of.
|
|
321
|
+
/// @param value The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole
|
|
322
|
+
/// balance of the EVC contract will be forwarded.
|
|
323
|
+
/// @param data The encoded data which is called on the target contract.
|
|
324
|
+
/// @return result The result of the call.
|
|
325
|
+
function call(address targetContract, address onBehalfOfAccount, uint256 value, bytes calldata data)
|
|
326
|
+
external
|
|
327
|
+
payable
|
|
328
|
+
returns (bytes memory result);
|
|
329
|
+
|
|
330
|
+
/// @notice For a given account, calls into one of the enabled collateral vaults from the currently enabled
|
|
331
|
+
/// controller vault as per data encoded.
|
|
332
|
+
/// @dev This function defers the account and vault status checks (it's a checks-deferrable call). If the outermost
|
|
333
|
+
/// call ends, the account and vault status checks are performed.
|
|
334
|
+
/// @dev This function can be used to interact with any contract while checks are deferred as long as the contract
|
|
335
|
+
/// is enabled as a collateral of the account and the msg.sender is the only enabled controller of the account.
|
|
336
|
+
/// @param targetCollateral The collateral address to be called.
|
|
337
|
+
/// @param onBehalfOfAccount The address of the account for which it is checked whether msg.sender is authorized to
|
|
338
|
+
/// act on behalf.
|
|
339
|
+
/// @param value The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole
|
|
340
|
+
/// balance of the EVC contract will be forwarded.
|
|
341
|
+
/// @param data The encoded data which is called on the target collateral.
|
|
342
|
+
/// @return result The result of the call.
|
|
343
|
+
function controlCollateral(address targetCollateral, address onBehalfOfAccount, uint256 value, bytes calldata data)
|
|
344
|
+
external
|
|
345
|
+
payable
|
|
346
|
+
returns (bytes memory result);
|
|
347
|
+
|
|
348
|
+
/// @notice Executes multiple calls into the target contracts while checks deferred as per batch items provided.
|
|
349
|
+
/// @dev This function defers the account and vault status checks (it's a checks-deferrable call). If the outermost
|
|
350
|
+
/// call ends, the account and vault status checks are performed.
|
|
351
|
+
/// @dev The authentication rules for each batch item are the same as for the call function.
|
|
352
|
+
/// @param items An array of batch items to be executed.
|
|
353
|
+
function batch(BatchItem[] calldata items) external payable;
|
|
354
|
+
|
|
355
|
+
/// @notice Executes multiple calls into the target contracts while checks deferred as per batch items provided.
|
|
356
|
+
/// @dev This function always reverts as it's only used for simulation purposes. This function cannot be called
|
|
357
|
+
/// within a checks-deferrable call.
|
|
358
|
+
/// @param items An array of batch items to be executed.
|
|
359
|
+
function batchRevert(BatchItem[] calldata items) external payable;
|
|
360
|
+
|
|
361
|
+
/// @notice Executes multiple calls into the target contracts while checks deferred as per batch items provided.
|
|
362
|
+
/// @dev This function does not modify state and should only be used for simulation purposes. This function cannot
|
|
363
|
+
/// be called within a checks-deferrable call.
|
|
364
|
+
/// @param items An array of batch items to be executed.
|
|
365
|
+
/// @return batchItemsResult An array of batch item results for each item.
|
|
366
|
+
/// @return accountsStatusCheckResult An array of account status check results for each account.
|
|
367
|
+
/// @return vaultsStatusCheckResult An array of vault status check results for each vault.
|
|
368
|
+
function batchSimulation(BatchItem[] calldata items)
|
|
369
|
+
external
|
|
370
|
+
payable
|
|
371
|
+
returns (
|
|
372
|
+
BatchItemResult[] memory batchItemsResult,
|
|
373
|
+
StatusCheckResult[] memory accountsStatusCheckResult,
|
|
374
|
+
StatusCheckResult[] memory vaultsStatusCheckResult
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
/// @notice Retrieves the timestamp of the last successful account status check performed for a specific account.
|
|
378
|
+
/// @dev This function reverts if the checks are in progress.
|
|
379
|
+
/// @dev The account status check is considered to be successful if it calls into the selected controller vault and
|
|
380
|
+
/// obtains expected magic value. This timestamp does not change if the account status is considered valid when no
|
|
381
|
+
/// controller enabled. When consuming, one might need to ensure that the account status check is not deferred at
|
|
382
|
+
/// the moment.
|
|
383
|
+
/// @param account The address of the account for which the last status check timestamp is being queried.
|
|
384
|
+
/// @return The timestamp of the last status check as a uint256.
|
|
385
|
+
function getLastAccountStatusCheckTimestamp(address account) external view returns (uint256);
|
|
386
|
+
|
|
387
|
+
/// @notice Checks whether the status check is deferred for a given account.
|
|
388
|
+
/// @dev This function reverts if the checks are in progress.
|
|
389
|
+
/// @param account The address of the account for which it is checked whether the status check is deferred.
|
|
390
|
+
/// @return A boolean flag that indicates whether the status check is deferred or not.
|
|
391
|
+
function isAccountStatusCheckDeferred(address account) external view returns (bool);
|
|
392
|
+
|
|
393
|
+
/// @notice Checks the status of an account and reverts if it is not valid.
|
|
394
|
+
/// @dev If checks deferred, the account is added to the set of accounts to be checked at the end of the outermost
|
|
395
|
+
/// checks-deferrable call. There can be at most 10 unique accounts added to the set at a time. Account status
|
|
396
|
+
/// check is performed by calling into the selected controller vault and passing the array of currently enabled
|
|
397
|
+
/// collaterals. If controller is not selected, the account is always considered valid.
|
|
398
|
+
/// @param account The address of the account to be checked.
|
|
399
|
+
function requireAccountStatusCheck(address account) external payable;
|
|
400
|
+
|
|
401
|
+
/// @notice Forgives previously deferred account status check.
|
|
402
|
+
/// @dev Account address is removed from the set of addresses for which status checks are deferred. This function
|
|
403
|
+
/// can only be called by the currently enabled controller of a given account. Depending on the vault
|
|
404
|
+
/// implementation, may be needed in the liquidation flow.
|
|
405
|
+
/// @param account The address of the account for which the status check is forgiven.
|
|
406
|
+
function forgiveAccountStatusCheck(address account) external payable;
|
|
407
|
+
|
|
408
|
+
/// @notice Checks whether the status check is deferred for a given vault.
|
|
409
|
+
/// @dev This function reverts if the checks are in progress.
|
|
410
|
+
/// @param vault The address of the vault for which it is checked whether the status check is deferred.
|
|
411
|
+
/// @return A boolean flag that indicates whether the status check is deferred or not.
|
|
412
|
+
function isVaultStatusCheckDeferred(address vault) external view returns (bool);
|
|
413
|
+
|
|
414
|
+
/// @notice Checks the status of a vault and reverts if it is not valid.
|
|
415
|
+
/// @dev If checks deferred, the vault is added to the set of vaults to be checked at the end of the outermost
|
|
416
|
+
/// checks-deferrable call. There can be at most 10 unique vaults added to the set at a time. This function can
|
|
417
|
+
/// only be called by the vault itself.
|
|
418
|
+
function requireVaultStatusCheck() external payable;
|
|
419
|
+
|
|
420
|
+
/// @notice Forgives previously deferred vault status check.
|
|
421
|
+
/// @dev Vault address is removed from the set of addresses for which status checks are deferred. This function can
|
|
422
|
+
/// only be called by the vault itself.
|
|
423
|
+
function forgiveVaultStatusCheck() external payable;
|
|
424
|
+
|
|
425
|
+
/// @notice Checks the status of an account and a vault and reverts if it is not valid.
|
|
426
|
+
/// @dev If checks deferred, the account and the vault are added to the respective sets of accounts and vaults to be
|
|
427
|
+
/// checked at the end of the outermost checks-deferrable call. Account status check is performed by calling into
|
|
428
|
+
/// selected controller vault and passing the array of currently enabled collaterals. If controller is not selected,
|
|
429
|
+
/// the account is always considered valid. This function can only be called by the vault itself.
|
|
430
|
+
/// @param account The address of the account to be checked.
|
|
431
|
+
function requireAccountAndVaultStatusCheck(address account) external payable;
|
|
432
|
+
}
|
package/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerFactory.sol
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
|
+
|
|
4
|
+
/// @notice Minimal interface for Euler's `GenericFactory` (the EVault factory), as a mapping
|
|
5
|
+
/// of vault index to the corresponding vault address.
|
|
6
|
+
/// https://github.com/euler-xyz/euler-vault-kit/blob/master/src/GenericFactory/GenericFactory.sol
|
|
7
|
+
|
|
8
|
+
interface IEulerFactory {
|
|
9
|
+
function proxyList(uint256 index) external view returns (address);
|
|
10
|
+
}
|
package/contracts/pt-looping/money-market/implementations/euler/dependencies/IEulerPriceOracle.sol
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.8.0;
|
|
4
|
+
|
|
5
|
+
/// https://github.com/euler-xyz/euler-vault-kit/blob/5b98b42048ba11ae82fb62dfec06d1010c8e41e6/src/interfaces/IPriceOracle.sol#L4
|
|
6
|
+
/// Modifications:
|
|
7
|
+
/// - Rename `IPriceOracle` to `IEulerPriceOracle`
|
|
8
|
+
/// - Remove `getQuotes` method
|
|
9
|
+
|
|
10
|
+
/// @title IPriceOracle
|
|
11
|
+
/// @custom:security-contact security@euler.xyz
|
|
12
|
+
/// @author Euler Labs (https://www.eulerlabs.com/)
|
|
13
|
+
/// @notice Common PriceOracle interface.
|
|
14
|
+
interface IEulerPriceOracle {
|
|
15
|
+
/// @notice Get the name of the oracle.
|
|
16
|
+
/// @return The name of the oracle.
|
|
17
|
+
function name() external view returns (string memory);
|
|
18
|
+
|
|
19
|
+
/// @notice One-sided price: How much quote token you would get for inAmount of base token, assuming no price
|
|
20
|
+
/// spread.
|
|
21
|
+
/// @param inAmount The amount of `base` to convert.
|
|
22
|
+
/// @param base The token that is being priced.
|
|
23
|
+
/// @param quote The token that is the unit of account.
|
|
24
|
+
/// @return outAmount The amount of `quote` that is equivalent to `inAmount` of `base`.
|
|
25
|
+
function getQuote(uint256 inAmount, address base, address quote) external view returns (uint256 outAmount);
|
|
26
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
|
+
|
|
4
|
+
/// https://github.com/euler-xyz/euler-vault-kit/blob/master/src/EVault/IEVault.sol
|
|
5
|
+
/// Modifications:
|
|
6
|
+
/// - Include `AmountCap` library in.
|
|
7
|
+
/// - Combine all interfaces into `IEulerVault`, and remove unused fucntions.
|
|
8
|
+
/// - Make the return values of `caps` function `AmountCap` for type safety.
|
|
9
|
+
|
|
10
|
+
import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
|
|
11
|
+
import {IEulerPriceOracle} from "./IEulerPriceOracle.sol";
|
|
12
|
+
|
|
13
|
+
type AmountCap is uint16;
|
|
14
|
+
|
|
15
|
+
uint256 constant NO_CAP = type(uint256).max;
|
|
16
|
+
|
|
17
|
+
/// @title AmountCapLib
|
|
18
|
+
/// @custom:security-contact security@euler.xyz
|
|
19
|
+
/// @author Euler Labs (https://www.eulerlabs.com/)
|
|
20
|
+
/// @notice Library for `AmountCap` custom type
|
|
21
|
+
/// @dev AmountCaps are 16-bit decimal floating point values:
|
|
22
|
+
/// * The least significant 6 bits are the exponent
|
|
23
|
+
/// * The most significant 10 bits are the mantissa, scaled by 100
|
|
24
|
+
/// * The special value of 0 means limit is not set
|
|
25
|
+
/// * This is so that uninitialized storage implies no limit
|
|
26
|
+
/// * For an actual cap value of 0, use a zero mantissa and non-zero exponent
|
|
27
|
+
library AmountCapLib {
|
|
28
|
+
function resolve(AmountCap self) internal pure returns (uint256) {
|
|
29
|
+
uint256 amountCap = AmountCap.unwrap(self);
|
|
30
|
+
|
|
31
|
+
if (amountCap == 0) return type(uint256).max;
|
|
32
|
+
|
|
33
|
+
unchecked {
|
|
34
|
+
// Cannot overflow because this is less than 2**256:
|
|
35
|
+
// 10**(2**6 - 1) * (2**10 - 1) = 1.023e+66
|
|
36
|
+
return 10 ** (amountCap & 63) * (amountCap >> 6) / 100;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function toRawUint16(AmountCap self) internal pure returns (uint16) {
|
|
41
|
+
return AmountCap.unwrap(self);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
using AmountCapLib for AmountCap global;
|
|
46
|
+
|
|
47
|
+
interface IEulerVault is IERC4626 {
|
|
48
|
+
/// @notice Debt owed by a particular account, in underlying units
|
|
49
|
+
/// @param account Address to query
|
|
50
|
+
/// @return The debt of the account in asset units
|
|
51
|
+
function debtOf(address account) external view returns (uint256);
|
|
52
|
+
|
|
53
|
+
/// @notice Transfer underlying tokens from the vault to the sender, and increase sender's debt
|
|
54
|
+
/// @param amount Amount of assets to borrow (use max uint256 for all available tokens)
|
|
55
|
+
/// @param receiver Account receiving the borrowed tokens
|
|
56
|
+
/// @return Amount of assets borrowed
|
|
57
|
+
function borrow(uint256 amount, address receiver) external returns (uint256);
|
|
58
|
+
|
|
59
|
+
/// @notice Transfer underlying tokens from the sender to the vault, and decrease receiver's debt
|
|
60
|
+
/// @param amount Amount of debt to repay in assets (use max uint256 for full debt)
|
|
61
|
+
/// @param receiver Account holding the debt to be repaid
|
|
62
|
+
/// @return Amount of assets repaid
|
|
63
|
+
function repay(uint256 amount, address receiver) external returns (uint256);
|
|
64
|
+
|
|
65
|
+
/// @notice Enables balance forwarding for the authenticated account
|
|
66
|
+
/// @dev Only the authenticated account can enable balance forwarding for itself
|
|
67
|
+
/// @dev Should call the IBalanceTracker hook with the current account's balance
|
|
68
|
+
function enableBalanceForwarder() external;
|
|
69
|
+
|
|
70
|
+
// View
|
|
71
|
+
|
|
72
|
+
/// @notice Balance of vault assets as tracked by deposits/withdrawals and borrows/repays
|
|
73
|
+
/// @return The amount of assets the vault tracks as current direct holdings
|
|
74
|
+
function cash() external view returns (uint256);
|
|
75
|
+
|
|
76
|
+
/// @notice Retrieves supply and borrow caps
|
|
77
|
+
/// @return supplyCap The supply cap
|
|
78
|
+
/// @return borrowCap The borrow cap
|
|
79
|
+
function caps() external view returns (AmountCap supplyCap, AmountCap borrowCap);
|
|
80
|
+
|
|
81
|
+
/// @notice Retrieves LTV configuration for the collateral
|
|
82
|
+
/// @param collateral Collateral asset
|
|
83
|
+
/// @return borrowLTV The current value of borrow LTV for originating positions
|
|
84
|
+
/// @return liquidationLTV The value of fully converged liquidation LTV
|
|
85
|
+
/// @return initialLiquidationLTV The initial value of the liquidation LTV, when the ramp began
|
|
86
|
+
/// @return targetTimestamp The timestamp when the liquidation LTV is considered fully converged
|
|
87
|
+
/// @return rampDuration The time it takes for the liquidation LTV to converge from the initial value to the fully
|
|
88
|
+
/// converged value
|
|
89
|
+
function LTVFull(IEulerVault collateral)
|
|
90
|
+
external
|
|
91
|
+
view
|
|
92
|
+
returns (
|
|
93
|
+
uint256 borrowLTV,
|
|
94
|
+
uint256 liquidationLTV,
|
|
95
|
+
uint256 initialLiquidationLTV,
|
|
96
|
+
uint256 targetTimestamp,
|
|
97
|
+
uint256 rampDuration
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
function LTVList() external view returns (IEulerVault[] memory);
|
|
101
|
+
|
|
102
|
+
/// @notice Retrieves the address of the oracle contract
|
|
103
|
+
/// @return The address of the oracle
|
|
104
|
+
function oracle() external view returns (IEulerPriceOracle);
|
|
105
|
+
|
|
106
|
+
/// @notice Retrieves the current interest rate for an asset
|
|
107
|
+
/// @return The interest rate in yield-per-second, scaled by 10**27
|
|
108
|
+
function interestRate() external view returns (uint256);
|
|
109
|
+
/// @notice Sum of all outstanding debts, in underlying units (increases as interest is accrued)
|
|
110
|
+
/// @return The total borrows in asset units
|
|
111
|
+
function totalBorrows() external view returns (uint256);
|
|
112
|
+
/// @notice Retrieves the interest fee in effect for the vault
|
|
113
|
+
/// @return Amount of interest that is redirected as a fee, as a fraction scaled by 1e4
|
|
114
|
+
function interestFee() external view returns (uint16);
|
|
115
|
+
|
|
116
|
+
/// @notice Retrieves a reference asset used for liquidity calculations
|
|
117
|
+
/// @return The address of the reference asset
|
|
118
|
+
function unitOfAccount() external view returns (address);
|
|
119
|
+
|
|
120
|
+
/// @notice Looks up an asset's currently configured interest rate model
|
|
121
|
+
/// @return Address of the interest rate contract or address zero to indicate 0% interest
|
|
122
|
+
function interestRateModel() external view returns (address);
|
|
123
|
+
|
|
124
|
+
/// @notice Checks to see if a liquidation would be profitable, without actually doing anything
|
|
125
|
+
/// @param liquidator Address that will initiate the liquidation
|
|
126
|
+
/// @param violator Address that may be in collateral violation
|
|
127
|
+
/// @param collateral Collateral which is to be seized
|
|
128
|
+
/// @return maxRepay Max amount of debt that can be repaid, in asset units
|
|
129
|
+
/// @return maxYield Yield in collateral corresponding to max allowed amount of debt to be repaid, in collateral
|
|
130
|
+
/// balance (shares for vaults)
|
|
131
|
+
function checkLiquidation(address liquidator, address violator, IEulerVault collateral)
|
|
132
|
+
external
|
|
133
|
+
view
|
|
134
|
+
returns (uint256 maxRepay, uint256 maxYield);
|
|
135
|
+
|
|
136
|
+
/// @notice Attempts to perform a liquidation
|
|
137
|
+
/// @param violator Address that may be in collateral violation
|
|
138
|
+
/// @param collateral Collateral which is to be seized
|
|
139
|
+
/// @param repayAssets The amount of underlying debt to be transferred from violator to sender, in asset units (use
|
|
140
|
+
/// max uint256 to repay the maximum possible amount).
|
|
141
|
+
/// @param minYieldBalance The minimum acceptable amount of collateral to be transferred from violator to sender, in
|
|
142
|
+
/// collateral balance units (shares for vaults)
|
|
143
|
+
function liquidate(address violator, IEulerVault collateral, uint256 repayAssets, uint256 minYieldBalance) external;
|
|
144
|
+
|
|
145
|
+
/// @notice Retrieves liquidation cool-off time, which must elapse after successful account status check before
|
|
146
|
+
/// account can be liquidated
|
|
147
|
+
/// @return The liquidation cool off time in seconds
|
|
148
|
+
function liquidationCoolOffTime() external view returns (uint16);
|
|
149
|
+
}
|
|
@@ -55,5 +55,8 @@
|
|
|
55
55
|
"merkleDepositor": "0x3dAe3d1734cA3C7B3089D4DD03C9876e0A0102b4",
|
|
56
56
|
"crossChainSwapHub": "0xd41c99760f4A7e27E736ED25cd6915110948Ea8a",
|
|
57
57
|
"depositBoxFactory": "0x15Ff9D268ef3300a3fcCe5DE4bc4326316c5dD6D",
|
|
58
|
-
"oftPtSwapper": "0x8ef78aD230887E05fa3324277A5225fE93889b08"
|
|
58
|
+
"oftPtSwapper": "0x8ef78aD230887E05fa3324277A5225fE93889b08",
|
|
59
|
+
"pendlePtLooper": "0xF82Ef4080A53b71093f9c470676Fc80E2ADC4263",
|
|
60
|
+
"pendlePtLooperView": "0x887b00B5F584f1cC015e8f68C29d6Feb6bf95b02",
|
|
61
|
+
"loopPositionBoxFactory": "0xe5125dfE3Fc232723E7Ae17cFa66034b3BCAC696"
|
|
59
62
|
}
|