|
{
|
|
"language": "Solidity",
|
|
"sources": {
|
|
"submodules/v2-foundry/src/migration/MigrationTool.sol": {
|
|
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity 0.8.13;\n\nimport {IERC20} from \"../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\n\nimport {\n IllegalArgument,\n IllegalState,\n Unauthorized\n} from \"../base/ErrorMessages.sol\";\n\nimport {Multicall} from \"../base/Multicall.sol\";\nimport {Mutex} from \"../base/Mutex.sol\";\n\nimport {TokenUtils} from \"../libraries/TokenUtils.sol\";\n\nimport {IAlchemicToken} from \"../interfaces/IAlchemicToken.sol\";\nimport {IAlchemistV2} from \"../interfaces/IAlchemistV2.sol\";\nimport {IAlchemistV2State} from \"../interfaces/alchemist/IAlchemistV2State.sol\";\nimport {IMigrationTool} from \"../interfaces/IMigrationTool.sol\";\nimport {IWETH9} from \"../interfaces/external/IWETH9.sol\";\n\nstruct InitializationParams {\n address alchemist;\n address[] collateralAddresses;\n}\n\ncontract MigrationTool is IMigrationTool, Multicall {\n string public override version = \"1.0.0\";\n uint256 FIXED_POINT_SCALAR = 1e18;\n\n mapping(address => uint256) public decimals;\n\n IAlchemistV2 public immutable alchemist;\n IAlchemicToken public immutable alchemicToken;\n address[] public collateralAddresses;\n\n constructor(InitializationParams memory params) {\n uint size = params.collateralAddresses.length;\n\n alchemist = IAlchemistV2(params.alchemist);\n alchemicToken = IAlchemicToken(alchemist.debtToken());\n collateralAddresses = params.collateralAddresses;\n\n for(uint i = 0; i < size; i++){\n decimals[collateralAddresses[i]] = TokenUtils.expectDecimals(collateralAddresses[i]);\n }\n }\n\n /// @inheritdoc IMigrationTool\n function migrateVaults(\n address startingYieldToken,\n address targetYieldToken,\n uint256 shares,\n uint256 minReturnShares,\n uint256 minReturnUnderlying\n ) external override returns (uint256) {\n // Yield tokens cannot be the same to prevent slippage on current position\n if (startingYieldToken == targetYieldToken) {\n revert IllegalArgument(\"Yield tokens cannot be the same\");\n }\n\n // If either yield token is invalid, revert\n if (!alchemist.isSupportedYieldToken(startingYieldToken)) {\n revert IllegalArgument(\"Yield token is not supported\");\n }\n\n if (!alchemist.isSupportedYieldToken(targetYieldToken)) {\n revert IllegalArgument(\"Yield token is not supported\");\n }\n\n IAlchemistV2State.YieldTokenParams memory startingParams = alchemist.getYieldTokenParameters(startingYieldToken);\n IAlchemistV2State.YieldTokenParams memory targetParams = alchemist.getYieldTokenParameters(targetYieldToken);\n\n // If starting and target underlying tokens are not the same then revert\n if (startingParams.underlyingToken != targetParams.underlyingToken) {\n revert IllegalArgument(\"Cannot swap between different collaterals\");\n }\n\n // Original debt\n (int256 debt, ) = alchemist.accounts(msg.sender);\n\n // Avoid calculations and repayments if user doesn't need this to migrate\n uint256 debtTokenValue;\n uint256 mintable;\n if (debt > 0) {\n // Convert shares to amount of debt tokens\n debtTokenValue = _convertToDebt(shares, startingYieldToken, startingParams.underlyingToken);\n mintable = debtTokenValue * FIXED_POINT_SCALAR / alchemist.minimumCollateralization();\n // Mint tokens to this contract and burn them in the name of the user\n alchemicToken.mint(address(this), mintable);\n TokenUtils.safeApprove(address(alchemicToken), address(alchemist), mintable);\n alchemist.burn(mintable, msg.sender);\n }\n\n // Withdraw what you can from the old position\n uint256 underlyingWithdrawn = alchemist.withdrawUnderlyingFrom(msg.sender, startingYieldToken, shares, address(this), minReturnUnderlying);\n\n // Deposit into new position\n TokenUtils.safeApprove(targetParams.underlyingToken, address(alchemist), underlyingWithdrawn);\n uint256 newPositionShares = alchemist.depositUnderlying(targetYieldToken, underlyingWithdrawn, msg.sender, minReturnShares);\n\n if (debt > 0) {\n // Mint al token which will be burned to fulfill flash loan requirements\n alchemist.mintFrom(msg.sender, mintable, address(this));\n alchemicToken.burn(mintable);\n }\n\n\t return newPositionShares;\n\t}\n\n function _convertToDebt(uint256 shares, address yieldToken, address underlyingToken) internal returns(uint256) {\n // Math safety\n if (TokenUtils.expectDecimals(underlyingToken) > 18) {\n revert IllegalState(\"Underlying token decimals exceeds 18\");\n }\n\n uint256 underlyingValue = shares * alchemist.getUnderlyingTokensPerShare(yieldToken) / 10**TokenUtils.expectDecimals(yieldToken);\n return underlyingValue * 10**(18 - decimals[underlyingToken]);\n }\n}"
|
|
},
|
|
"submodules/v2-foundry/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0-rc.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n"
|
|
},
|
|
"submodules/v2-foundry/src/base/ErrorMessages.sol": {
|
|
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.4;\n\n/// @notice An error used to indicate that an argument passed to a function is illegal or\n/// inappropriate.\n///\n/// @param message The error message.\nerror IllegalArgument(string message);\n\n/// @notice An error used to indicate that a function has encountered an unrecoverable state.\n///\n/// @param message The error message.\nerror IllegalState(string message);\n\n/// @notice An error used to indicate that an operation is unsupported.\n///\n/// @param message The error message.\nerror UnsupportedOperation(string message);\n\n/// @notice An error used to indicate that a message sender tried to execute a privileged function.\n///\n/// @param message The error message.\nerror Unauthorized(string message);"
|
|
},
|
|
"submodules/v2-foundry/src/base/Multicall.sol": {
|
|
"content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.13;\n\n/// @title Multicall\n/// @author Uniswap Labs\n///\n/// @notice Enables calling multiple methods in a single call to the contract\nabstract contract Multicall {\n error MulticallFailed(bytes data, bytes result);\n\n function multicall(\n bytes[] calldata data\n ) external payable returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; ++i) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n\n if (!success) {\n revert MulticallFailed(data[i], result);\n }\n\n results[i] = result;\n }\n }\n}"
|
|
},
|
|
"submodules/v2-foundry/src/base/Mutex.sol": {
|
|
"content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.13;\n\n/// @title Mutex\n/// @author Alchemix Finance\n///\n/// @notice Provides a mutual exclusion lock for implementing contracts.\nabstract contract Mutex {\n /// @notice An error which is thrown when a lock is attempted to be claimed before it has been freed.\n error LockAlreadyClaimed();\n\n /// @notice The lock state. Non-zero values indicate the lock has been claimed.\n uint256 private _lockState;\n\n /// @dev A modifier which acquires the mutex.\n modifier lock() {\n _claimLock();\n\n _;\n\n _freeLock();\n }\n\n /// @dev Gets if the mutex is locked.\n ///\n /// @return if the mutex is locked.\n function _isLocked() internal returns (bool) {\n return _lockState == 1;\n }\n\n /// @dev Claims the lock. If the lock is already claimed, then this will revert.\n function _claimLock() internal {\n // Check that the lock has not been claimed yet.\n if (_lockState != 0) {\n revert LockAlreadyClaimed();\n }\n\n // Claim the lock.\n _lockState = 1;\n }\n\n /// @dev Frees the lock.\n function _freeLock() internal {\n _lockState = 0;\n }\n}"
|
|
},
|
|
"submodules/v2-foundry/src/libraries/TokenUtils.sol": {
|
|
"content": "pragma solidity ^0.8.13;\n\nimport \"../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\nimport \"../../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"../interfaces/IERC20Burnable.sol\";\nimport \"../interfaces/IERC20Mintable.sol\";\n\n/// @title TokenUtils\n/// @author Alchemix Finance\nlibrary TokenUtils {\n /// @notice An error used to indicate that a call to an ERC20 contract failed.\n ///\n /// @param target The target address.\n /// @param success If the call to the token was a success.\n /// @param data The resulting data from the call. This is error data when the call was not a success. Otherwise,\n /// this is malformed data when the call was a success.\n error ERC20CallFailed(address target, bool success, bytes data);\n\n /// @dev A safe function to get the decimals of an ERC20 token.\n ///\n /// @dev Reverts with a {CallFailed} error if execution of the query fails or returns an unexpected value.\n ///\n /// @param token The target token.\n ///\n /// @return The amount of decimals of the token.\n function expectDecimals(address token) internal view returns (uint8) {\n (bool success, bytes memory data) = token.staticcall(\n abi.encodeWithSelector(IERC20Metadata.decimals.selector)\n );\n\n if (token.code.length == 0 || !success || data.length < 32) {\n revert ERC20CallFailed(token, success, data);\n }\n\n return abi.decode(data, (uint8));\n }\n\n /// @dev Gets the balance of tokens held by an account.\n ///\n /// @dev Reverts with a {CallFailed} error if execution of the query fails or returns an unexpected value.\n ///\n /// @param token The token to check the balance of.\n /// @param account The address of the token holder.\n ///\n /// @return The balance of the tokens held by an account.\n function safeBalanceOf(address token, address account) internal view returns (uint256) {\n (bool success, bytes memory data) = token.staticcall(\n abi.encodeWithSelector(IERC20.balanceOf.selector, account)\n );\n\n if (token.code.length == 0 || !success || data.length < 32) {\n revert ERC20CallFailed(token, success, data);\n }\n\n return abi.decode(data, (uint256));\n }\n\n /// @dev Transfers tokens to another address.\n ///\n /// @dev Reverts with a {CallFailed} error if execution of the transfer failed or returns an unexpected value.\n ///\n /// @param token The token to transfer.\n /// @param recipient The address of the recipient.\n /// @param amount The amount of tokens to transfer.\n function safeTransfer(address token, address recipient, uint256 amount) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(IERC20.transfer.selector, recipient, amount)\n );\n\n if (token.code.length == 0 || !success || (data.length != 0 && !abi.decode(data, (bool)))) {\n revert ERC20CallFailed(token, success, data);\n }\n }\n\n /// @dev Approves tokens for the smart contract.\n ///\n /// @dev Reverts with a {CallFailed} error if execution of the approval fails or returns an unexpected value.\n ///\n /// @param token The token to approve.\n /// @param spender The contract to spend the tokens.\n /// @param value The amount of tokens to approve.\n function safeApprove(address token, address spender, uint256 value) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(IERC20.approve.selector, spender, value)\n );\n\n if (token.code.length == 0 || !success || (data.length != 0 && !abi.decode(data, (bool)))) {\n revert ERC20CallFailed(token, success, data);\n }\n }\n\n /// @dev Transfer tokens from one address to another address.\n ///\n /// @dev Reverts with a {CallFailed} error if execution of the transfer fails or returns an unexpected value.\n ///\n /// @param token The token to transfer.\n /// @param owner The address of the owner.\n /// @param recipient The address of the recipient.\n /// @param amount The amount of tokens to transfer.\n function safeTransferFrom(address token, address owner, address recipient, uint256 amount) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(IERC20.transferFrom.selector, owner, recipient, amount)\n );\n\n if (token.code.length == 0 || !success || (data.length != 0 && !abi.decode(data, (bool)))) {\n revert ERC20CallFailed(token, success, data);\n }\n }\n\n /// @dev Mints tokens to an address.\n ///\n /// @dev Reverts with a {CallFailed} error if execution of the mint fails or returns an unexpected value.\n ///\n /// @param token The token to mint.\n /// @param recipient The address of the recipient.\n /// @param amount The amount of tokens to mint.\n function safeMint(address token, address recipient, uint256 amount) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(IERC20Mintable.mint.selector, recipient, amount)\n );\n\n if (token.code.length == 0 || !success || (data.length != 0 && !abi.decode(data, (bool)))) {\n revert ERC20CallFailed(token, success, data);\n }\n }\n\n /// @dev Burns tokens.\n ///\n /// Reverts with a `CallFailed` error if execution of the burn fails or returns an unexpected value.\n ///\n /// @param token The token to burn.\n /// @param amount The amount of tokens to burn.\n function safeBurn(address token, uint256 amount) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(IERC20Burnable.burn.selector, amount)\n );\n\n if (token.code.length == 0 || !success || (data.length != 0 && !abi.decode(data, (bool)))) {\n revert ERC20CallFailed(token, success, data);\n }\n }\n\n /// @dev Burns tokens from its total supply.\n ///\n /// @dev Reverts with a {CallFailed} error if execution of the burn fails or returns an unexpected value.\n ///\n /// @param token The token to burn.\n /// @param owner The owner of the tokens.\n /// @param amount The amount of tokens to burn.\n function safeBurnFrom(address token, address owner, uint256 amount) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(IERC20Burnable.burnFrom.selector, owner, amount)\n );\n\n if (token.code.length == 0 || !success || (data.length != 0 && !abi.decode(data, (bool)))) {\n revert ERC20CallFailed(token, success, data);\n }\n }\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/IAlchemicToken.sol": {
|
|
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.5.0;\n\nimport {IERC20} from \"../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\n\n/// @title IAlchemicToken\n/// @author Alchemix Finance\ninterface IAlchemicToken is IERC20 {\n /// @notice Gets the total amount of minted tokens for an account.\n ///\n /// @param account The address of the account.\n ///\n /// @return The total minted.\n function hasMinted(address account) external view returns (uint256);\n\n /// @notice Lowers the number of tokens which the `msg.sender` has minted.\n ///\n /// This reverts if the `msg.sender` is not whitelisted.\n ///\n /// @param amount The amount to lower the minted amount by.\n function lowerHasMinted(uint256 amount) external;\n\n /// @notice Sets the mint allowance for a given account'\n ///\n /// This reverts if the `msg.sender` is not admin\n ///\n /// @param toSetCeiling The account whos allowance to update\n /// @param ceiling The amount of tokens allowed to mint\n function setCeiling(address toSetCeiling, uint256 ceiling) external;\n\n /// @notice Updates the state of an address in the whitelist map\n ///\n /// This reverts if msg.sender is not admin\n ///\n /// @param toWhitelist the address whos state is being updated\n /// @param state the boolean state of the whitelist\n function setWhitelist(address toWhitelist, bool state) external;\n\n function mint(address recipient, uint256 amount) external;\n\n function burn(uint256 amount) external;\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/IAlchemistV2.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\nimport \"./alchemist/IAlchemistV2Actions.sol\";\nimport \"./alchemist/IAlchemistV2AdminActions.sol\";\nimport \"./alchemist/IAlchemistV2Errors.sol\";\nimport \"./alchemist/IAlchemistV2Immutables.sol\";\nimport \"./alchemist/IAlchemistV2Events.sol\";\nimport \"./alchemist/IAlchemistV2State.sol\";\n\n/// @title IAlchemistV2\n/// @author Alchemix Finance\ninterface IAlchemistV2 is\n IAlchemistV2Actions,\n IAlchemistV2AdminActions,\n IAlchemistV2Errors,\n IAlchemistV2Immutables,\n IAlchemistV2Events,\n IAlchemistV2State\n{ }\n"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/alchemist/IAlchemistV2State.sol": {
|
|
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.5.0;\n\n/// @title IAlchemistV2State\n/// @author Alchemix Finance\ninterface IAlchemistV2State {\n /// @notice Defines underlying token parameters.\n struct UnderlyingTokenParams {\n // The number of decimals the token has. This value is cached once upon registering the token so it is important\n // that the decimals of the token are immutable or the system will begin to have computation errors.\n uint8 decimals;\n // A coefficient used to normalize the token to a value comparable to the debt token. For example, if the\n // underlying token is 8 decimals and the debt token is 18 decimals then the conversion factor will be\n // 10^10. One unit of the underlying token will be comparably equal to one unit of the debt token.\n uint256 conversionFactor;\n // A flag to indicate if the token is enabled.\n bool enabled;\n }\n\n /// @notice Defines yield token parameters.\n struct YieldTokenParams {\n // The number of decimals the token has. This value is cached once upon registering the token so it is important\n // that the decimals of the token are immutable or the system will begin to have computation errors.\n uint8 decimals;\n // The associated underlying token that can be redeemed for the yield-token.\n address underlyingToken;\n // The adapter used by the system to wrap, unwrap, and lookup the conversion rate of this token into its\n // underlying token.\n address adapter;\n // The maximum percentage loss that is acceptable before disabling certain actions.\n uint256 maximumLoss;\n // The maximum value of yield tokens that the system can hold, measured in units of the underlying token.\n uint256 maximumExpectedValue;\n // The percent of credit that will be unlocked per block. The representation of this value is a 18 decimal\n // fixed point integer.\n uint256 creditUnlockRate;\n // The current balance of yield tokens which are held by users.\n uint256 activeBalance;\n // The current balance of yield tokens which are earmarked to be harvested by the system at a later time.\n uint256 harvestableBalance;\n // The total number of shares that have been minted for this token.\n uint256 totalShares;\n // The expected value of the tokens measured in underlying tokens. This value controls how much of the token\n // can be harvested. When users deposit yield tokens, it increases the expected value by how much the tokens\n // are exchangeable for in the underlying token. When users withdraw yield tokens, it decreases the expected\n // value by how much the tokens are exchangeable for in the underlying token.\n uint256 expectedValue;\n // The current amount of credit which is will be distributed over time to depositors.\n uint256 pendingCredit;\n // The amount of the pending credit that has been distributed.\n uint256 distributedCredit;\n // The block number which the last credit distribution occurred.\n uint256 lastDistributionBlock;\n // The total accrued weight. This is used to calculate how much credit a user has been granted over time. The\n // representation of this value is a 18 decimal fixed point integer.\n uint256 accruedWeight;\n // A flag to indicate if the token is enabled.\n bool enabled;\n }\n\n /// @notice Gets the address of the admin.\n ///\n /// @return admin The admin address.\n function admin() external view returns (address admin);\n\n /// @notice Gets the address of the pending administrator.\n ///\n /// @return pendingAdmin The pending administrator address.\n function pendingAdmin() external view returns (address pendingAdmin);\n\n /// @notice Gets if an address is a sentinel.\n ///\n /// @param sentinel The address to check.\n ///\n /// @return isSentinel If the address is a sentinel.\n function sentinels(address sentinel) external view returns (bool isSentinel);\n\n /// @notice Gets if an address is a keeper.\n ///\n /// @param keeper The address to check.\n ///\n /// @return isKeeper If the address is a keeper\n function keepers(address keeper) external view returns (bool isKeeper);\n\n /// @notice Gets the address of the transmuter.\n ///\n /// @return transmuter The transmuter address.\n function transmuter() external view returns (address transmuter);\n\n /// @notice Gets the minimum collateralization.\n ///\n /// @notice Collateralization is determined by taking the total value of collateral that a user has deposited into their account and dividing it their debt.\n ///\n /// @dev The value returned is a 18 decimal fixed point integer.\n ///\n /// @return minimumCollateralization The minimum collateralization.\n function minimumCollateralization() external view returns (uint256 minimumCollateralization);\n\n /// @notice Gets the protocol fee.\n ///\n /// @return protocolFee The protocol fee.\n function protocolFee() external view returns (uint256 protocolFee);\n\n /// @notice Gets the protocol fee receiver.\n ///\n /// @return protocolFeeReceiver The protocol fee receiver.\n function protocolFeeReceiver() external view returns (address protocolFeeReceiver);\n\n /// @notice Gets the address of the whitelist contract.\n ///\n /// @return whitelist The address of the whitelist contract.\n function whitelist() external view returns (address whitelist);\n \n /// @notice Gets the conversion rate of underlying tokens per share.\n ///\n /// @param yieldToken The address of the yield token to get the conversion rate for.\n ///\n /// @return rate The rate of underlying tokens per share.\n function getUnderlyingTokensPerShare(address yieldToken) external view returns (uint256 rate);\n\n /// @notice Gets the conversion rate of yield tokens per share.\n ///\n /// @param yieldToken The address of the yield token to get the conversion rate for.\n ///\n /// @return rate The rate of yield tokens per share.\n function getYieldTokensPerShare(address yieldToken) external view returns (uint256 rate);\n\n /// @notice Gets the supported underlying tokens.\n ///\n /// @dev The order of the entries returned by this function is not guaranteed to be consistent between calls.\n ///\n /// @return tokens The supported underlying tokens.\n function getSupportedUnderlyingTokens() external view returns (address[] memory tokens);\n\n /// @notice Gets the supported yield tokens.\n ///\n /// @dev The order of the entries returned by this function is not guaranteed to be consistent between calls.\n ///\n /// @return tokens The supported yield tokens.\n function getSupportedYieldTokens() external view returns (address[] memory tokens);\n\n /// @notice Gets if an underlying token is supported.\n ///\n /// @param underlyingToken The address of the underlying token to check.\n ///\n /// @return isSupported If the underlying token is supported.\n function isSupportedUnderlyingToken(address underlyingToken) external view returns (bool isSupported);\n\n /// @notice Gets if a yield token is supported.\n ///\n /// @param yieldToken The address of the yield token to check.\n ///\n /// @return isSupported If the yield token is supported.\n function isSupportedYieldToken(address yieldToken) external view returns (bool isSupported);\n\n /// @notice Gets information about the account owned by `owner`.\n ///\n /// @param owner The address that owns the account.\n ///\n /// @return debt The unrealized amount of debt that the account had incurred.\n /// @return depositedTokens The yield tokens that the owner has deposited.\n function accounts(address owner) external view returns (int256 debt, address[] memory depositedTokens);\n\n /// @notice Gets information about a yield token position for the account owned by `owner`.\n ///\n /// @param owner The address that owns the account.\n /// @param yieldToken The address of the yield token to get the position of.\n ///\n /// @return shares The amount of shares of that `owner` owns of the yield token.\n /// @return lastAccruedWeight The last recorded accrued weight of the yield token.\n function positions(address owner, address yieldToken)\n external view\n returns (\n uint256 shares,\n uint256 lastAccruedWeight\n );\n\n /// @notice Gets the amount of debt tokens `spender` is allowed to mint on behalf of `owner`.\n ///\n /// @param owner The owner of the account.\n /// @param spender The address which is allowed to mint on behalf of `owner`.\n ///\n /// @return allowance The amount of debt tokens that `spender` can mint on behalf of `owner`.\n function mintAllowance(address owner, address spender) external view returns (uint256 allowance);\n\n /// @notice Gets the amount of shares of `yieldToken` that `spender` is allowed to withdraw on behalf of `owner`.\n ///\n /// @param owner The owner of the account.\n /// @param spender The address which is allowed to withdraw on behalf of `owner`.\n /// @param yieldToken The address of the yield token.\n ///\n /// @return allowance The amount of shares that `spender` can withdraw on behalf of `owner`.\n function withdrawAllowance(address owner, address spender, address yieldToken) external view returns (uint256 allowance);\n\n /// @notice Gets the parameters of an underlying token.\n ///\n /// @param underlyingToken The address of the underlying token.\n ///\n /// @return params The underlying token parameters.\n function getUnderlyingTokenParameters(address underlyingToken)\n external view\n returns (UnderlyingTokenParams memory params);\n\n /// @notice Get the parameters and state of a yield-token.\n ///\n /// @param yieldToken The address of the yield token.\n ///\n /// @return params The yield token parameters.\n function getYieldTokenParameters(address yieldToken)\n external view\n returns (YieldTokenParams memory params);\n\n /// @notice Gets current limit, maximum, and rate of the minting limiter.\n ///\n /// @return currentLimit The current amount of debt tokens that can be minted.\n /// @return rate The maximum possible amount of tokens that can be liquidated at a time.\n /// @return maximum The highest possible maximum amount of debt tokens that can be minted at a time.\n function getMintLimitInfo()\n external view\n returns (\n uint256 currentLimit,\n uint256 rate,\n uint256 maximum\n );\n\n /// @notice Gets current limit, maximum, and rate of a repay limiter for `underlyingToken`.\n ///\n /// @param underlyingToken The address of the underlying token.\n ///\n /// @return currentLimit The current amount of underlying tokens that can be repaid.\n /// @return rate The rate at which the the current limit increases back to its maximum in tokens per block.\n /// @return maximum The maximum possible amount of tokens that can be repaid at a time.\n function getRepayLimitInfo(address underlyingToken)\n external view\n returns (\n uint256 currentLimit,\n uint256 rate,\n uint256 maximum\n );\n\n /// @notice Gets current limit, maximum, and rate of the liquidation limiter for `underlyingToken`.\n ///\n /// @param underlyingToken The address of the underlying token.\n ///\n /// @return currentLimit The current amount of underlying tokens that can be liquidated.\n /// @return rate The rate at which the function increases back to its maximum limit (tokens / block).\n /// @return maximum The highest possible maximum amount of debt tokens that can be liquidated at a time.\n function getLiquidationLimitInfo(address underlyingToken)\n external view\n returns (\n uint256 currentLimit,\n uint256 rate,\n uint256 maximum\n );\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/IMigrationTool.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\n/// @title IMigrationTool\n/// @author Alchemix Finance\ninterface IMigrationTool {\n event Received(address, uint);\n\n /// @notice Gets the current version.\n ///\n /// @return The version.\n function version() external view returns (string memory);\n\n /// @notice Migrates 'shares' from 'startingVault' to 'targetVault'.\n ///\n /// @param startingYieldToken The yield token from which the user wants to withdraw.\n /// @param targetYieldToken The yield token that the user wishes to create a new position in.\n /// @param shares The shares of tokens to migrate.\n /// @param minReturnShares The maximum shares of slippage that the user will accept on new position.\n /// @param minReturnUnderlying The minimum underlying value when withdrawing from old position.\n ///\n /// @return finalShares The underlying Value of the new position.\n function migrateVaults(\n address startingYieldToken,\n address targetYieldToken,\n uint256 shares,\n uint256 minReturnShares,\n uint256 minReturnUnderlying\n ) external returns (uint256 finalShares);\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/external/IWETH9.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\nimport \"../../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\n\nimport \"../IERC20Metadata.sol\";\n\n/// @title IWETH9\ninterface IWETH9 is IERC20, IERC20Metadata {\n /// @notice Deposits `msg.value` ethereum into the contract and mints `msg.value` tokens.\n function deposit() external payable;\n\n /// @notice Burns `amount` tokens to retrieve `amount` ethereum from the contract.\n ///\n /// @dev This version of WETH utilizes the `transfer` function which hard codes the amount of gas\n /// that is allowed to be utilized to be exactly 2300 when receiving ethereum.\n ///\n /// @param amount The amount of tokens to burn.\n function withdraw(uint256 amount) external;\n}"
|
|
},
|
|
"submodules/v2-foundry/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/IERC20Burnable.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\nimport \"../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\n\n/// @title IERC20Burnable\n/// @author Alchemix Finance\ninterface IERC20Burnable is IERC20 {\n /// @notice Burns `amount` tokens from the balance of `msg.sender`.\n ///\n /// @param amount The amount of tokens to burn.\n ///\n /// @return If burning the tokens was successful.\n function burn(uint256 amount) external returns (bool);\n\n /// @notice Burns `amount` tokens from `owner`'s balance.\n ///\n /// @param owner The address to burn tokens from.\n /// @param amount The amount of tokens to burn.\n ///\n /// @return If burning the tokens was successful.\n function burnFrom(address owner, uint256 amount) external returns (bool);\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/IERC20Mintable.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\nimport \"../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\n\n/// @title IERC20Mintable\n/// @author Alchemix Finance\ninterface IERC20Mintable is IERC20 {\n /// @notice Mints `amount` tokens to `recipient`.\n ///\n /// @param recipient The address which will receive the minted tokens.\n /// @param amount The amount of tokens to mint.\n function mint(address recipient, uint256 amount) external;\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/alchemist/IAlchemistV2Actions.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\n/// @title IAlchemistV2Actions\n/// @author Alchemix Finance\n///\n/// @notice Specifies user actions.\ninterface IAlchemistV2Actions {\n /// @notice Approve `spender` to mint `amount` debt tokens.\n ///\n /// **_NOTE:_** This function is WHITELISTED.\n ///\n /// @param spender The address that will be approved to mint.\n /// @param amount The amount of tokens that `spender` will be allowed to mint.\n function approveMint(address spender, uint256 amount) external;\n\n /// @notice Approve `spender` to withdraw `amount` shares of `yieldToken`.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @param spender The address that will be approved to withdraw.\n /// @param yieldToken The address of the yield token that `spender` will be allowed to withdraw.\n /// @param shares The amount of shares that `spender` will be allowed to withdraw.\n function approveWithdraw(\n address spender,\n address yieldToken,\n uint256 shares\n ) external;\n\n /// @notice Synchronizes the state of the account owned by `owner`.\n ///\n /// @param owner The owner of the account to synchronize.\n function poke(address owner) external;\n\n /// @notice Deposit a yield token into a user's account.\n ///\n /// @notice An approval must be set for `yieldToken` which is greater than `amount`.\n ///\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice `yieldToken` must be enabled or this call will revert with a {TokenDisabled} error.\n /// @notice `yieldToken` underlying token must be enabled or this call will revert with a {TokenDisabled} error.\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice `amount` must be greater than zero or the call will revert with an {IllegalArgument} error.\n ///\n /// @notice Emits a {Deposit} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **_NOTE:_** When depositing, the `AlchemistV2` contract must have **allowance()** to spend funds on behalf of **msg.sender** for at least **amount** of the **yieldToken** being deposited. This can be done via the standard `ERC20.approve()` method.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 amount = 50000;\n /// @notice IERC20(ydai).approve(alchemistAddress, amount);\n /// @notice AlchemistV2(alchemistAddress).deposit(ydai, amount, msg.sender);\n /// @notice ```\n ///\n /// @param yieldToken The yield-token to deposit.\n /// @param amount The amount of yield tokens to deposit.\n /// @param recipient The owner of the account that will receive the resulting shares.\n ///\n /// @return sharesIssued The number of shares issued to `recipient`.\n function deposit(\n address yieldToken,\n uint256 amount,\n address recipient\n ) external returns (uint256 sharesIssued);\n\n /// @notice Deposit an underlying token into the account of `recipient` as `yieldToken`.\n ///\n /// @notice An approval must be set for the underlying token of `yieldToken` which is greater than `amount`.\n ///\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice `amount` must be greater than zero or the call will revert with an {IllegalArgument} error.\n ///\n /// @notice Emits a {Deposit} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n /// @notice **_NOTE:_** When depositing, the `AlchemistV2` contract must have **allowance()** to spend funds on behalf of **msg.sender** for at least **amount** of the **underlyingToken** being deposited. This can be done via the standard `ERC20.approve()` method.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 amount = 50000;\n /// @notice AlchemistV2(alchemistAddress).depositUnderlying(ydai, amount, msg.sender, 1);\n /// @notice ```\n ///\n /// @param yieldToken The address of the yield token to wrap the underlying tokens into.\n /// @param amount The amount of the underlying token to deposit.\n /// @param recipient The address of the recipient.\n /// @param minimumAmountOut The minimum amount of yield tokens that are expected to be deposited to `recipient`.\n ///\n /// @return sharesIssued The number of shares issued to `recipient`.\n function depositUnderlying(\n address yieldToken,\n uint256 amount,\n address recipient,\n uint256 minimumAmountOut\n ) external returns (uint256 sharesIssued);\n\n /// @notice Withdraw yield tokens to `recipient` by burning `share` shares. The number of yield tokens withdrawn to `recipient` will depend on the value of shares for that yield token at the time of the call.\n ///\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n ///\n /// @notice Emits a {Withdraw} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 pps = AlchemistV2(alchemistAddress).getYieldTokensPerShare(ydai);\n /// @notice uint256 amtYieldTokens = 5000;\n /// @notice AlchemistV2(alchemistAddress).withdraw(ydai, amtYieldTokens / pps, msg.sender);\n /// @notice ```\n ///\n /// @param yieldToken The address of the yield token to withdraw.\n /// @param shares The number of shares to burn.\n /// @param recipient The address of the recipient.\n ///\n /// @return amountWithdrawn The number of yield tokens that were withdrawn to `recipient`.\n function withdraw(\n address yieldToken,\n uint256 shares,\n address recipient\n ) external returns (uint256 amountWithdrawn);\n\n /// @notice Withdraw yield tokens to `recipient` by burning `share` shares from the account of `owner`\n ///\n /// @notice `owner` must have an withdrawal allowance which is greater than `amount` for this call to succeed.\n ///\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n ///\n /// @notice Emits a {Withdraw} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 pps = AlchemistV2(alchemistAddress).getYieldTokensPerShare(ydai);\n /// @notice uint256 amtYieldTokens = 5000;\n /// @notice AlchemistV2(alchemistAddress).withdrawFrom(msg.sender, ydai, amtYieldTokens / pps, msg.sender);\n /// @notice ```\n ///\n /// @param owner The address of the account owner to withdraw from.\n /// @param yieldToken The address of the yield token to withdraw.\n /// @param shares The number of shares to burn.\n /// @param recipient The address of the recipient.\n ///\n /// @return amountWithdrawn The number of yield tokens that were withdrawn to `recipient`.\n function withdrawFrom(\n address owner,\n address yieldToken,\n uint256 shares,\n address recipient\n ) external returns (uint256 amountWithdrawn);\n\n /// @notice Withdraw underlying tokens to `recipient` by burning `share` shares and unwrapping the yield tokens that the shares were redeemed for.\n ///\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error.\n ///\n /// @notice Emits a {Withdraw} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n /// @notice **_NOTE:_** The caller of `withdrawFrom()` must have **withdrawAllowance()** to withdraw funds on behalf of **owner** for at least the amount of `yieldTokens` that **shares** will be converted to. This can be done via the `approveWithdraw()` or `permitWithdraw()` methods.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 pps = AlchemistV2(alchemistAddress).getUnderlyingTokensPerShare(ydai);\n /// @notice uint256 amountUnderlyingTokens = 5000;\n /// @notice AlchemistV2(alchemistAddress).withdrawUnderlying(ydai, amountUnderlyingTokens / pps, msg.sender, 1);\n /// @notice ```\n ///\n /// @param yieldToken The address of the yield token to withdraw.\n /// @param shares The number of shares to burn.\n /// @param recipient The address of the recipient.\n /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`.\n ///\n /// @return amountWithdrawn The number of underlying tokens that were withdrawn to `recipient`.\n function withdrawUnderlying(\n address yieldToken,\n uint256 shares,\n address recipient,\n uint256 minimumAmountOut\n ) external returns (uint256 amountWithdrawn);\n\n /// @notice Withdraw underlying tokens to `recipient` by burning `share` shares from the account of `owner` and unwrapping the yield tokens that the shares were redeemed for.\n ///\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error.\n ///\n /// @notice Emits a {Withdraw} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n /// @notice **_NOTE:_** The caller of `withdrawFrom()` must have **withdrawAllowance()** to withdraw funds on behalf of **owner** for at least the amount of `yieldTokens` that **shares** will be converted to. This can be done via the `approveWithdraw()` or `permitWithdraw()` methods.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 pps = AlchemistV2(alchemistAddress).getUnderlyingTokensPerShare(ydai);\n /// @notice uint256 amtUnderlyingTokens = 5000 * 10**ydai.decimals();\n /// @notice AlchemistV2(alchemistAddress).withdrawUnderlying(msg.sender, ydai, amtUnderlyingTokens / pps, msg.sender, 1);\n /// @notice ```\n ///\n /// @param owner The address of the account owner to withdraw from.\n /// @param yieldToken The address of the yield token to withdraw.\n /// @param shares The number of shares to burn.\n /// @param recipient The address of the recipient.\n /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`.\n ///\n /// @return amountWithdrawn The number of underlying tokens that were withdrawn to `recipient`.\n function withdrawUnderlyingFrom(\n address owner,\n address yieldToken,\n uint256 shares,\n address recipient,\n uint256 minimumAmountOut\n ) external returns (uint256 amountWithdrawn);\n\n /// @notice Mint `amount` debt tokens.\n ///\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error.\n ///\n /// @notice Emits a {Mint} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice uint256 amtDebt = 5000;\n /// @notice AlchemistV2(alchemistAddress).mint(amtDebt, msg.sender);\n /// @notice ```\n ///\n /// @param amount The amount of tokens to mint.\n /// @param recipient The address of the recipient.\n function mint(uint256 amount, address recipient) external;\n\n /// @notice Mint `amount` debt tokens from the account owned by `owner` to `recipient`.\n ///\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error.\n ///\n /// @notice Emits a {Mint} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n /// @notice **_NOTE:_** The caller of `mintFrom()` must have **mintAllowance()** to mint debt from the `Account` controlled by **owner** for at least the amount of **yieldTokens** that **shares** will be converted to. This can be done via the `approveMint()` or `permitMint()` methods.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice uint256 amtDebt = 5000;\n /// @notice AlchemistV2(alchemistAddress).mintFrom(msg.sender, amtDebt, msg.sender);\n /// @notice ```\n ///\n /// @param owner The address of the owner of the account to mint from.\n /// @param amount The amount of tokens to mint.\n /// @param recipient The address of the recipient.\n function mintFrom(\n address owner,\n uint256 amount,\n address recipient\n ) external;\n\n /// @notice Burn `amount` debt tokens to credit the account owned by `recipient`.\n ///\n /// @notice `amount` will be limited up to the amount of debt that `recipient` currently holds.\n ///\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error.\n /// @notice `recipient` must have non-zero debt or this call will revert with an {IllegalState} error.\n ///\n /// @notice Emits a {Burn} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice uint256 amtBurn = 5000;\n /// @notice AlchemistV2(alchemistAddress).burn(amtBurn, msg.sender);\n /// @notice ```\n ///\n /// @param amount The amount of tokens to burn.\n /// @param recipient The address of the recipient.\n ///\n /// @return amountBurned The amount of tokens that were burned.\n function burn(uint256 amount, address recipient) external returns (uint256 amountBurned);\n\n /// @notice Repay `amount` debt using `underlyingToken` to credit the account owned by `recipient`.\n ///\n /// @notice `amount` will be limited up to the amount of debt that `recipient` currently holds.\n ///\n /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error.\n /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error.\n /// @notice `underlyingToken` must be enabled or this call will revert with a {TokenDisabled} error.\n /// @notice `amount` must be less than or equal to the current available repay limit or this call will revert with a {ReplayLimitExceeded} error.\n ///\n /// @notice Emits a {Repay} event.\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address dai = 0x6b175474e89094c44da98b954eedeac495271d0f;\n /// @notice uint256 amtRepay = 5000;\n /// @notice AlchemistV2(alchemistAddress).repay(dai, amtRepay, msg.sender);\n /// @notice ```\n ///\n /// @param underlyingToken The address of the underlying token to repay.\n /// @param amount The amount of the underlying token to repay.\n /// @param recipient The address of the recipient which will receive credit.\n ///\n /// @return amountRepaid The amount of tokens that were repaid.\n function repay(\n address underlyingToken,\n uint256 amount,\n address recipient\n ) external returns (uint256 amountRepaid);\n\n /// @notice\n ///\n /// @notice `shares` will be limited up to an equal amount of debt that `recipient` currently holds.\n ///\n /// @notice `shares` must be greater than zero or this call will revert with a {IllegalArgument} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice `yieldToken` must be enabled or this call will revert with a {TokenDisabled} error.\n /// @notice `yieldToken` underlying token must be enabled or this call will revert with a {TokenDisabled} error.\n /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error.\n /// @notice `amount` must be less than or equal to the current available liquidation limit or this call will revert with a {LiquidationLimitExceeded} error.\n ///\n /// @notice Emits a {Liquidate} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 amtSharesLiquidate = 5000 * 10**ydai.decimals();\n /// @notice AlchemistV2(alchemistAddress).liquidate(ydai, amtSharesLiquidate, 1);\n /// @notice ```\n ///\n /// @param yieldToken The address of the yield token to liquidate.\n /// @param shares The number of shares to burn for credit.\n /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be liquidated.\n ///\n /// @return sharesLiquidated The amount of shares that were liquidated.\n function liquidate(\n address yieldToken,\n uint256 shares,\n uint256 minimumAmountOut\n ) external returns (uint256 sharesLiquidated);\n\n /// @notice Burns `amount` debt tokens to credit accounts which have deposited `yieldToken`.\n ///\n /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @notice Emits a {Donate} event.\n ///\n /// @notice **_NOTE:_** This function is WHITELISTED.\n ///\n /// @notice **Example:**\n /// @notice ```\n /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95;\n /// @notice uint256 amtSharesLiquidate = 5000;\n /// @notice AlchemistV2(alchemistAddress).liquidate(dai, amtSharesLiquidate, 1);\n /// @notice ```\n ///\n /// @param yieldToken The address of the yield token to credit accounts for.\n /// @param amount The amount of debt tokens to burn.\n function donate(address yieldToken, uint256 amount) external;\n\n /// @notice Harvests outstanding yield that a yield token has accumulated and distributes it as credit to holders.\n ///\n /// @notice `msg.sender` must be a keeper or this call will revert with an {Unauthorized} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice The amount being harvested must be greater than zero or else this call will revert with an {IllegalState} error.\n ///\n /// @notice Emits a {Harvest} event.\n ///\n /// @param yieldToken The address of the yield token to harvest.\n /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`.\n function harvest(address yieldToken, uint256 minimumAmountOut) external;\n}\n"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/alchemist/IAlchemistV2AdminActions.sol": {
|
|
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.5.0;\n\n/// @title IAlchemistV2AdminActions\n/// @author Alchemix Finance\n///\n/// @notice Specifies admin and or sentinel actions.\ninterface IAlchemistV2AdminActions {\n /// @notice Contract initialization parameters.\n struct InitializationParams {\n // The initial admin account.\n address admin;\n // The ERC20 token used to represent debt.\n address debtToken;\n // The initial transmuter or transmuter buffer.\n address transmuter;\n // The minimum collateralization ratio that an account must maintain.\n uint256 minimumCollateralization;\n // The percentage fee taken from each harvest measured in units of basis points.\n uint256 protocolFee;\n // The address that receives protocol fees.\n address protocolFeeReceiver;\n // A limit used to prevent administrators from making minting functionality inoperable.\n uint256 mintingLimitMinimum;\n // The maximum number of tokens that can be minted per period of time.\n uint256 mintingLimitMaximum;\n // The number of blocks that it takes for the minting limit to be refreshed.\n uint256 mintingLimitBlocks;\n // The address of the whitelist.\n address whitelist;\n }\n\n /// @notice Configuration parameters for an underlying token.\n struct UnderlyingTokenConfig {\n // A limit used to prevent administrators from making repayment functionality inoperable.\n uint256 repayLimitMinimum;\n // The maximum number of underlying tokens that can be repaid per period of time.\n uint256 repayLimitMaximum;\n // The number of blocks that it takes for the repayment limit to be refreshed.\n uint256 repayLimitBlocks;\n // A limit used to prevent administrators from making liquidation functionality inoperable.\n uint256 liquidationLimitMinimum;\n // The maximum number of underlying tokens that can be liquidated per period of time.\n uint256 liquidationLimitMaximum;\n // The number of blocks that it takes for the liquidation limit to be refreshed.\n uint256 liquidationLimitBlocks;\n }\n\n /// @notice Configuration parameters of a yield token.\n struct YieldTokenConfig {\n // The adapter used by the system to interop with the token.\n address adapter;\n // The maximum percent loss in expected value that can occur before certain actions are disabled measured in\n // units of basis points.\n uint256 maximumLoss;\n // The maximum value that can be held by the system before certain actions are disabled measured in the\n // underlying token.\n uint256 maximumExpectedValue;\n // The number of blocks that credit will be distributed over to depositors.\n uint256 creditUnlockBlocks;\n }\n\n /// @notice Initialize the contract.\n ///\n /// @notice `params.protocolFee` must be in range or this call will with an {IllegalArgument} error.\n /// @notice The minting growth limiter parameters must be valid or this will revert with an {IllegalArgument} error. For more information, see the {Limiters} library.\n ///\n /// @notice Emits an {AdminUpdated} event.\n /// @notice Emits a {TransmuterUpdated} event.\n /// @notice Emits a {MinimumCollateralizationUpdated} event.\n /// @notice Emits a {ProtocolFeeUpdated} event.\n /// @notice Emits a {ProtocolFeeReceiverUpdated} event.\n /// @notice Emits a {MintingLimitUpdated} event.\n ///\n /// @param params The contract initialization parameters.\n function initialize(InitializationParams memory params) external;\n\n /// @notice Sets the pending administrator.\n ///\n /// @notice `msg.sender` must be the admin or this call will will revert with an {Unauthorized} error.\n ///\n /// @notice Emits a {PendingAdminUpdated} event.\n ///\n /// @dev This is the first step in the two-step process of setting a new administrator. After this function is called, the pending administrator will then need to call {acceptAdmin} to complete the process.\n ///\n /// @param value the address to set the pending admin to.\n function setPendingAdmin(address value) external;\n\n /// @notice Allows for `msg.sender` to accepts the role of administrator.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice The current pending administrator must be non-zero or this call will revert with an {IllegalState} error.\n ///\n /// @dev This is the second step in the two-step process of setting a new administrator. After this function is successfully called, this pending administrator will be reset and the new administrator will be set.\n ///\n /// @notice Emits a {AdminUpdated} event.\n /// @notice Emits a {PendingAdminUpdated} event.\n function acceptAdmin() external;\n\n /// @notice Sets an address as a sentinel.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n ///\n /// @param sentinel The address to set or unset as a sentinel.\n /// @param flag A flag indicating of the address should be set or unset as a sentinel.\n function setSentinel(address sentinel, bool flag) external;\n\n /// @notice Sets an address as a keeper.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n ///\n /// @param keeper The address to set or unset as a keeper.\n /// @param flag A flag indicating of the address should be set or unset as a keeper.\n function setKeeper(address keeper, bool flag) external;\n\n /// @notice Adds an underlying token to the system.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n ///\n /// @param underlyingToken The address of the underlying token to add.\n /// @param config The initial underlying token configuration.\n function addUnderlyingToken(\n address underlyingToken,\n UnderlyingTokenConfig calldata config\n ) external;\n\n /// @notice Adds a yield token to the system.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n ///\n /// @notice Emits a {AddYieldToken} event.\n /// @notice Emits a {TokenAdapterUpdated} event.\n /// @notice Emits a {MaximumLossUpdated} event.\n ///\n /// @param yieldToken The address of the yield token to add.\n /// @param config The initial yield token configuration.\n function addYieldToken(address yieldToken, YieldTokenConfig calldata config)\n external;\n\n /// @notice Sets an underlying token as either enabled or disabled.\n ///\n /// @notice `msg.sender` must be either the admin or a sentinel or this call will revert with an {Unauthorized} error.\n /// @notice `underlyingToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @notice Emits an {UnderlyingTokenEnabled} event.\n ///\n /// @param underlyingToken The address of the underlying token to enable or disable.\n /// @param enabled If the underlying token should be enabled or disabled.\n function setUnderlyingTokenEnabled(address underlyingToken, bool enabled)\n external;\n\n /// @notice Sets a yield token as either enabled or disabled.\n ///\n /// @notice `msg.sender` must be either the admin or a sentinel or this call will revert with an {Unauthorized} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @notice Emits a {YieldTokenEnabled} event.\n ///\n /// @param yieldToken The address of the yield token to enable or disable.\n /// @param enabled If the underlying token should be enabled or disabled.\n function setYieldTokenEnabled(address yieldToken, bool enabled) external;\n\n /// @notice Configures the the repay limit of `underlyingToken`.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `underlyingToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @notice Emits a {ReplayLimitUpdated} event.\n ///\n /// @param underlyingToken The address of the underlying token to configure the repay limit of.\n /// @param maximum The maximum repay limit.\n /// @param blocks The number of blocks it will take for the maximum repayment limit to be replenished when it is completely exhausted.\n function configureRepayLimit(\n address underlyingToken,\n uint256 maximum,\n uint256 blocks\n ) external;\n\n /// @notice Configure the liquidation limiter of `underlyingToken`.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `underlyingToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @notice Emits a {LiquidationLimitUpdated} event.\n ///\n /// @param underlyingToken The address of the underlying token to configure the liquidation limit of.\n /// @param maximum The maximum liquidation limit.\n /// @param blocks The number of blocks it will take for the maximum liquidation limit to be replenished when it is completely exhausted.\n function configureLiquidationLimit(\n address underlyingToken,\n uint256 maximum,\n uint256 blocks\n ) external;\n\n /// @notice Set the address of the transmuter.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `value` must be non-zero or this call will revert with an {IllegalArgument} error.\n ///\n /// @notice Emits a {TransmuterUpdated} event.\n ///\n /// @param value The address of the transmuter.\n function setTransmuter(address value) external;\n\n /// @notice Set the minimum collateralization ratio.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n ///\n /// @notice Emits a {MinimumCollateralizationUpdated} event.\n ///\n /// @param value The new minimum collateralization ratio.\n function setMinimumCollateralization(uint256 value) external;\n\n /// @notice Sets the fee that the protocol will take from harvests.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `value` must be in range or this call will with an {IllegalArgument} error.\n ///\n /// @notice Emits a {ProtocolFeeUpdated} event.\n ///\n /// @param value The value to set the protocol fee to measured in basis points.\n function setProtocolFee(uint256 value) external;\n\n /// @notice Sets the address which will receive protocol fees.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `value` must be non-zero or this call will revert with an {IllegalArgument} error.\n ///\n /// @notice Emits a {ProtocolFeeReceiverUpdated} event.\n ///\n /// @param value The address to set the protocol fee receiver to.\n function setProtocolFeeReceiver(address value) external;\n\n /// @notice Configures the minting limiter.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n ///\n /// @notice Emits a {MintingLimitUpdated} event.\n ///\n /// @param maximum The maximum minting limit.\n /// @param blocks The number of blocks it will take for the maximum minting limit to be replenished when it is completely exhausted.\n function configureMintingLimit(uint256 maximum, uint256 blocks) external;\n\n /// @notice Sets the rate at which credit will be completely available to depositors after it is harvested.\n ///\n /// @notice Emits a {CreditUnlockRateUpdated} event.\n ///\n /// @param yieldToken The address of the yield token to set the credit unlock rate for.\n /// @param blocks The number of blocks that it will take before the credit will be unlocked.\n function configureCreditUnlockRate(address yieldToken, uint256 blocks) external;\n\n /// @notice Sets the token adapter of a yield token.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n /// @notice The token that `adapter` supports must be `yieldToken` or this call will revert with a {IllegalState} error.\n ///\n /// @notice Emits a {TokenAdapterUpdated} event.\n ///\n /// @param yieldToken The address of the yield token to set the adapter for.\n /// @param adapter The address to set the token adapter to.\n function setTokenAdapter(address yieldToken, address adapter) external;\n\n /// @notice Sets the maximum expected value of a yield token that the system can hold.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @param yieldToken The address of the yield token to set the maximum expected value for.\n /// @param value The maximum expected value of the yield token denoted measured in its underlying token.\n function setMaximumExpectedValue(address yieldToken, uint256 value)\n external;\n\n /// @notice Sets the maximum loss that a yield bearing token will permit before restricting certain actions.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @dev There are two types of loss of value for yield bearing assets: temporary or permanent. The system will automatically restrict actions which are sensitive to both forms of loss when detected. For example, deposits must be restricted when an excessive loss is encountered to prevent users from having their collateral harvested from them. While the user would receive credit, which then could be exchanged for value equal to the collateral that was harvested from them, it is seen as a negative user experience because the value of their collateral should have been higher than what was originally recorded when they made their deposit.\n ///\n /// @param yieldToken The address of the yield bearing token to set the maximum loss for.\n /// @param value The value to set the maximum loss to. This is in units of basis points.\n function setMaximumLoss(address yieldToken, uint256 value) external;\n\n /// @notice Snap the expected value `yieldToken` to the current value.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.\n ///\n /// @dev This function should only be used in the event of a loss in the target yield-token. For example, say a third-party protocol experiences a fifty percent loss. The expected value (amount of underlying tokens) of the yield tokens being held by the system would be two times the real value that those yield tokens could be redeemed for. This function gives governance a way to realize those losses so that users can continue using the token as normal.\n ///\n /// @param yieldToken The address of the yield token to snap.\n function snap(address yieldToken) external;\n\n /// @notice Sweep all of 'rewardtoken' from the alchemist into the admin.\n ///\n /// @notice `msg.sender` must be the admin or this call will revert with an {Unauthorized} error.\n /// @notice `rewardToken` must not be a yield or underlying token or this call will revert with a {UnsupportedToken} error.\n ///\n /// @param rewardToken The address of the reward token to snap.\n /// @param amount The amount of 'rewardToken' to sweep to the admin.\n function sweepTokens(address rewardToken, uint256 amount) external ;\n}\n"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/alchemist/IAlchemistV2Errors.sol": {
|
|
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.5.0;\n\n/// @title IAlchemistV2Errors\n/// @author Alchemix Finance\n///\n/// @notice Specifies errors.\ninterface IAlchemistV2Errors {\n /// @notice An error which is used to indicate that an operation failed because it tried to operate on a token that the system did not recognize.\n ///\n /// @param token The address of the token.\n error UnsupportedToken(address token);\n\n /// @notice An error which is used to indicate that an operation failed because it tried to operate on a token that has been disabled.\n ///\n /// @param token The address of the token.\n error TokenDisabled(address token);\n\n /// @notice An error which is used to indicate that an operation failed because an account became undercollateralized.\n error Undercollateralized();\n\n /// @notice An error which is used to indicate that an operation failed because the expected value of a yield token in the system exceeds the maximum value permitted.\n ///\n /// @param yieldToken The address of the yield token.\n /// @param expectedValue The expected value measured in units of the underlying token.\n /// @param maximumExpectedValue The maximum expected value permitted measured in units of the underlying token.\n error ExpectedValueExceeded(address yieldToken, uint256 expectedValue, uint256 maximumExpectedValue);\n\n /// @notice An error which is used to indicate that an operation failed because the loss that a yield token in the system exceeds the maximum value permitted.\n ///\n /// @param yieldToken The address of the yield token.\n /// @param loss The amount of loss measured in basis points.\n /// @param maximumLoss The maximum amount of loss permitted measured in basis points.\n error LossExceeded(address yieldToken, uint256 loss, uint256 maximumLoss);\n\n /// @notice An error which is used to indicate that a minting operation failed because the minting limit has been exceeded.\n ///\n /// @param amount The amount of debt tokens that were requested to be minted.\n /// @param available The amount of debt tokens which are available to mint.\n error MintingLimitExceeded(uint256 amount, uint256 available);\n\n /// @notice An error which is used to indicate that an repay operation failed because the repay limit for an underlying token has been exceeded.\n ///\n /// @param underlyingToken The address of the underlying token.\n /// @param amount The amount of underlying tokens that were requested to be repaid.\n /// @param available The amount of underlying tokens that are available to be repaid.\n error RepayLimitExceeded(address underlyingToken, uint256 amount, uint256 available);\n\n /// @notice An error which is used to indicate that an repay operation failed because the liquidation limit for an underlying token has been exceeded.\n ///\n /// @param underlyingToken The address of the underlying token.\n /// @param amount The amount of underlying tokens that were requested to be liquidated.\n /// @param available The amount of underlying tokens that are available to be liquidated.\n error LiquidationLimitExceeded(address underlyingToken, uint256 amount, uint256 available);\n\n /// @notice An error which is used to indicate that the slippage of a wrap or unwrap operation was exceeded.\n ///\n /// @param amount The amount of underlying or yield tokens returned by the operation.\n /// @param minimumAmountOut The minimum amount of the underlying or yield token that was expected when performing\n /// the operation.\n error SlippageExceeded(uint256 amount, uint256 minimumAmountOut);\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/alchemist/IAlchemistV2Immutables.sol": {
|
|
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.5.0;\n\n/// @title IAlchemistV2Immutables\n/// @author Alchemix Finance\ninterface IAlchemistV2Immutables {\n /// @notice Returns the version of the alchemist.\n ///\n /// @return The version.\n function version() external view returns (string memory);\n\n /// @notice Returns the address of the debt token used by the system.\n ///\n /// @return The address of the debt token.\n function debtToken() external view returns (address);\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/alchemist/IAlchemistV2Events.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\n/// @title IAlchemistV2Events\n/// @author Alchemix Finance\ninterface IAlchemistV2Events {\n /// @notice Emitted when the pending admin is updated.\n ///\n /// @param pendingAdmin The address of the pending admin.\n event PendingAdminUpdated(address pendingAdmin);\n\n /// @notice Emitted when the administrator is updated.\n ///\n /// @param admin The address of the administrator.\n event AdminUpdated(address admin);\n\n /// @notice Emitted when an address is set or unset as a sentinel.\n ///\n /// @param sentinel The address of the sentinel.\n /// @param flag A flag indicating if `sentinel` was set or unset as a sentinel.\n event SentinelSet(address sentinel, bool flag);\n\n /// @notice Emitted when an address is set or unset as a keeper.\n ///\n /// @param sentinel The address of the keeper.\n /// @param flag A flag indicating if `keeper` was set or unset as a sentinel.\n event KeeperSet(address sentinel, bool flag);\n\n /// @notice Emitted when an underlying token is added.\n ///\n /// @param underlyingToken The address of the underlying token that was added.\n event AddUnderlyingToken(address indexed underlyingToken);\n\n /// @notice Emitted when a yield token is added.\n ///\n /// @param yieldToken The address of the yield token that was added.\n event AddYieldToken(address indexed yieldToken);\n\n /// @notice Emitted when an underlying token is enabled or disabled.\n ///\n /// @param underlyingToken The address of the underlying token that was enabled or disabled.\n /// @param enabled A flag indicating if the underlying token was enabled or disabled.\n event UnderlyingTokenEnabled(address indexed underlyingToken, bool enabled);\n\n /// @notice Emitted when an yield token is enabled or disabled.\n ///\n /// @param yieldToken The address of the yield token that was enabled or disabled.\n /// @param enabled A flag indicating if the yield token was enabled or disabled.\n event YieldTokenEnabled(address indexed yieldToken, bool enabled);\n\n /// @notice Emitted when the repay limit of an underlying token is updated.\n ///\n /// @param underlyingToken The address of the underlying token.\n /// @param maximum The updated maximum repay limit.\n /// @param blocks The updated number of blocks it will take for the maximum repayment limit to be replenished when it is completely exhausted.\n event RepayLimitUpdated(address indexed underlyingToken, uint256 maximum, uint256 blocks);\n\n /// @notice Emitted when the liquidation limit of an underlying token is updated.\n ///\n /// @param underlyingToken The address of the underlying token.\n /// @param maximum The updated maximum liquidation limit.\n /// @param blocks The updated number of blocks it will take for the maximum liquidation limit to be replenished when it is completely exhausted.\n event LiquidationLimitUpdated(address indexed underlyingToken, uint256 maximum, uint256 blocks);\n\n /// @notice Emitted when the transmuter is updated.\n ///\n /// @param transmuter The updated address of the transmuter.\n event TransmuterUpdated(address transmuter);\n\n /// @notice Emitted when the minimum collateralization is updated.\n ///\n /// @param minimumCollateralization The updated minimum collateralization.\n event MinimumCollateralizationUpdated(uint256 minimumCollateralization);\n\n /// @notice Emitted when the protocol fee is updated.\n ///\n /// @param protocolFee The updated protocol fee.\n event ProtocolFeeUpdated(uint256 protocolFee);\n \n /// @notice Emitted when the protocol fee receiver is updated.\n ///\n /// @param protocolFeeReceiver The updated address of the protocol fee receiver.\n event ProtocolFeeReceiverUpdated(address protocolFeeReceiver);\n\n /// @notice Emitted when the minting limit is updated.\n ///\n /// @param maximum The updated maximum minting limit.\n /// @param blocks The updated number of blocks it will take for the maximum minting limit to be replenished when it is completely exhausted.\n event MintingLimitUpdated(uint256 maximum, uint256 blocks);\n\n /// @notice Emitted when the credit unlock rate is updated.\n ///\n /// @param yieldToken The address of the yield token.\n /// @param blocks The number of blocks that distributed credit will unlock over.\n event CreditUnlockRateUpdated(address yieldToken, uint256 blocks);\n\n /// @notice Emitted when the adapter of a yield token is updated.\n ///\n /// @param yieldToken The address of the yield token.\n /// @param tokenAdapter The updated address of the token adapter.\n event TokenAdapterUpdated(address yieldToken, address tokenAdapter);\n\n /// @notice Emitted when the maximum expected value of a yield token is updated.\n ///\n /// @param yieldToken The address of the yield token.\n /// @param maximumExpectedValue The updated maximum expected value.\n event MaximumExpectedValueUpdated(address indexed yieldToken, uint256 maximumExpectedValue);\n\n /// @notice Emitted when the maximum loss of a yield token is updated.\n ///\n /// @param yieldToken The address of the yield token.\n /// @param maximumLoss The updated maximum loss.\n event MaximumLossUpdated(address indexed yieldToken, uint256 maximumLoss);\n\n /// @notice Emitted when the expected value of a yield token is snapped to its current value.\n ///\n /// @param yieldToken The address of the yield token.\n /// @param expectedValue The updated expected value measured in the yield token's underlying token.\n event Snap(address indexed yieldToken, uint256 expectedValue);\n\n /// @notice Emitted when a the admin sweeps all of one reward token from the Alchemist\n ///\n /// @param rewardToken The address of the reward token.\n /// @param amount The amount of 'rewardToken' swept into the admin.\n event SweepTokens(address indexed rewardToken, uint256 amount);\n\n /// @notice Emitted when `owner` grants `spender` the ability to mint debt tokens on its behalf.\n ///\n /// @param owner The address of the account owner.\n /// @param spender The address which is being permitted to mint tokens on the behalf of `owner`.\n /// @param amount The amount of debt tokens that `spender` is allowed to mint.\n event ApproveMint(address indexed owner, address indexed spender, uint256 amount);\n\n /// @notice Emitted when `owner` grants `spender` the ability to withdraw `yieldToken` from its account.\n ///\n /// @param owner The address of the account owner.\n /// @param spender The address which is being permitted to mint tokens on the behalf of `owner`.\n /// @param yieldToken The address of the yield token that `spender` is allowed to withdraw.\n /// @param amount The amount of shares of `yieldToken` that `spender` is allowed to withdraw.\n event ApproveWithdraw(address indexed owner, address indexed spender, address indexed yieldToken, uint256 amount);\n\n /// @notice Emitted when a user deposits `amount of `yieldToken` to `recipient`.\n ///\n /// @notice This event does not imply that `sender` directly deposited yield tokens. It is possible that the\n /// underlying tokens were wrapped.\n ///\n /// @param sender The address of the user which deposited funds.\n /// @param yieldToken The address of the yield token that was deposited.\n /// @param amount The amount of yield tokens that were deposited.\n /// @param recipient The address that received the deposited funds.\n event Deposit(address indexed sender, address indexed yieldToken, uint256 amount, address recipient);\n\n /// @notice Emitted when `shares` shares of `yieldToken` are burned to withdraw `yieldToken` from the account owned\n /// by `owner` to `recipient`.\n ///\n /// @notice This event does not imply that `recipient` received yield tokens. It is possible that the yield tokens\n /// were unwrapped.\n ///\n /// @param owner The address of the account owner.\n /// @param yieldToken The address of the yield token that was withdrawn.\n /// @param shares The amount of shares that were burned.\n /// @param recipient The address that received the withdrawn funds.\n event Withdraw(address indexed owner, address indexed yieldToken, uint256 shares, address recipient);\n\n /// @notice Emitted when `amount` debt tokens are minted to `recipient` using the account owned by `owner`.\n ///\n /// @param owner The address of the account owner.\n /// @param amount The amount of tokens that were minted.\n /// @param recipient The recipient of the minted tokens.\n event Mint(address indexed owner, uint256 amount, address recipient);\n\n /// @notice Emitted when `sender` burns `amount` debt tokens to grant credit to `recipient`.\n ///\n /// @param sender The address which is burning tokens.\n /// @param amount The amount of tokens that were burned.\n /// @param recipient The address that received credit for the burned tokens.\n event Burn(address indexed sender, uint256 amount, address recipient);\n\n /// @notice Emitted when `amount` of `underlyingToken` are repaid to grant credit to `recipient`.\n ///\n /// @param sender The address which is repaying tokens.\n /// @param underlyingToken The address of the underlying token that was used to repay debt.\n /// @param amount The amount of the underlying token that was used to repay debt.\n /// @param recipient The address that received credit for the repaid tokens.\n /// @param credit The amount of debt that was paid-off to the account owned by owner.\n event Repay(address indexed sender, address indexed underlyingToken, uint256 amount, address recipient, uint256 credit);\n\n /// @notice Emitted when `sender` liquidates `share` shares of `yieldToken`.\n ///\n /// @param owner The address of the account owner liquidating shares.\n /// @param yieldToken The address of the yield token.\n /// @param underlyingToken The address of the underlying token.\n /// @param shares The amount of the shares of `yieldToken` that were liquidated.\n /// @param credit The amount of debt that was paid-off to the account owned by owner.\n event Liquidate(address indexed owner, address indexed yieldToken, address indexed underlyingToken, uint256 shares, uint256 credit);\n\n /// @notice Emitted when `sender` burns `amount` debt tokens to grant credit to users who have deposited `yieldToken`.\n ///\n /// @param sender The address which burned debt tokens.\n /// @param yieldToken The address of the yield token.\n /// @param amount The amount of debt tokens which were burned.\n event Donate(address indexed sender, address indexed yieldToken, uint256 amount);\n\n /// @notice Emitted when `yieldToken` is harvested.\n ///\n /// @param yieldToken The address of the yield token that was harvested.\n /// @param minimumAmountOut The maximum amount of loss that is acceptable when unwrapping the underlying tokens into yield tokens, measured in basis points.\n /// @param totalHarvested The total amount of underlying tokens harvested.\n /// @param credit The total amount of debt repaid to depositors of `yieldToken`.\n event Harvest(address indexed yieldToken, uint256 minimumAmountOut, uint256 totalHarvested, uint256 credit);\n}"
|
|
},
|
|
"submodules/v2-foundry/src/interfaces/IERC20Metadata.sol": {
|
|
"content": "pragma solidity >=0.5.0;\n\n/// @title IERC20Metadata\n/// @author Alchemix Finance\ninterface IERC20Metadata {\n /// @notice Gets the name of the token.\n ///\n /// @return The name.\n function name() external view returns (string memory);\n\n /// @notice Gets the symbol of the token.\n ///\n /// @return The symbol.\n function symbol() external view returns (string memory);\n\n /// @notice Gets the number of decimals that the token has.\n ///\n /// @return The number of decimals.\n function decimals() external view returns (uint8);\n}"
|
|
}
|
|
},
|
|
"settings": {
|
|
"optimizer": {
|
|
"enabled": true,
|
|
"runs": 200
|
|
},
|
|
"outputSelection": {
|
|
"*": {
|
|
"*": [
|
|
"evm.bytecode",
|
|
"evm.deployedBytecode",
|
|
"devdoc",
|
|
"userdoc",
|
|
"metadata",
|
|
"abi"
|
|
]
|
|
}
|
|
},
|
|
"metadata": {
|
|
"useLiteralContent": true
|
|
},
|
|
"libraries": {}
|
|
}
|
|
} |