Verified contractExactAGPL-3.0-only
TreasuryOperatingFunder
Address0xbfb0ecedb3bdfd80b1f926a99fc39b263ccaa2dd
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- AGPL-3.0-only
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,341,207
- Creation transaction
- 0x756a4c516e…ce25ba21cf
13 files
- src/executor-guard/TreasuryOperatingFunder.solmain10.26 KB
- node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol3.13 KB
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.74 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol2.26 KB
- node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol6.91 KB
- node_modules/@openzeppelin/contracts/utils/Address.sol9.36 KB
- node_modules/@openzeppelin/contracts/utils/math/Math.sol12.79 KB
- node_modules/@stake-dao/address-book/src/CurveEthereum.sol5.56 KB
- node_modules/@stake-dao/address-book/src/ExternalEthereum.sol2.87 KB
- node_modules/@stake-dao/address-book/src/ExternalUniversal.sol1.13 KB
- node_modules/@stake-dao/address-book/src/SDEthereum.sol19.99 KB
- src/executor-guard/AllMightModule.sol505 B
- src/executor-guard/Governed.sol1.93 KB
src/executor-guard/TreasuryOperatingFunder.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {External} from "@address-book/src/ExternalEthereum.sol";
import {CurveProtocol} from "@address-book/src/CurveEthereum.sol";
import {Core} from "@address-book/src/SDEthereum.sol";
import {AllMightModule} from "src/executor-guard/AllMightModule.sol";
interface IOperatingFundingSource {
function withdraw(address[] calldata tokens, uint256[] calldata amounts, address recipient) external;
}
interface IOperatingFundingWETH {
function deposit() external payable;
function withdraw(uint256 amount) external;
}
interface IOperatingFundingWstETH {
function stEthPerToken() external view returns (uint256);
function unwrap(uint256 amount) external returns (uint256);
}
interface IOperatingFundingPool {
function exchange(int128 i, int128 j, uint256 dx, uint256 minDy) external payable;
}
interface IOperatingFundingInbox {
function calculateRetryableSubmissionFee(uint256 dataLength, uint256 baseFee) external view returns (uint256);
function unsafeCreateRetryableTicket(
address to,
uint256 l2CallValue,
uint256 maxSubmissionCost,
address excessFeeRefundAddress,
address callValueRefundAddress,
uint256 gasLimit,
uint256 maxFeePerGas,
bytes calldata data
) external payable returns (uint256);
}
interface IOperatingFundingPortal {
function depositTransaction(address to, uint256 value, uint64 gasLimit, bool isCreation, bytes calldata data)
external
payable;
}
/// @notice Closed treasury-to-operating-reserve funding. No destination balance or USD cap is implied.
/// @dev Source usage is gross ETH-equivalent token pulls, never reduced by refunds or reconfiguration.
contract TreasuryOperatingFunder is AllMightModule, ReentrancyGuard {
using SafeERC20 for IERC20;
address public constant SOURCE = Core.TREASURY;
uint256 public constant L2_GAS_LIMIT = 100000;
uint256 public constant MIN_INTERVAL = 6 days;
address public constant ARBITRUM_INBOX = External.ARBITRUM_INBOX;
address public constant BASE_OPTIMISM_PORTAL = External.BASE_OPTIMISM_PORTAL;
address public constant STETH = External.STETH;
address public constant STETH_POOL = CurveProtocol.STETH_POOL;
address public immutable OPERATOR;
address public immutable treasurySafe;
uint256 public configVersion;
uint256 public globalLimit;
struct Route {
address recipient;
uint256 maxAmount;
uint256 maxBridgeFee;
bool enabled;
}
mapping(uint8 => mapping(uint256 => Route)) public routes;
mapping(uint8 => mapping(uint256 => mapping(uint256 => uint256))) public funded;
mapping(uint8 => mapping(uint256 => uint256)) public lastFundedAt;
mapping(uint256 => uint256) public sourceSpent;
error CONFIGURATION();
error PERIOD();
error LIMIT();
error GLOBAL_LIMIT();
error PAYOUT();
event RouteConfigured(uint8 indexed purpose, uint256 indexed chain, Route policy, uint256 configVersion);
event GlobalLimitSet(uint256 sourceDebitWei, uint256 configVersion);
event FundingSubmitted(
uint256 indexed week,
uint8 indexed purpose,
uint256 indexed chain,
address recipient,
uint256 amount,
uint256 bridgeFee,
uint256 sourceDebitWei,
uint256 messageNumber
);
constructor(address operator_, address treasurySafe_) AllMightModule(Core.ALLMIGHT, Core.GOVERNANCE) {
if (operator_ == address(0) || treasurySafe_ == address(0)) revert ZERO_ADDRESS();
OPERATOR = operator_;
treasurySafe = treasurySafe_;
paused = true;
}
// Conversion receipts and bridge refunds confer no authority and restore no allowance.
receive() external payable {}
function configureRoute(uint8 purpose, uint256 chain, Route calldata policy) external onlyGovernance {
if (!paused || block.chainid != 1) revert CONFIGURATION();
_scope(purpose, chain);
if (policy.recipient == address(0) || (purpose == 0 && policy.recipient != OPERATOR)) revert CONFIGURATION();
if (policy.enabled && (policy.maxAmount == 0 || (chain == 42161 && policy.maxBridgeFee == 0))) {
revert CONFIGURATION();
}
routes[purpose][chain] = policy;
emit RouteConfigured(purpose, chain, policy, ++configVersion);
}
function setGlobalLimit(uint256 sourceDebitWei) external onlyGovernance {
if (!paused || block.chainid != 1) revert CONFIGURATION();
globalLimit = sourceDebitWei;
emit GlobalLimitSet(sourceDebitWei, ++configVersion);
}
function fund(uint256 week, uint8 purpose, uint256 chain, uint256 amount, uint256 submission, uint256 maxFeePerGas)
external
onlyAllMight
nonReentrant
{
_scope(purpose, chain);
if (block.chainid != 1 || week != (block.timestamp + 3 days) / 1 weeks) revert PERIOD();
Route memory route = routes[purpose][chain];
if (!route.enabled || amount == 0 || amount > route.maxAmount) revert LIMIT();
if (
funded[purpose][chain][week] != 0
|| (lastFundedAt[purpose][chain] != 0 && block.timestamp < lastFundedAt[purpose][chain] + MIN_INTERVAL)
) {
revert PERIOD();
}
uint256 fee;
if (chain == 42161) {
// 0/1 are the Inbox's special estimation sentinels, not executable gas bids.
if (
maxFeePerGas <= 1
|| submission
< IOperatingFundingInbox(ARBITRUM_INBOX).calculateRetryableSubmissionFee(0, block.basefee)
) revert LIMIT();
fee = submission + L2_GAS_LIMIT * maxFeePerGas;
if (fee > route.maxBridgeFee) revert LIMIT();
} else if (submission != 0 || maxFeePerGas != 0) {
revert LIMIT();
}
(uint256 weth, uint256 wsteth, uint256 debit) = _quotePull(amount + fee);
if (debit > globalLimit || sourceSpent[week] > globalLimit - debit) revert GLOBAL_LIMIT();
sourceSpent[week] += debit;
funded[purpose][chain][week] = amount;
lastFundedAt[purpose][chain] = block.timestamp;
_unwrap(weth, wsteth, amount + fee);
uint256 messageNumber;
if (chain == 1) {
(bool ok,) = route.recipient.call{value: amount}("");
if (!ok) revert PAYOUT();
} else if (chain == 42161) {
// Unlike createRetryableTicket, unsafe does not alias L1-contract refund recipients.
// We enforce the ordinary entrypoint's full funding check ourselves, with exact value.
messageNumber = IOperatingFundingInbox(ARBITRUM_INBOX).unsafeCreateRetryableTicket{value: amount + fee}(
route.recipient, amount, submission, route.recipient, route.recipient, L2_GAS_LIMIT, maxFeePerGas, ""
);
} else {
IOperatingFundingPortal(BASE_OPTIMISM_PORTAL).depositTransaction{value: amount}(
route.recipient, amount, uint64(L2_GAS_LIMIT), false, ""
);
}
_refund();
emit FundingSubmitted(week, purpose, chain, route.recipient, amount, fee, debit, messageNumber);
}
function recoverNative(uint256 amount) external onlyGovernance nonReentrant {
(bool ok,) = treasurySafe.call{value: amount}("");
if (!ok) revert PAYOUT();
}
function recoverToken(address token, uint256 amount) external onlyGovernance nonReentrant {
IERC20(token).safeTransfer(treasurySafe, amount);
}
function _scope(uint8 purpose, uint256 chain) private pure {
if (purpose > 1 || (chain != 1 && chain != 42161 && chain != 8453)) revert CONFIGURATION();
}
function _quotePull(uint256 amount) private view returns (uint256 weth, uint256 wsteth, uint256 debit) {
weth = Math.min(amount, IERC20(External.WETH).balanceOf(SOURCE));
debit = weth;
if (weth < amount) {
// Round up the 99% conversion-floor complement and wrapper shares to protect funding.
uint256 stethNeeded = Math.mulDiv(amount - weth, 10000, 9900, Math.Rounding.Up) + 2;
uint256 rate = IOperatingFundingWstETH(External.WSTETH).stEthPerToken();
wsteth = Math.mulDiv(stethNeeded, 1 ether, rate, Math.Rounding.Up);
// Round gross source debit up: wrapper/DEX rounding and refunds cannot create headroom.
debit += Math.mulDiv(wsteth, rate, 1 ether, Math.Rounding.Up);
}
}
function _unwrap(uint256 weth, uint256 wsteth, uint256 amount) private {
if (weth != 0) {
_pull(External.WETH, weth);
IOperatingFundingWETH(External.WETH).withdraw(weth);
}
if (wsteth != 0) {
_pull(External.WSTETH, wsteth);
IOperatingFundingWstETH(External.WSTETH).unwrap(wsteth);
uint256 steth = IERC20(STETH).balanceOf(address(this));
IERC20(STETH).safeApprove(STETH_POOL, steth);
IOperatingFundingPool(STETH_POOL).exchange(1, 0, steth, amount - weth);
IERC20(STETH).safeApprove(STETH_POOL, 0);
uint256 dust = IERC20(STETH).balanceOf(address(this));
if (dust != 0) IERC20(STETH).safeTransfer(SOURCE, dust);
}
}
function _pull(address token, uint256 amount) private {
address[] memory tokens = new address[](1);
uint256[] memory amounts = new uint256[](1);
tokens[0] = token;
amounts[0] = amount;
IOperatingFundingSource(SOURCE).withdraw(tokens, amounts, address(this));
}
function _refund() private {
uint256 surplus = address(this).balance;
if (surplus != 0) {
IOperatingFundingWETH(External.WETH).deposit{value: surplus}();
IERC20(External.WETH).safeTransfer(SOURCE, surplus);
}
}
}
node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
node_modules/@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
node_modules/@openzeppelin/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
node_modules/@stake-dao/address-book/src/CurveEthereum.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice External protocol addresses, not part of Stake DAO. Excluded from generated outputs.
library CurveProtocol {
address internal constant CRV = 0xD533a949740bb3306d119CC777fa900bA034cd52;
address internal constant VECRV = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2;
address internal constant CRV_USD = 0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E;
address internal constant SD_VE_CRV = 0x478bBC744811eE8310B461514BDc29D03739084D;
address internal constant STETH_POOL = 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022;
address internal constant FEE_DISTRIBUTOR = 0xD16d5eC345Dd86Fb63C6a9C43c517210F1027914;
address internal constant GAUGE_CONTROLLER = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB;
address internal constant SMART_WALLET_CHECKER = 0xca719728Ef172d0961768581fdF35CB116e0B7a4;
address internal constant CURVE_REGISTRY = 0xc522A6606BBA746d7960404F22a3DB936B6F4F50;
address internal constant VOTING_APP_OWNERSHIP = 0xE478de485ad2fe566d49342Cbd03E49ed7DB3356;
address internal constant VOTING_APP_PARAMETER = 0xBCfF8B0b9419b9A88c44546519b1e909cF330399;
address internal constant MINTER = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0;
address internal constant VE_BOOST = 0xD37A6aa3d8460Bd2b6536d608103D880695A23CD;
// Convex
address internal constant CONVEX_PROXY = 0x989AEb4d175e16225E39E87d0D97A3360524AD80;
address internal constant CONVEX_BOOSTER = 0xF403C135812408BFbE8713b5A23a04b3D48AAE31;
address internal constant CONVEX_TOKEN = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B; // CVX
address internal constant META_REGISTRY = 0xF98B45FA17DE75FB1aD0e7aFD971b0ca00e379fC;
address internal constant LIQUIDITY_GAUGE_V4_IMPLEMENTATION = 0x82ABa41FcE8EdE355380F5F22D5472118Aff0410;
}
library CurveLocker {
address internal constant TOKEN = 0xD533a949740bb3306d119CC777fa900bA034cd52;
address internal constant SDTOKEN = 0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5;
address internal constant ASDTOKEN = 0x43E54C2E7b3e294De3A155785F52AB49d87B9922;
address internal constant ASDTOKEN_ADAPTER = 0x4e8DA27Fa7F109565De6FdB813D5AA1A6F73c75f;
address internal constant SYASDTOKEN = 0x18C11b1DC74cAB82AD18d5034FDe93FE90a41D99;
address internal constant LOCKER = 0x52f541764E6e90eeBc5c21Ff570De0e2D63766B6;
address internal constant DEPOSITOR = 0xa50CB9dFFcc740EE6b6f2D4B3CBc3a876b28c335;
address internal constant GAUGE = 0x7f50786A0b15723D741727882ee99a0BF34e3466;
address internal constant ACCUMULATOR = 0x11F78501e6b0cbc5DE4c7e6BBabaACdb973eb4Cd;
address internal constant VOTER = 0xb118fbE8B01dB24EdE7E87DFD19693cfca13e992;
address internal constant STRATEGY = 0x69D61428d089C2F35Bf6a472F540D0F82D1EA2cd;
address internal constant FACTORY = 0xDC9718E7704f10DB1aFaad737f8A04bcd14C20AA;
address internal constant VE_BOOST_DELEGATION = 0xe1F9C8ebBC80A013cAf0940fdD1A8554d763b9cf;
}
library CurveVotemarket {
address internal constant PLATFORM = 0x0000000895cB182E6f983eb4D8b4E0Aa0B31Ae4c;
address internal constant CURVE_CONVEX_LOCKER_VM_RECIPIENT = 0x0000000095310137125f82f37FBe5D2F99279947;
address internal constant CURVE_STAKE_DAO_LOCKER_VM_RECIPIENT = 0x0000000014814b037cF4a091FE00cbA2DeFc6115;
}
library CurveStrategy {
address internal constant ACCOUNTANT = 0x93b4B9bd266fFA8AF68e39EDFa8cFe2A62011Ce0;
address internal constant PROTOCOL_TIMELOCK = 0xb27afc7844988948FBd6210AeF4E1362bC2d8E6a;
address internal constant PROTOCOL_CONTROLLER = 0x2d8BcE1FaE00a959354aCD9eBf9174337A64d4fb;
address internal constant GATEWAY = 0xe5d6D047DF95c6627326465cB27B64A8b77A8b91;
address internal constant FEE_RECEIVER = 0x60136fefE23D269aF41aB72DE483D186dC4318D6;
address internal constant STRATEGY = 0xcE37598c3b26eCbdF13356f9E1FFf2Cd36EE602a;
address internal constant CONVEX_SIDECAR_IMPLEMENTATION = 0xef7cfFDeF21538B63Cc541bf206BB382d922A216;
address internal constant CONVEX_SIDECAR_FACTORY = 0x4Ad394d3FfCA4B22e8e8Bac7DEa1c9bf218d0D42;
address internal constant REGISTRAR = 0x1c3A4d06532D9D1C631F99eC50dD72dA43a5c6De;
address internal constant FACTORY = 0xDA9cBDF67a418eaf5dDF5cd5Af41D445FE5E7bcd;
address internal constant ALLOCATOR = 0xA56B653CE86D1B84b0Ac67bD41F007898cfC14e4;
address internal constant REWARD_ROUTER = 0x9A207a85E372fCDAC3014F945a65868f2a05Ba12;
address internal constant REWARD_RECEIVER_MIGRATION_MODULE = 0x083E43159dCd989e21509f574fCfB11e6969B273;
address internal constant REWARD_VAULT_IMPLEMENTATION = 0x74D8dd40118B13B210D0a1639141cE4458CAe0c0;
address internal constant REWARD_RECEIVER_IMPLEMENTATION = 0x78f1bBA3868B67f4994b3e7f7ec9b0485Dc85aD7;
address internal constant ROUTER = 0x0f542fA75c871EB1b93Ef881b73e46acF733392f;
address internal constant ROUTER_MODULE_DEPOSIT = 0xBf0a5d6a1f9A4098c69cE660F8b115dc8509b7C9;
address internal constant ROUTER_MODULE_WITHDRAW = 0xE88772DFB857317476b77F1A25b888b9424Cf63c;
address internal constant ROUTER_MODULE_CLAIM = 0xFD98cEcB88FC61101D4beBf1b6f9E65572222Ff5;
address internal constant ROUTER_MODULE_MIGRATION_CURVE = 0x0e5Ca5f4989637d480968325B716Db7A6e46466B;
address internal constant ROUTER_MODULE_MIGRATION_STAKE_DAO_V1 = 0xf0b84B9334132843fc256830Fb941d535853C120;
address internal constant ROUTER_MODULE_MIGRATION_YEARN = 0x267C77f0616d44eD6D816527974a624B2Ba65eE3;
address internal constant ROUTER_MODULE_WBTC18 = 0x07a53c83821d793a0468bCA7eEA5E9B56f475390;
}
node_modules/@stake-dao/address-book/src/ExternalEthereum.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import {ExternalUniversal} from "./ExternalUniversal.sol";
/// @notice Generic third-party addresses not tied to any supported protocol. Excluded from generated outputs.
library External {
address internal constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address internal constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address internal constant STETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;
address internal constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;
address internal constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address internal constant CBBTC = 0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf;
address internal constant TBTC = 0x18084fbA666a33d37592fA2633fD49a74DD93a88;
address internal constant FRXUSD = 0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29;
/// @notice WBTC18 is a wrapper around WBTC with 18 decimals (vs 8 for WBTC)
/// @dev Required for gauge rewards to avoid precision loss with 8-decimal tokens
address internal constant WBTC18 = 0xe065Bc161b90C9C4Bba2de7F1E194b70A3267c47;
address internal constant ETH_ERC20_PLACEHOLDER = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// Canonical L1 bridges
address internal constant ARBITRUM_INBOX = 0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f;
address internal constant BASE_OPTIMISM_PORTAL = 0x49048044D57e1C92A77f79988d21Fa8fAF74E97e;
// DEPLOYER
address internal constant CREATE2_FACTORY = ExternalUniversal.CREATE2_FACTORY;
address internal constant CREATE3_FACTORY = ExternalUniversal.CREATEX_FACTORY;
// SAFE
address internal constant SAFE_PROXY_FACTORY = ExternalUniversal.SAFE_PROXY_FACTORY;
address internal constant SAFE_SINGLETON = ExternalUniversal.SAFE_SINGLETON;
address internal constant SAFE_L2_SINGLETON = ExternalUniversal.SAFE_L2_SINGLETON;
address internal constant SAFE_FALLBACK_HANDLER = ExternalUniversal.SAFE_FALLBACK_HANDLER;
// LayerZero
address internal constant LAYERZERO_ENDPOINT = ExternalUniversal.LAYERZERO_ENDPOINT;
// Chainlink
address internal constant CHAINLINK_USDC_USD_PRICE_FEED = 0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6;
address internal constant CHAINLINK_USDT_USD_PRICE_FEED = 0x3E7d1eAB13ad0104d2750B8863b489D65364e32D;
address internal constant CHAINLINK_CRVUSD_USD_PRICE_FEED = 0xEEf0C605546958c1f899b6fB336C20671f9cD49F;
address internal constant CHAINLINK_ETH_USD_PRICE_FEED = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;
address internal constant CHAINLINK_CRV_USD_PRICE_FEED = 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f;
address internal constant CHAINLINK_FRXUSD_USD_PRICE_FEED = 0x9B4a96210bc8D9D55b1908B465D8B0de68B7fF83;
}
node_modules/@stake-dao/address-book/src/ExternalUniversal.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Generic third-party addresses not tied to any supported protocol. Excluded from generated outputs.
library ExternalUniversal {
// FACTORY
address internal constant CREATE2_FACTORY = 0x0000000000FFe8B47B3e2130213B802212439497;
address internal constant CREATEX_FACTORY = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;
// SAFE
address internal constant SAFE_PROXY_FACTORY = 0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67;
address internal constant SAFE_SINGLETON = 0x41675C099F32341bf84BFc5382aF534df5C7461a;
address internal constant SAFE_L2_SINGLETON = 0xfb1bffC9d739B8D520DaF37dF666da4C687191EA;
address internal constant SAFE_FALLBACK_HANDLER = 0xfd0732Dc9E303f09fCEf3a7388Ad10A83459Ec99;
// LayerZero
address internal constant LAYERZERO_ENDPOINT = 0x1a44076050125825900e736c501f859c50fE728c;
// Permit2
address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
// Succinct
address internal constant SP1_VERIFIER_GATEWAY = 0x3B6041173B80E77f038f3F2C0f9744f04837185e;
}
node_modules/@stake-dao/address-book/src/SDEthereum.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
library Core {
/// Token addresses and revenue sharing.
address internal constant SDT = 0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F;
address internal constant VESDT = 0x0C30476f66034E11782938DF8e4384970B6c9e8a;
address internal constant VESDT_BOOST_PROXY = 0xD67bdBefF01Fc492f1864E61756E5FBB3f173506;
address internal constant VEBOOST = 0x47B3262C96BB55A8D2E4F8E3Fed29D2eAB6dB6e9;
address internal constant VLSDT = 0x94818A7baa7e9F5dC62ce4da1B52ef9a760b80B8;
address internal constant VLBOOST = 0xaB05ca46d1c78CAbB051efFE35099714Cad2AddA;
address internal constant BOOST_MARKETPLACE = 0xbc38D256E559FEd3fA95A6cdC633C667283fb6b8;
address internal constant VESDT_IMPLEMENTATION = 0x09943C4f27f2aDA5BB58b845d27405a4b3A894a8;
address internal constant UNIFORM_BOOST_PROVIDER = 0x7c3867E04d5A69B750332300643B36135313c5B7;
address internal constant VLSDT_FEE_DISTRIBUTOR_SDT = 0x6d57d34259F6dc31C9a241c199822861940d38f9;
address internal constant VLSDT_FEE_DISTRIBUTOR_USDC = 0xCa94395469a88E9cAC0D5E5e308910E298270d30;
address internal constant VLSDT_PENALTY_FORWARDER = 0xDeE477B9d0242b20311C55DfD9dF648016620Fda;
address internal constant FEE_DISTRIBUTOR = 0x29f3dd38dB24d3935CF1bf841e6b2B461A3E5D92;
address internal constant FEE_DISTRIBUTOR_USDC = 0xC126bf16CECC6825D87b74287534cD97b3538073;
address internal constant PROXY_ADMIN = 0xfE612c237A81527a86f2Cac1FD19939CF4F91B9B;
address internal constant SMART_WALLET_CHECKER = 0x37E8386602d9EBEa2c56dd11d8E142290595f1b5;
address internal constant TIMELOCK = 0xD3cFc4E65a73BB6C482383EB38f5C3E1d1411616;
/// Recipient
address internal constant TREASURY = 0x9EBBb3d59d53D6aD3FA5464f36c2E84aBb7cf5c1;
address internal constant VESDT_FEES_RECIPIENT = 0x1fE537BD59A221854a53a5B7a81585B572787fce;
address internal constant LIQUIDITY_FEES_RECIPIENT = 0x576D7AD8eAE92D9A972104Aac56c15255dDBE080;
address internal constant STRATEGY_FEES_RECIPIENT = 0x239Fe53F10Fe77E9C6ed896E3Ae4aB8E43EeD082;
address internal constant FEE_RECEIVER = 0x60136fefE23D269aF41aB72DE483D186dC4318D6;
/// SDT Distribution.
address internal constant LOCKER_SDT_DISTRIBUTOR = 0x8Dc551B4f5203b51b5366578F42060666D42AB5E;
address internal constant STRATEGY_SDT_DISTRIBUTOR = 0x9C99dffC1De1AfF7E7C1F36fCdD49063A281e18C;
address internal constant LOCKER_GAUGE_CONTROLLER = 0x75f8f7fa4b6DA6De9F4fE972c811b778cefce882;
address internal constant STRATEGY_GAUGE_CONTROLLER = 0x3F3F0776D411eb97Cfa4E3eb25F33c01ca4e7Ca8;
/// veSDT on-chain voting addreses.
address internal constant AGENT_APP = 0x30f9fFF0f55d21D666E28E650d0Eb989cA44e339;
address internal constant VOTING_APP = 0x82e631fe565E06ea51a00fAbcd79645272f654eB;
/// Votes modules
address internal constant CURVE_VOTER = 0xb118fbE8B01dB24EdE7E87DFD19693cfca13e992;
/// @notice GaugeVoter, enabled Safe module on the governance Safe (GOVERNANCE, 0xB0552b6860CE5C0202976Db056b5e3Cc4f9CC765)
address internal constant GAUGE_VOTER = 0x43F8F8472FEbd6e7481e0AB43F49A683F9Fbedb7;
/// @notice GovCurveVoter, enabled Safe module on the governance Safe (GOVERNANCE, 0xB0552b6860CE5C0202976Db056b5e3Cc4f9CC765)
address internal constant GOV_CURVE_VOTER = 0x665d334388012d17F1d197dE72b7b708ffCCB67d;
/// Merkles distributors
address internal constant SD_TOKENS_MERKLE = 0x03E34b085C52985F6a5D27243F20C84bDdc01Db4;
address internal constant SD_TOKENS_MERKLE_OWNER_TIMELOCK = 0xbd2A781f11A32929393e6959D08F78346bEDA8f6;
address internal constant VLCVX_THURSDAY_MERKLE = 0x000000006feeE0b7a0564Cd5CeB283e10347C4Db;
address internal constant VLCVX_TUESDAY_MERKLE = 0x17F513CDE031C8B1E878Bde1Cb020cE29f77f380;
address internal constant MISC_MERKLE = 0x6D98023de9AdeEE661E922F58f5c2ff086be1F4e;
address internal constant SDCRV_BOUNTY_MERKLE = 0x32dA29D7F3aD8cF157C6427CecFD3f0665042A37;
address internal constant SDFXN_BOUNTY_MERKLE = 0xdD03449c5b8F1e2aF92FaA45Db6CCA268479b990;
/// Partner revenue sharing (ENG-1948)
address internal constant PARTNER_REGISTRY = 0x1111735980D34F3276d8B5247da294540F907AA2;
address internal constant PARTNER_URD = 0x496D40cA46684Aa09C1BAd853295E48b8E83e073;
/// Common addresses
address internal constant GOVERNANCE = 0xB0552b6860CE5C0202976Db056b5e3Cc4f9CC765;
address internal constant LAPOSTE = 0xF0000058000021003E4754dCA700C766DE7601C2;
address internal constant L2_SAFE_TREASURY = 0x5DA07af8913A4EAf09E5F569c20138b658906c17;
address internal constant VOTIUM_FORWARDER_RECIPIENT = 0xAe86A3993D13C8D77Ab77dBB8ccdb9b7Bc18cd09;
address internal constant DEPLOYER = 0x000755Fbe4A24d7478bfcFC1E561AfCE82d1ff62;
// Automation
address internal constant ALLMIGHT = 0xDBd24b092f686b12650EC1450e3A7138F714506c;
address internal constant ALLMIGHT_GUARD = 0x067e4F59F6Bd026897D771Fa430CA261d7C35205;
address internal constant ALLMIGHT_REPLAY_EXECUTOR = 0x16Ff44D59ec78b7447Be25244BEA2984033C8c63;
address internal constant ALLMIGHT_SWAP_EXECUTOR = 0xCE1d84E654DB546e3EdFf1481bA3d4c9394ba1C5;
address internal constant BOTMARKET = 0xADfBFd06633eB92fc9b58b3152Fe92B0A24eB1FF;
address internal constant AUTOMATION = 0x2468Fd5868dA9219b50c8d57bB4edba4097Bd20A;
}
library Router {
address internal constant STAKEDAO_ROUTER = 0x0f542fA75c871EB1b93Ef881b73e46acF733392f;
address internal constant ROUTER_MODULE_VLSDT = 0x8155B8858Af2b12baf8A79E22021B14f91557707;
address internal constant ROUTER_MODULE_BOOST_MARKETPLACE = 0x14558137EFceBE3f4BDdfa846A61Fd497b5F82C7;
}
library Votemarket {
address internal constant CAMPAIGN_REMOTE_MANAGER = 0x177198aDb759a9715bC7259BE1b7bE535BeD7542;
}
library Lending {
address internal constant MORPHO_BLUE = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;
address internal constant MORPHO_ADAPTIVE_CURVE_IRM = 0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC;
address internal constant MORPHO_CHAINLINK_ORACLE_FACTORY = 0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766;
address internal constant MORPHO_META_MORPHO_FACTORY = 0x1897A8997241C1cD4bD0698647e4EB7213535c24;
///////////////////////////////////////////////////////////////
// --- USDC VAULTS/MARKETS
///////////////////////////////////////////////////////////////
address internal constant LEGACY_STAKEDAO_VAULT_USDC_V1 = 0x13AA4f80AD5F06cE4f1A3a3cA58C37059F0EE4c5;
address internal constant STAKEDAO_VAULT_USDC_V2 = 0x8EDCC305E633d29BFB383872e79401c506cE9E6f;
address internal constant STAKEDAO_VAULT_USDC_CORE = 0x4b7D98a652C4ca87B3EAE4A64F7FF852de2Ef9B7;
// Llamaland sREUSD/USDC market https://app.morpho.org/ethereum/market/0x9c1f0e3cb1c0b7ecbecf983e8ebe7c81599b3fb4c3a60b6a39fa03fc1ba5dc8e
address internal constant LEGACY_MARKET_LLSREUSD_USDC_945_ORACLE = 0xCc00d98162fEf57d6A1057a36C25D5326e3805c8;
address internal constant LEGACY_MARKET_LLSREUSD_USDC_945_COLLATERAL = 0x6aEe69A11D5fB0e71c813Fe8419D84b12FB11FdA;
bytes32 internal constant LEGACY_MARKET_LLSREUSD_USDC_945_ID =
0x9c1f0e3cb1c0b7ecbecf983e8ebe7c81599b3fb4c3a60b6a39fa03fc1ba5dc8e;
// Curve USDC/crvUSD market https://app.morpho.org/ethereum/market/0x7e66ce6d3e2a27db0dab1d9c16dd313a4658eb6317a75d3bf8de8fe8a5880f96
address internal constant LEGACY_MARKET_USDCCRVUSD_USDC_945_ORACLE = 0x3bb43EF3EBF21E84c38e958fbF85af482d594C77;
address internal constant LEGACY_MARKET_USDCCRVUSD_USDC_945_COLLATERAL = 0x393C0cf85E5a60b730e705396f3bea71648FA3A0;
bytes32 internal constant LEGACY_MARKET_USDCCRVUSD_USDC_945_ID =
0x7e66ce6d3e2a27db0dab1d9c16dd313a4658eb6317a75d3bf8de8fe8a5880f96;
// Curve USDT/crvUSD market https://app.morpho.org/ethereum/market/0x68d35b050f930a801087aa0aca91da1bc32f84783277813b619e3e1d0bf00a2f
address internal constant LEGACY_MARKET_USDTCRVUSD_USDC_945_ORACLE = 0x0833501FC146846D651D8F073e79a23bfB8193Ae;
address internal constant LEGACY_MARKET_USDTCRVUSD_USDC_945_COLLATERAL = 0x92abCF6813150a9F78540cAa4feE6115a713F505;
bytes32 internal constant LEGACY_MARKET_USDTCRVUSD_USDC_945_ID =
0x68d35b050f930a801087aa0aca91da1bc32f84783277813b619e3e1d0bf00a2f;
// Curve frxUSD/crvUSD market https://app.morpho.org/ethereum/market/0xa67cfcdf2a2637c78fd6e1879e27448be7abe90c6ef1be4a1ca4337db886c8e3
address internal constant LEGACY_MARKET_FRXUSDCRVUSD_USDC_945_ORACLE = 0x70979F4Ad0Cd9d894d73bc747Cc8DD7a269B5551;
address internal constant LEGACY_MARKET_FRXUSDCRVUSD_USDC_945_COLLATERAL =
0xF7dAf52958690F1dc89CD377d638e9Fc94E76ACF;
bytes32 internal constant LEGACY_MARKET_FRXUSDCRVUSD_USDC_945_ID =
0xa67cfcdf2a2637c78fd6e1879e27448be7abe90c6ef1be4a1ca4337db886c8e3;
// Curve pyUSD/crvUSD market https://app.morpho.org/ethereum/market/0x9ff17ee333e340b4f833ba0ba36899a44ea6808ea2d739928f80fec89cf7ba2e
address internal constant LEGACY_MARKET_PYUSDCRVUSD_USDC_945_ORACLE = 0x22ec58046c98933bE51c1DF5C165Ae8cb2fc3B36;
address internal constant LEGACY_MARKET_PYUSDCRVUSD_USDC_945_COLLATERAL =
0xC3361F107c0b82864D5B100A2f3C3E0a1a3586DA;
bytes32 internal constant LEGACY_MARKET_PYUSDCRVUSD_USDC_945_ID =
0x9ff17ee333e340b4f833ba0ba36899a44ea6808ea2d739928f80fec89cf7ba2e;
///////////////////////////////////////////////////////////////
// --- FRXUSD VAULTS/MARKETS
///////////////////////////////////////////////////////////////
address internal constant LEGACY_STAKEDAO_VAULT_FRXUSD_V1 = 0xB2376cC88EA47C80fFC3De60dAe8F2F48BC872a3;
address internal constant STAKEDAO_VAULT_FRXUSD_V2 = 0xCE13e39534082FCF8f13F6D84e6D95414D14271e;
// Curve frxUSD/crvUSD market https://app.morpho.org/ethereum/market/0x7629b62c42febfccd87a8eb76bd91587b33bbcd474cb79bc4964aeb0479e4e53
address internal constant LEGACY_MARKET_FRXUSDCRVUSD_FRXUSD_945_ORACLE = 0xDE00641b654B5E6447D0277a8bEad00309Fc86c2;
address internal constant LEGACY_MARKET_FRXUSDCRVUSD_FRXUSD_945_COLLATERAL =
0x61ec68a5a79905a82Bd594dC847E284Df17a8760;
bytes32 internal constant LEGACY_MARKET_FRXUSDCRVUSD_FRXUSD_945_ID =
0x7629b62c42febfccd87a8eb76bd91587b33bbcd474cb79bc4964aeb0479e4e53;
// Curve frxUSD/msUSD market https://app.morpho.org/ethereum/market/0x24a1ac1fb21a206906af5acf2d65a6e6d9627823c195efef112d3a9b6cd5eab6
address internal constant LEGACY_MARKET_FRXUSDMSUSD_FRXUSD_945_ORACLE = 0xC5860e9e6b6F6E9D79DCe5c5AB0F7A4b878Bd431;
address internal constant LEGACY_MARKET_FRXUSDMSUSD_FRXUSD_945_COLLATERAL =
0x3B855AA8CC56a3cBd5dBb5456F5A13Ce86AA0fe8;
bytes32 internal constant LEGACY_MARKET_FRXUSDMSUSD_FRXUSD_945_ID =
0x24a1ac1fb21a206906af5acf2d65a6e6d9627823c195efef112d3a9b6cd5eab6;
// Curve frxUSD/oUSD market https://app.morpho.org/ethereum/market/0xb7d1981ca0657c42bf003aca966f6a873ade2ae55d472d019a4ea03bc74f29f0
address internal constant LEGACY_MARKET_FRXUSDOUSD_FRXUSD_945_ORACLE = 0xF0fC06217C5a728776AAc76F4bc5cf3112730960;
address internal constant LEGACY_MARKET_FRXUSDOUSD_FRXUSD_945_COLLATERAL =
0x95B2b136eb0Bf075072D0c759e475453711A33f5;
bytes32 internal constant LEGACY_MARKET_FRXUSDOUSD_FRXUSD_945_ID =
0xb7d1981ca0657c42bf003aca966f6a873ade2ae55d472d019a4ea03bc74f29f0;
// Curve frxUSD/avUSD market https://app.morpho.org/ethereum/market/0x3a7c4f7a5b837facbad5ca9313042d5864c4ef5dda582c5d7339dfd431f39dc1
address internal constant LEGACY_MARKET_FRXUSDAVUSD_FRXUSD_945_ORACLE = 0x19747F93d0cd37FdF8bf52Bc158880888418316a;
address internal constant LEGACY_MARKET_FRXUSDAVUSD_FRXUSD_945_COLLATERAL =
0x4926F23927fbABe8580c183E07E34D4B147EaFc0;
bytes32 internal constant LEGACY_MARKET_FRXUSDAVUSD_FRXUSD_945_ID =
0x3a7c4f7a5b837facbad5ca9313042d5864c4ef5dda582c5d7339dfd431f39dc1;
// Curve frxUSD/sUSDS market https://app.morpho.org/ethereum/market/0x87e3786114cbe9d3fcace0eb4099fa70a4b916039db4a29626cae89147180ca3
address internal constant LEGACY_MARKET_FRXUSDSUSDS_FRXUSD_945_ORACLE = 0xF694F0EE087d849DB66d14793f6508a794a02746;
address internal constant LEGACY_MARKET_FRXUSDSUSDS_FRXUSD_945_COLLATERAL =
0xdA36Ab65d5Af53763CAcD63AE7D441932032326f;
bytes32 internal constant LEGACY_MARKET_FRXUSDSUSDS_FRXUSD_945_ID =
0x87e3786114cbe9d3fcace0eb4099fa70a4b916039db4a29626cae89147180ca3;
// Curve frxUSD/sDOLA market https://app.morpho.org/ethereum/market/0x1636d136f8f1e870b22a8df5f658e7558b4a7843e959a1915eb8ee8668c3132a
address internal constant LEGACY_MARKET_FRXUSDSDOLA_FRXUSD_86_ORACLE = 0x2ec657b9B275A1bcBA480Dd080bbA5E974ca9118;
address internal constant LEGACY_MARKET_FRXUSDSDOLA_FRXUSD_86_COLLATERAL =
0x2f010444C6a61feaEBCDd4040fA8B30F519e6c31;
bytes32 internal constant LEGACY_MARKET_FRXUSDSDOLA_FRXUSD_86_ID =
0x1636d136f8f1e870b22a8df5f658e7558b4a7843e959a1915eb8ee8668c3132a;
// Curve frxUSD/sDOLA market https://app.morpho.org/ethereum/market/0x4fbdeb7979204a25b8dec7e4ed65998d358d32debee19ae738202becc52ec4b8
address internal constant MARKET_FRXUSDSDOLA_FRXUSD_915_ORACLE = 0x0c63A83a404AE7FA679A35F98C38C05A60Aa820C;
address internal constant MARKET_FRXUSDSDOLA_FRXUSD_915_COLLATERAL = 0x12D706F0aDFF3BE5d9Fa119424A85388FeCD6960;
bytes32 internal constant MARKET_FRXUSDSDOLA_FRXUSD_915_ID =
0x4fbdeb7979204a25b8dec7e4ed65998d358d32debee19ae738202becc52ec4b8;
// Curve frxUSD/sUSDS 91.5% market https://app.morpho.org/ethereum/market/0x1f10c0899fdab5d90b11fd830d52c0c468ba8a7cde67deaa37bebbf512ac47ca
address internal constant MARKET_FRXUSDSUSDS_FRXUSD_915_ORACLE = 0x9eD400f338d82f8095b3cf00fC92Ef931DC1C185;
address internal constant MARKET_FRXUSDSUSDS_FRXUSD_915_COLLATERAL = 0x62923a64D7940be920FD5cdc27873Ab8eEc59F9F;
bytes32 internal constant MARKET_FRXUSDSUSDS_FRXUSD_915_ID =
0x1f10c0899fdab5d90b11fd830d52c0c468ba8a7cde67deaa37bebbf512ac47ca;
// Curve frxUSD/msUSD 91.5% market https://app.morpho.org/ethereum/market/0x328aadb887d060f3d03727f6baaee56ed88570a97dc2ab49b2064a9410ccfd06
address internal constant MARKET_FRXUSDMSUSD_FRXUSD_915_ORACLE = 0x9aA3BFB984f520Eb18A34030110010509A985B52;
address internal constant MARKET_FRXUSDMSUSD_FRXUSD_915_COLLATERAL = 0xA31b5941F2e74d89bDC66632959FE6A152692920;
bytes32 internal constant MARKET_FRXUSDMSUSD_FRXUSD_915_ID =
0x328aadb887d060f3d03727f6baaee56ed88570a97dc2ab49b2064a9410ccfd06;
// Curve frxUSD/crvUSD market https://app.morpho.org/ethereum/market/0x35c92b233f962d894b5558063c926aa44fab0a5178a176211543a63039edd328
address internal constant MARKET_FRXUSDCRVUSD_FRXUSD_915_ORACLE = 0x9223b246e1b80beCCD027bB7eB085087283C73a6;
address internal constant MARKET_FRXUSDCRVUSD_FRXUSD_915_COLLATERAL = 0x728c3B9Eb722F7aFC17F0D26A80d625C53059086;
bytes32 internal constant MARKET_FRXUSDCRVUSD_FRXUSD_915_ID =
0x35c92b233f962d894b5558063c926aa44fab0a5178a176211543a63039edd328;
// Curve sfrxUSD/frxUSD 86% market https://app.morpho.org/ethereum/market/0xd87be7c34f317d0686f328633a2e7dd7578fbed60912eb17276699af5ff94487
address internal constant MARKET_SFRXUSDFRXUSD_FRXUSD_86_POOL = 0xF292eB6c5dcb693Eaaf392D0562a01C3710E5978;
address internal constant MARKET_SFRXUSDFRXUSD_FRXUSD_86_REWARD_VAULT = 0x7b28651B51294171b32f7bEC1E7df4EAA8B40720;
address internal constant MARKET_SFRXUSDFRXUSD_FRXUSD_86_ORACLE = 0xe6217A76B9434484200b2b19a498C14D90EBeC7B;
address internal constant MARKET_SFRXUSDFRXUSD_FRXUSD_86_COLLATERAL = 0xF028993841dfA9373e3028f78084062890a1b167;
bytes32 internal constant MARKET_SFRXUSDFRXUSD_FRXUSD_86_ID =
0xd87be7c34f317d0686f328633a2e7dd7578fbed60912eb17276699af5ff94487;
// Curve frxUSD/USD3 86% market https://app.morpho.org/ethereum/market/0xf653cb42a02c56113e954fa9370327f6665186069a68370af370c2da246e9eb1
address internal constant MARKET_FRXUSDUSD3_FRXUSD_86_POOL = 0x7BA89Bc658c07569cfa6d7947adAA80181a24568;
address internal constant MARKET_FRXUSDUSD3_FRXUSD_86_REWARD_VAULT = 0xcad206958a16080eDe0b1e9245D6689554Ed5600;
address internal constant MARKET_FRXUSDUSD3_FRXUSD_86_ORACLE = 0xF1E3cB94320839B8248801F3Ebe26130b49b8Fac;
address internal constant MARKET_FRXUSDUSD3_FRXUSD_86_COLLATERAL = 0x3009e8e60Ee13Eccc3234406571E33664C2ECad7;
bytes32 internal constant MARKET_FRXUSDUSD3_FRXUSD_86_ID =
0xf653cb42a02c56113e954fa9370327f6665186069a68370af370c2da246e9eb1;
// Curve frxUSD/trUSD 86% market https://app.morpho.org/ethereum/market/0xd106a1c0f40edfcd4787617cb53167bee63ea6da6cd2b21e92644b7dfa9fb7c3
address internal constant MARKET_FRXUSDTRUSD_FRXUSD_86_POOL = 0xd1D954BC94c843815EC7b8119f2de00AF27Fa6Ff;
address internal constant MARKET_FRXUSDTRUSD_FRXUSD_86_REWARD_VAULT = 0x6324CD92203bb218079F2F44EB3893Bd1Ebea9a4;
address internal constant MARKET_FRXUSDTRUSD_FRXUSD_86_ORACLE = 0x8520141Fad0678374e420846FE5B6e11AD218B2a;
address internal constant MARKET_FRXUSDTRUSD_FRXUSD_86_COLLATERAL = 0x124716131A55c5a9276f2414E7cbDE60338Cd322;
bytes32 internal constant MARKET_FRXUSDTRUSD_FRXUSD_86_ID =
0xd106a1c0f40edfcd4787617cb53167bee63ea6da6cd2b21e92644b7dfa9fb7c3;
// Curve frxUSD/sUSDe 86% market https://app.morpho.org/ethereum/market/0xf484a05a20473481f156ef9fdbda33aad37c41ec014c0ad407dac7f7410fd605
address internal constant MARKET_FRXUSDSUSDE_FRXUSD_86_POOL = 0x47Ab5f9D8C9C7D002a92320f23a696D348C56A7F;
address internal constant MARKET_FRXUSDSUSDE_FRXUSD_86_REWARD_VAULT = 0xE70Fc8fFb97f6D539E5d50F657F4AAe69F01B87D;
address internal constant MARKET_FRXUSDSUSDE_FRXUSD_86_ORACLE = 0xFa6F33C9Fe1bbe75587d9a63Ee9a771BdA3575F0;
address internal constant MARKET_FRXUSDSUSDE_FRXUSD_86_COLLATERAL = 0xa7b4fE3a7b2A0357e4cc8e128597b94d2e7ddf3e;
bytes32 internal constant MARKET_FRXUSDSUSDE_FRXUSD_86_ID =
0xf484a05a20473481f156ef9fdbda33aad37c41ec014c0ad407dac7f7410fd605;
// Curve frxUSD/sGHO 86% market https://app.morpho.org/ethereum/market/0x08d21d6ea140ec9ce47efaa745a56fa86fb0d49baf58482f5d65b8e16316e54f
address internal constant MARKET_FRXUSDSGHO_FRXUSD_86_POOL = 0x68e392E7875CC23806a8bBC5b1A5D53a366C2C7E;
address internal constant MARKET_FRXUSDSGHO_FRXUSD_86_REWARD_VAULT = 0xE97Bec023bdFc2F331e19A3799db658D72632eA2;
address internal constant MARKET_FRXUSDSGHO_FRXUSD_86_ORACLE = 0x8Bd7dd62f2eC25b14817eB91C5e9b8C1B8c01577;
address internal constant MARKET_FRXUSDSGHO_FRXUSD_86_COLLATERAL = 0xD7b13847A36B5c6d157f09CB7FB60a8338ff917e;
bytes32 internal constant MARKET_FRXUSDSGHO_FRXUSD_86_ID =
0x08d21d6ea140ec9ce47efaa745a56fa86fb0d49baf58482f5d65b8e16316e54f;
// Curve frxUSD/sVUSD 86% market https://app.morpho.org/ethereum/market/0xeb94eb6befbca98a0a1268e96f9690db0fd2a8b43d41a54fbd2e0304cd1aaa56
address internal constant MARKET_FRXUSDSVUSD_FRXUSD_86_POOL = 0xf3EF7C2F7bff49EB6a7b4c7BF613a1c2Cb2a48e2;
address internal constant MARKET_FRXUSDSVUSD_FRXUSD_86_REWARD_VAULT = 0xB420E68d8b532C5402a0c1346f7536b64B222640;
address internal constant MARKET_FRXUSDSVUSD_FRXUSD_86_ORACLE = 0xc7856A9f2514047A14AcA4df0171A091d265F669;
address internal constant MARKET_FRXUSDSVUSD_FRXUSD_86_COLLATERAL = 0x31855058E9BF9007844FF990CBe83e10206fD39D;
bytes32 internal constant MARKET_FRXUSDSVUSD_FRXUSD_86_ID =
0xeb94eb6befbca98a0a1268e96f9690db0fd2a8b43d41a54fbd2e0304cd1aaa56;
///////////////////////////////////////////////////////////////
// --- PERIPHERY
///////////////////////////////////////////////////////////////
address internal constant PUBLIC_FACTORY_MONOLITHIC = 0xf863337EE1a65Ec8c95392c8Aaa8eDEd86b7B80f;
address internal constant LIQUIDATION_MODULE = 0x80854D61608cbC6baF238B85868d9248d644124c;
address internal constant LEVERAGE_ROUTER = 0x53d7F0E412D7f10d47720E73bd488C4a1fb32150;
}
library Zap {
address internal constant ENSO_ROUTER = 0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf;
}
src/executor-guard/AllMightModule.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;
import {Governed} from "src/executor-guard/Governed.sol";
abstract contract AllMightModule is Governed {
address public immutable ALL_MIGHT;
error NOT_ALL_MIGHT();
constructor(address allMight, address governance_) Governed(governance_) {
ALL_MIGHT = allMight;
}
modifier onlyAllMight() {
if (msg.sender != ALL_MIGHT) revert NOT_ALL_MIGHT();
if (paused) revert PAUSED();
_;
}
}
src/executor-guard/Governed.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;
/// @title Governed
/// @notice Two-step governance with a guardian one-way pause.
/// @dev Shared by ExecutorGuard and SwapExecutor. ReplayExecutor predates this base and keeps
/// its own copy: it is already deployed and its runtime code is pinned by codehash.
/// @author Stake DAO
/// @custom:contact [email protected]
abstract contract Governed {
address public governance;
address public futureGovernance;
address public guardian;
bool public paused;
event GovernanceProposed(address indexed newGovernance);
event GovernanceChanged(address indexed newGovernance);
event GuardianSet(address indexed guardian);
event Paused(address indexed by);
event Unpaused();
error GOVERNANCE();
error NOT_GUARDIAN();
error ZERO_ADDRESS();
error PAUSED();
modifier onlyGovernance() {
if (msg.sender != governance) revert GOVERNANCE();
_;
}
constructor(address _governance) {
if (_governance == address(0)) revert ZERO_ADDRESS();
governance = _governance;
}
function transferGovernance(address _governance) external onlyGovernance {
emit GovernanceProposed(futureGovernance = _governance);
}
function acceptGovernance() external {
if (msg.sender != futureGovernance) revert GOVERNANCE();
emit GovernanceChanged(governance = msg.sender);
futureGovernance = address(0);
}
function setGuardian(address _guardian) external onlyGovernance {
guardian = _guardian;
emit GuardianSet(_guardian);
}
function pause() external {
if (msg.sender != guardian && msg.sender != governance) revert NOT_GUARDIAN();
paused = true;
emit Paused(msg.sender);
}
function unpause() external onlyGovernance {
paused = false;
emit Unpaused();
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"solady/=node_modules/solady/",
"solmate/=node_modules/solmate/",
"forge-std/=node_modules/forge-std/",
"@address-book/=node_modules/@stake-dao/address-book/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"solidity-examples/=node_modules/@layerzerolabs/solidity-examples/contracts/",
"murky.git/=node_modules/murky.git/",
"murky/=node_modules/murky.git/src/",
"weiroll/=node_modules/weiroll/contracts/",
"@interfaces/=node_modules/@stake-dao/interfaces/src/interfaces/",
"@shared/=node_modules/@stake-dao/interfaces/src/interfaces/",
"node_modules/@stake-dao/shared/:src/=node_modules/@stake-dao/shared/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.