More Info
Private Name Tags
ContractCreator
TokenTracker
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Accumulator
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.19; import "src/common/accumulator/BaseAccumulator.sol"; import {ILocker} from "src/common/interfaces/ILocker.sol"; /// @notice A contract that accumulates FXN rewards and notifies them to the sdFXN gauge /// @author StakeDAO contract Accumulator is BaseAccumulator { /// @notice FXN token address. address public constant FXN = 0x365AccFCa291e7D3914637ABf1F7635dB165Bb09; /// @notice WSTETH token address. address public constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0; /// @notice Fee distributor address. address public constant FEE_DISTRIBUTOR = 0xd116513EEa4Efe3908212AfBAeFC76cb29245681; ////////////////////////////////////////////////////// /// --- CONSTRUCTOR ////////////////////////////////////////////////////// /// @notice Constructor /// @param _gauge sd gauge /// @param _locker sd locker /// @param _governance governance constructor(address _gauge, address _locker, address _governance) BaseAccumulator(_gauge, WSTETH, _locker, _governance) { SafeTransferLib.safeApprove(FXN, _gauge, type(uint256).max); SafeTransferLib.safeApprove(WSTETH, _gauge, type(uint256).max); } ////////////////////////////////////////////////////// /// --- OVERRIDDEN FUNCTIONS ////////////////////////////////////////////////////// /// @notice Claims all rewards tokens for the locker and notify them to the LGV4 function claimAndNotifyAll(bool notifySDT, bool claimFeeStrategy) external override { ILocker(locker).claimRewards(FEE_DISTRIBUTOR, WSTETH, address(this)); /// Claim Extra FXN rewards. if (claimFeeStrategy && strategy != address(0)) { _claimFeeStrategy(); } notifyReward(WSTETH, notifySDT, claimFeeStrategy); } function name() external pure override returns (string memory) { return "FXN Accumulator"; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.19; import {ERC20} from "solady/src/tokens/ERC20.sol"; import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol"; import {IFeeReceiver} from "herdaddy/interfaces/IFeeReceiver.sol"; import {IStrategy} from "herdaddy/interfaces/stake-dao/IStrategy.sol"; import {ILiquidityGauge} from "src/common/interfaces/ILiquidityGauge.sol"; import {ISDTDistributor} from "src/common/interfaces/ISDTDistributor.sol"; /// @title BaseAccumulator /// @notice Abstract contract used for any accumulator /// @dev Interacting with the FeeReceiver (receiving and splitting fees) /// @author StakeDAO abstract contract BaseAccumulator { /// @notice Denominator for fixed point math. uint256 public constant DENOMINATOR = 1e18; /// @notice Split struct /// @param receivers Array of receivers /// @param fees Array of fees /// @dev First go to the first receiver, then the second, and so on struct Split { address[] receivers; uint256[] fees; // Fee in basis points with 1e18 precision } /// @notice Fee split. Split feeSplit; /// @notice SDT distributor address public sdtDistributor; /// @notice Claimer Fee. uint256 public claimerFee; /// @notice sd gauge address public immutable gauge; /// @notice Main Reward Token distributed. address public immutable rewardToken; /// @notice sd locker address public immutable locker; /// @notice Strategy address. address public strategy; /// @notice governance address public governance; /// @notice future governance address public futureGovernance; /// @notice Fee receiver contracts defined in Strategy address public feeReceiver; //////////////////////////////////////////////////////////////// /// --- EVENTS & ERRORS /////////////////////////////////////////////////////////////// /// @notice Error emitted when an onlyGovernance function has called by a different address error GOVERNANCE(); /// @notice Error emitted when the total fee would be more than 100% error FEE_TOO_HIGH(); /// @notice Error emitted when an onlyFutureGovernance function has called by a different address error FUTURE_GOVERNANCE(); /// @notice Error emitted when a zero address is pass error ZERO_ADDRESS(); /// @notice Error emitted when the fee is invalid error INVALID_SPLIT(); ////////////////////////////////////////////////////// /// --- MODIFIERS ////////////////////////////////////////////////////// /// @notice Modifier to check if the caller is the governance modifier onlyGovernance() { if (msg.sender != governance) revert GOVERNANCE(); _; } /// @notice Modifier to check if the caller is the future governance modifier onlyFutureGovernance() { if (msg.sender != futureGovernance) revert FUTURE_GOVERNANCE(); _; } ////////////////////////////////////////////////////// /// --- CONSTRUCTOR ////////////////////////////////////////////////////// /// @notice Constructor /// @param _gauge sd gauge /// @param _locker sd locker /// @param _governance governance constructor(address _gauge, address _rewardToken, address _locker, address _governance) { gauge = _gauge; locker = _locker; rewardToken = _rewardToken; governance = _governance; claimerFee = 1e15; // 0.1% } ////////////////////////////////////////////////////// /// --- MUTATIVE FUNCTIONS ////////////////////////////////////////////////////// /// @notice Claims all rewards tokens for the locker and notify them to the LGV4 function claimAndNotifyAll(bool notifySDT, bool claimFeeStrategy) external virtual {} /// @notice Notify the whole acc balance of a token /// @param token token to notify /// @param notifySDT if notify SDT or not /// @param claimFeeStrategy if pull tokens from the fee receiver or not function notifyReward(address token, bool notifySDT, bool claimFeeStrategy) public virtual { uint256 amount = ERC20(token).balanceOf(address(this)); // notify token as reward in sdToken gauge _notifyReward(token, amount, claimFeeStrategy); if (notifySDT) { // notify SDT _distributeSDT(); } } ////////////////////////////////////////////////////// /// --- INTERNAL FUNCTIONS ////////////////////////////////////////////////////// /// @notice Notify the new reward to the LGV4 /// @param tokenReward token to notify /// @param amount amount to notify /// @param claimFeeStrategy if pull tokens from the fee receiver or not (tokens already in that contract) function _notifyReward(address tokenReward, uint256 amount, bool claimFeeStrategy) internal virtual { _chargeFee(tokenReward, amount); if (claimFeeStrategy && feeReceiver != address(0)) { // Split fees for the specified token using the fee receiver contract // Function not permissionless, to prevent sending to that accumulator and re-splitting (_chargeFee) IFeeReceiver(feeReceiver).split(tokenReward); } amount = ERC20(tokenReward).balanceOf(address(this)); if (amount == 0) return; ILiquidityGauge(gauge).deposit_reward_token(tokenReward, amount); } /// @notice Distribute SDT to the gauge function _distributeSDT() internal { if (sdtDistributor != address(0)) { ISDTDistributor(sdtDistributor).distribute(gauge); } } /// @notice Charge fee for dao, liquidity, claimer /// @param _token token to charge fee for /// @param _amount amount to charge fee for function _chargeFee(address _token, uint256 _amount) internal virtual returns (uint256 _charged) { if (_amount == 0 || _token != rewardToken) return 0; Split memory _feeSplit = getFeeSplit(); uint256 fee; for (uint256 i = 0; i < _feeSplit.receivers.length; i++) { fee = (_amount * _feeSplit.fees[i]) / DENOMINATOR; SafeTransferLib.safeTransfer(_token, _feeSplit.receivers[i], fee); _charged += fee; } /// Claimer fee. fee = (_amount * claimerFee) / DENOMINATOR; SafeTransferLib.safeTransfer(_token, msg.sender, fee); _charged += fee; } /// @notice Take the fees accumulated from the strategy and sending to the fee receiver /// @dev Need to be done before calling `split`, but claimProtocolFees is permissionless. /// @dev Strategy not set in that abstract contract, must be implemented by child contracts function _claimFeeStrategy() internal virtual { IStrategy(strategy).claimProtocolFees(); } ////////////////////////////////////////////////////// /// --- GOVERNANCE FUNCTIONS ////////////////////////////////////////////////////// function getFeeSplit() public view returns (Split memory) { return feeSplit; } function setClaimerFee(uint256 _claimerFee) external onlyGovernance { if (_claimerFee > DENOMINATOR) revert FEE_TOO_HIGH(); claimerFee = _claimerFee; } /// @notice Set SDT distributor. /// @param _distributor SDT distributor address. function setDistributor(address _distributor) external onlyGovernance { sdtDistributor = _distributor; } /// @notice Set fee receiver (from Stategy) /// @param _feeReceiver Fee receiver address function setFeeReceiver(address _feeReceiver) external onlyGovernance { feeReceiver = _feeReceiver; } /// @notice Set a new future governance that can accept it /// @dev Can be called only by the governance /// @param _futureGovernance future governance address function transferGovernance(address _futureGovernance) external onlyGovernance { if (_futureGovernance == address(0)) revert ZERO_ADDRESS(); futureGovernance = _futureGovernance; } /// @notice Accept the governance /// @dev Can be called only by future governance function acceptGovernance() external onlyFutureGovernance { governance = futureGovernance; futureGovernance = address(0); } /// @notice Approve the distribution of a new token reward from the BaseAccumulator. /// @param _newTokenReward New token reward to be approved. function approveNewTokenReward(address _newTokenReward) external onlyGovernance { SafeTransferLib.safeApprove(_newTokenReward, gauge, type(uint256).max); } /// @notice Set fee split /// @param receivers array of receivers /// @param fees array of fees function setFeeSplit(address[] calldata receivers, uint256[] calldata fees) external onlyGovernance { if (receivers.length == 0 || receivers.length != fees.length) revert INVALID_SPLIT(); feeSplit = Split(receivers, fees); } function setStrategy(address _strategy) external onlyGovernance { strategy = _strategy; } /// @notice A function that rescue any ERC20 token /// @dev Can be called only by the governance /// @param _token token address /// @param _amount amount to rescue /// @param _recipient address to send token rescued function rescueERC20(address _token, uint256 _amount, address _recipient) external onlyGovernance { if (_recipient == address(0)) revert ZERO_ADDRESS(); SafeTransferLib.safeTransfer(_token, _recipient, _amount); } function name() external view virtual returns (string memory) { return string("Base Accumulator"); } /// @notice Get the version of the contract /// Version follows the Semantic Versioning (https://semver.org/) /// Major version is increased when backward compatibility is broken in this base contract. /// Minor version is increased when new features are added in this base contract. /// Patch version is increased when child contracts are updated. function version() external pure returns (string memory) { return "3.0.0"; } receive() external payable {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface ILocker { function createLock(uint256, uint256) external; function claimAllRewards(address[] calldata _tokens, address _recipient) external; function increaseAmount(uint256) external; function increaseAmount(uint128) external; function increaseUnlockTime(uint256) external; function release() external; function claimRewards(address, address) external; function claimRewards(address, address, address) external; function claimFXSRewards(address) external; function claimFPISRewards(address) external; function execute(address, uint256, bytes calldata) external returns (bool, bytes memory); function setGovernance(address) external; function voteGaugeWeight(address, uint256) external; function setAngleDepositor(address) external; function setDepositor(address) external; function setFxsDepositor(address) external; function setYFIDepositor(address) external; function setYieldDistributor(address) external; function setGaugeController(address) external; function setAccumulator(address _accumulator) external; function governance() external view returns (address); function increaseLock(uint256 _value, uint256 _duration) external; function release(address _recipient) external; function transferGovernance(address _governance) external; function acceptGovernance() external; function setStrategy(address _strategy) external; function claimRewards(address _recipient, address[] calldata _pools) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC20 + EIP-2612 implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC20.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol) /// /// @dev Note: /// - The ERC20 standard allows minting and transferring to and from the zero address, /// minting and transferring zero tokens, as well as self-approvals. /// For performance, this implementation WILL NOT revert for such actions. /// Please add any checks with overrides if desired. /// - The `permit` function uses the ecrecover precompile (0x1). /// /// If you are overriding: /// - NEVER violate the ERC20 invariant: /// the total sum of all balances must be equal to `totalSupply()`. /// - Check that the overridden function is actually used in the function you want to /// change the behavior of. Much of the code has been manually inlined for performance. abstract contract ERC20 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The total supply has overflowed. error TotalSupplyOverflow(); /// @dev The allowance has overflowed. error AllowanceOverflow(); /// @dev The allowance has underflowed. error AllowanceUnderflow(); /// @dev Insufficient balance. error InsufficientBalance(); /// @dev Insufficient allowance. error InsufficientAllowance(); /// @dev The permit is invalid. error InvalidPermit(); /// @dev The permit has expired. error PermitExpired(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when `amount` tokens is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 amount); /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`. event Approval(address indexed owner, address indexed spender, uint256 amount); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The storage slot for the total supply. uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c; /// @dev The balance slot of `owner` is given by: /// ``` /// mstore(0x0c, _BALANCE_SLOT_SEED) /// mstore(0x00, owner) /// let balanceSlot := keccak256(0x0c, 0x20) /// ``` uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2; /// @dev The allowance slot of (`owner`, `spender`) is given by: /// ``` /// mstore(0x20, spender) /// mstore(0x0c, _ALLOWANCE_SLOT_SEED) /// mstore(0x00, owner) /// let allowanceSlot := keccak256(0x0c, 0x34) /// ``` uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20; /// @dev The nonce slot of `owner` is given by: /// ``` /// mstore(0x0c, _NONCES_SLOT_SEED) /// mstore(0x00, owner) /// let nonceSlot := keccak256(0x0c, 0x20) /// ``` uint256 private constant _NONCES_SLOT_SEED = 0x38377508; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev `(_NONCES_SLOT_SEED << 16) | 0x1901`. uint256 private constant _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX = 0x383775081901; /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`. bytes32 private constant _DOMAIN_TYPEHASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; /// @dev `keccak256("1")`. bytes32 private constant _VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; /// @dev `keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")`. bytes32 private constant _PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 METADATA */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the name of the token. function name() public view virtual returns (string memory); /// @dev Returns the symbol of the token. function symbol() public view virtual returns (string memory); /// @dev Returns the decimals places of the token. function decimals() public view virtual returns (uint8) { return 18; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the amount of tokens in existence. function totalSupply() public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := sload(_TOTAL_SUPPLY_SLOT) } } /// @dev Returns the amount of tokens owned by `owner`. function balanceOf(address owner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x20)) } } /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`. function allowance(address owner, address spender) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { mstore(0x20, spender) mstore(0x0c, _ALLOWANCE_SLOT_SEED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x34)) } } /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. /// /// Emits a {Approval} event. function approve(address spender, uint256 amount) public virtual returns (bool) { /// @solidity memory-safe-assembly assembly { // Compute the allowance slot and store the amount. mstore(0x20, spender) mstore(0x0c, _ALLOWANCE_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x34), amount) // Emit the {Approval} event. mstore(0x00, amount) log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c))) } return true; } /// @dev Transfer `amount` tokens from the caller to `to`. /// /// Requirements: /// - `from` must at least have `amount`. /// /// Emits a {Transfer} event. function transfer(address to, uint256 amount) public virtual returns (bool) { _beforeTokenTransfer(msg.sender, to, amount); /// @solidity memory-safe-assembly assembly { // Compute the balance slot and load its value. mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, caller()) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Compute the balance slot of `to`. mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance of `to`. // Will not overflow because the sum of all user balances // cannot exceed the maximum uint256 value. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c))) } _afterTokenTransfer(msg.sender, to, amount); return true; } /// @dev Transfers `amount` tokens from `from` to `to`. /// /// Note: Does not update the allowance if it is the maximum uint256 value. /// /// Requirements: /// - `from` must at least have `amount`. /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) { _beforeTokenTransfer(from, to, amount); /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) // Compute the allowance slot and load its value. mstore(0x20, caller()) mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED)) let allowanceSlot := keccak256(0x0c, 0x34) let allowance_ := sload(allowanceSlot) // If the allowance is not the maximum uint256 value. if add(allowance_, 1) { // Revert if the amount to be transferred exceeds the allowance. if gt(amount, allowance_) { mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. revert(0x1c, 0x04) } // Subtract and store the updated allowance. sstore(allowanceSlot, sub(allowance_, amount)) } // Compute the balance slot and load its value. mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Compute the balance slot of `to`. mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance of `to`. // Will not overflow because the sum of all user balances // cannot exceed the maximum uint256 value. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) } _afterTokenTransfer(from, to, amount); return true; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EIP-2612 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev For more performance, override to return the constant value /// of `keccak256(bytes(name()))` if `name()` will never change. function _constantNameHash() internal view virtual returns (bytes32 result) {} /// @dev Returns the current nonce for `owner`. /// This value is used to compute the signature for EIP-2612 permit. function nonces(address owner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the nonce slot and load its value. mstore(0x0c, _NONCES_SLOT_SEED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x20)) } } /// @dev Sets `value` as the allowance of `spender` over the tokens of `owner`, /// authorized by a signed approval by `owner`. /// /// Emits a {Approval} event. function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { bytes32 nameHash = _constantNameHash(); // We simply calculate it on-the-fly to allow for cases where the `name` may change. if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); /// @solidity memory-safe-assembly assembly { // Revert if the block timestamp is greater than `deadline`. if gt(timestamp(), deadline) { mstore(0x00, 0x1a15a3cc) // `PermitExpired()`. revert(0x1c, 0x04) } let m := mload(0x40) // Grab the free memory pointer. // Clean the upper 96 bits. owner := shr(96, shl(96, owner)) spender := shr(96, shl(96, spender)) // Compute the nonce slot and load its value. mstore(0x0e, _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX) mstore(0x00, owner) let nonceSlot := keccak256(0x0c, 0x20) let nonceValue := sload(nonceSlot) // Prepare the domain separator. mstore(m, _DOMAIN_TYPEHASH) mstore(add(m, 0x20), nameHash) mstore(add(m, 0x40), _VERSION_HASH) mstore(add(m, 0x60), chainid()) mstore(add(m, 0x80), address()) mstore(0x2e, keccak256(m, 0xa0)) // Prepare the struct hash. mstore(m, _PERMIT_TYPEHASH) mstore(add(m, 0x20), owner) mstore(add(m, 0x40), spender) mstore(add(m, 0x60), value) mstore(add(m, 0x80), nonceValue) mstore(add(m, 0xa0), deadline) mstore(0x4e, keccak256(m, 0xc0)) // Prepare the ecrecover calldata. mstore(0x00, keccak256(0x2c, 0x42)) mstore(0x20, and(0xff, v)) mstore(0x40, r) mstore(0x60, s) let t := staticcall(gas(), 1, 0, 0x80, 0x20, 0x20) // If the ecrecover fails, the returndatasize will be 0x00, // `owner` will be checked if it equals the hash at 0x00, // which evaluates to false (i.e. 0), and we will revert. // If the ecrecover succeeds, the returndatasize will be 0x20, // `owner` will be compared against the returned address at 0x20. if iszero(eq(mload(returndatasize()), owner)) { mstore(0x00, 0xddafbaef) // `InvalidPermit()`. revert(0x1c, 0x04) } // Increment and store the updated nonce. sstore(nonceSlot, add(nonceValue, t)) // `t` is 1 if ecrecover succeeds. // Compute the allowance slot and store the value. // The `owner` is already at slot 0x20. mstore(0x40, or(shl(160, _ALLOWANCE_SLOT_SEED), spender)) sstore(keccak256(0x2c, 0x34), value) // Emit the {Approval} event. log3(add(m, 0x60), 0x20, _APPROVAL_EVENT_SIGNATURE, owner, spender) mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. } } /// @dev Returns the EIP-712 domain separator for the EIP-2612 permit. function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) { bytes32 nameHash = _constantNameHash(); // We simply calculate it on-the-fly to allow for cases where the `name` may change. if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Grab the free memory pointer. mstore(m, _DOMAIN_TYPEHASH) mstore(add(m, 0x20), nameHash) mstore(add(m, 0x40), _VERSION_HASH) mstore(add(m, 0x60), chainid()) mstore(add(m, 0x80), address()) result := keccak256(m, 0xa0) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL MINT FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Mints `amount` tokens to `to`, increasing the total supply. /// /// Emits a {Transfer} event. function _mint(address to, uint256 amount) internal virtual { _beforeTokenTransfer(address(0), to, amount); /// @solidity memory-safe-assembly assembly { let totalSupplyBefore := sload(_TOTAL_SUPPLY_SLOT) let totalSupplyAfter := add(totalSupplyBefore, amount) // Revert if the total supply overflows. if lt(totalSupplyAfter, totalSupplyBefore) { mstore(0x00, 0xe5cfe957) // `TotalSupplyOverflow()`. revert(0x1c, 0x04) } // Store the updated total supply. sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter) // Compute the balance slot and load its value. mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c))) } _afterTokenTransfer(address(0), to, amount); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL BURN FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Burns `amount` tokens from `from`, reducing the total supply. /// /// Emits a {Transfer} event. function _burn(address from, uint256 amount) internal virtual { _beforeTokenTransfer(from, address(0), amount); /// @solidity memory-safe-assembly assembly { // Compute the balance slot and load its value. mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, from) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Subtract and store the updated total supply. sstore(_TOTAL_SUPPLY_SLOT, sub(sload(_TOTAL_SUPPLY_SLOT), amount)) // Emit the {Transfer} event. mstore(0x00, amount) log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0) } _afterTokenTransfer(from, address(0), amount); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL TRANSFER FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Moves `amount` of tokens from `from` to `to`. function _transfer(address from, address to, uint256 amount) internal virtual { _beforeTokenTransfer(from, to, amount); /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) // Compute the balance slot and load its value. mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Compute the balance slot of `to`. mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance of `to`. // Will not overflow because the sum of all user balances // cannot exceed the maximum uint256 value. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) } _afterTokenTransfer(from, to, amount); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL ALLOWANCE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Updates the allowance of `owner` for `spender` based on spent `amount`. function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { /// @solidity memory-safe-assembly assembly { // Compute the allowance slot and load its value. mstore(0x20, spender) mstore(0x0c, _ALLOWANCE_SLOT_SEED) mstore(0x00, owner) let allowanceSlot := keccak256(0x0c, 0x34) let allowance_ := sload(allowanceSlot) // If the allowance is not the maximum uint256 value. if add(allowance_, 1) { // Revert if the amount to be transferred exceeds the allowance. if gt(amount, allowance_) { mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. revert(0x1c, 0x04) } // Subtract and store the updated allowance. sstore(allowanceSlot, sub(allowance_, amount)) } } } /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`. /// /// Emits a {Approval} event. function _approve(address owner, address spender, uint256 amount) internal virtual { /// @solidity memory-safe-assembly assembly { let owner_ := shl(96, owner) // Compute the allowance slot and store the amount. mstore(0x20, spender) mstore(0x0c, or(owner_, _ALLOWANCE_SLOT_SEED)) sstore(keccak256(0x0c, 0x34), amount) // Emit the {Approval} event. mstore(0x00, amount) log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HOOKS TO OVERRIDE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Hook that is called before any transfer of tokens. /// This includes minting and burning. function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /// @dev Hook that is called after any transfer of tokens. /// This includes minting and burning. function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /// @dev The Permit2 operation has failed. error Permit2Failed(); /// @dev The Permit2 amount must be less than `2**160 - 1`. error Permit2AmountOverflow(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet. address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev The canonical Permit2 address. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. success := and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( // The arguments of `mul` are evaluated from right to left. mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// If the initial attempt fails, try to use Permit2 to transfer the token. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { if (!trySafeTransferFrom(token, from, to, amount)) { permit2TransferFrom(token, from, to, amount); } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. /// Reverts upon failure. function permit2TransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(add(m, 0x74), shr(96, shl(96, token))) mstore(add(m, 0x54), amount) mstore(add(m, 0x34), to) mstore(add(m, 0x20), shl(96, from)) // `transferFrom(address,address,uint160,address)`. mstore(m, 0x36c78516000000000000000000000000) let p := PERMIT2 let exists := eq(chainid(), 1) if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) { mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) } } } /// @dev Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. function permit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { bool success; /// @solidity memory-safe-assembly assembly { for {} shl(96, xor(token, WETH9)) {} { mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. if iszero( and( // The arguments of `and` are evaluated from right to left. lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. // Gas stipend to limit gas burn for tokens that don't refund gas when // an non-existing function is called. 5K should be enough for a SLOAD. staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) ) ) { break } // After here, we can be sure that token is a contract. let m := mload(0x40) mstore(add(m, 0x34), spender) mstore(add(m, 0x20), shl(96, owner)) mstore(add(m, 0x74), deadline) if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { mstore(0x14, owner) mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. // `nonces` is already at `add(m, 0x54)`. // `1` is already stored at `add(m, 0x94)`. mstore(add(m, 0xb4), and(0xff, v)) mstore(add(m, 0xd4), r) mstore(add(m, 0xf4), s) success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) break } mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. mstore(add(m, 0x54), amount) mstore(add(m, 0x94), and(0xff, v)) mstore(add(m, 0xb4), r) mstore(add(m, 0xd4), s) success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) break } } if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); } /// @dev Simple permit on the Permit2 contract. function simplePermit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(m, 0x927da105) // `allowance(address,address,address)`. { let addressMask := shr(96, not(0)) mstore(add(m, 0x20), and(addressMask, owner)) mstore(add(m, 0x40), and(addressMask, token)) mstore(add(m, 0x60), and(addressMask, spender)) mstore(add(m, 0xc0), and(addressMask, spender)) } let p := mul(PERMIT2, iszero(shr(160, amount))) if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) ) ) { mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(p))), 0x04) } mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). // `owner` is already `add(m, 0x20)`. // `token` is already at `add(m, 0x40)`. mstore(add(m, 0x60), amount) mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. // `nonce` is already at `add(m, 0xa0)`. // `spender` is already at `add(m, 0xc0)`. mstore(add(m, 0xe0), deadline) mstore(add(m, 0x100), 0x100) // `signature` offset. mstore(add(m, 0x120), 0x41) // `signature` length. mstore(add(m, 0x140), r) mstore(add(m, 0x160), s) mstore(add(m, 0x180), shl(248, v)) if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) { mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.19; interface IFeeReceiver { struct Repartition { address[] receivers; uint256[] fees; // Fee in basis points, where 10,000 basis points = 100% } function governance() external view returns (address); function futureGovernance() external view returns (address); function acceptGovernance() external; function transferGovernance(address _futureGovernance) external; function getRepartition(address rewardToken) external view returns (address[] memory receivers, uint256[] memory fees); function setRepartition(address rewardToken, address[] calldata receivers, uint256[] calldata fees) external; function split(address rewardToken) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.19; interface IStrategy { function locker() external view returns (address); function deposit(address _token, uint256 amount) external; function withdraw(address _token, uint256 amount) external; function claimProtocolFees() external; function claimNativeRewards() external; function harvest(address _asset, bool _distributeSDT, bool _claimExtra) external; function rewardDistributors(address _gauge) external view returns (address); /// Factory functions function toggleVault(address vault) external; function setGauge(address token, address gauge) external; function setLGtype(address gauge, uint256 gaugeType) external; function addRewardToken(address _token, address _rewardDistributor) external; function acceptRewardDistributorOwnership(address rewardDistributor) external; function setRewardDistributor(address gauge, address rewardDistributor) external; function addRewardReceiver(address gauge, address rewardReceiver) external; // Governance function setAccumulator(address newAccumulator) external; function setFeeRewardToken(address newFeeRewardToken) external; function setFeeDistributor(address newFeeDistributor) external; function setFactory(address newFactory) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; interface ILiquidityGauge { struct Reward { address token; address distributor; // solhint-disable-next-line uint256 period_finish; uint256 rate; // solhint-disable-next-line uint256 last_update; uint256 integral; } // solhint-disable-next-line function deposit_reward_token(address _rewardToken, uint256 _amount) external; // solhint-disable-next-line function claim_rewards_for(address _user, address _recipient) external; // solhint-disable-next-line function working_balances(address _address) external view returns (uint256); // solhint-disable-next-line function deposit(uint256 _value, address _addr) external; // solhint-disable-next-line function reward_tokens(uint256 _i) external view returns (address); // solhint-disable-next-line function reward_data(address _tokenReward) external view returns (Reward memory); function balanceOf(address) external returns (uint256); // solhint-disable-next-line function claimable_reward(address _user, address _reward_token) external view returns (uint256); // solhint-disable-next-line function claimable_tokens(address _user) external returns (uint256); // solhint-disable-next-line function user_checkpoint(address _user) external returns (bool); // solhint-disable-next-line function commit_transfer_ownership(address) external; // solhint-disable-next-line function claim_rewards() external; // solhint-disable-next-line function claim_rewards(address) external; // solhint-disable-next-line function claim_rewards(address, address) external; // solhint-disable-next-line function add_reward(address, address) external; // solhint-disable-next-line function set_claimer(address) external; function admin() external view returns (address); function future_admin() external view returns (address); // solhint-disable-next-line function set_reward_distributor(address _rewardToken, address _newDistrib) external; function initialize( // solhint-disable-next-line address staking_token, address admin, address sdt, // solhint-disable-next-line address voting_escrow, // solhint-disable-next-line address veBoost_proxy, address distributor ) external; function totalSupply() external returns (uint256); function withdraw(uint256 _value, bool _claimReward) external; function withdraw(uint256 _valut, address _user, bool _claimReward) external; // solhint-disable-next-line function accept_transfer_ownership() external; // solhint-disable-next-line function claimed_reward(address _addr, address _token) external view returns (uint256); // solhint-disable-next-line function set_rewards_receiver(address _receiver) external; }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.7; interface ISDTDistributor { function distribute(address gaugeAddr) external; }
{ "remappings": [ "solady/=node_modules/solady/", "forge-std/=node_modules/forge-std/", "herdaddy/=node_modules/@stake-dao/herdaddy/src/", "address-book/=node_modules/@stake-dao/address-book/", "openzeppelin-contracts/=node_modules/@openzeppelin/contracts/", "@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/", "solidity-examples/=node_modules/@layerzerolabs/solidity-examples/contracts/", "@layerzerolabs/=node_modules/@layerzerolabs/", "forge-std/=node_modules/forge-std/", "solady/=node_modules/solady/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_locker","type":"address"},{"internalType":"address","name":"_governance","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FEE_TOO_HIGH","type":"error"},{"inputs":[],"name":"FUTURE_GOVERNANCE","type":"error"},{"inputs":[],"name":"GOVERNANCE","type":"error"},{"inputs":[],"name":"INVALID_SPLIT","type":"error"},{"inputs":[],"name":"ZERO_ADDRESS","type":"error"},{"inputs":[],"name":"DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_DISTRIBUTOR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FXN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WSTETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newTokenReward","type":"address"}],"name":"approveNewTokenReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"notifySDT","type":"bool"},{"internalType":"bool","name":"claimFeeStrategy","type":"bool"}],"name":"claimAndNotifyAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimerFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"futureGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeSplit","outputs":[{"components":[{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"fees","type":"uint256[]"}],"internalType":"struct BaseAccumulator.Split","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"notifySDT","type":"bool"},{"internalType":"bool","name":"claimFeeStrategy","type":"bool"}],"name":"notifyReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sdtDistributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimerFee","type":"uint256"}],"name":"setClaimerFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_distributor","type":"address"}],"name":"setDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeReceiver","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"fees","type":"uint256[]"}],"name":"setFeeSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"setStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_futureGovernance","type":"address"}],"name":"transferGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e06040523480156200001157600080fd5b50604051620015ec380380620015ec83398101604081905262000034916200013e565b6001600160a01b0383811660805282811660c052737f39c581f595b53c5cb19bd0b3f8da6c935e2ca060a052600580546001600160a01b03191691831691909117905566038d7ea4c68000600355620000a573365accfca291e7d3914637abf1f7635db165bb0984600019620000d1565b620000c8737f39c581f595b53c5cb19bd0b3f8da6c935e2ca084600019620000d1565b50505062000188565b81601452806034526f095ea7b300000000000000000000000060005260206000604460106000875af13d1560016000511417166200011757633e3f8f736000526004601cfd5b6000603452505050565b80516001600160a01b03811681146200013957600080fd5b919050565b6000806000606084860312156200015457600080fd5b6200015f8462000121565b92506200016f6020850162000121565b91506200017f6040850162000121565b90509250925092565b60805160a05160c051611411620001db600039600081816104b301526109a10152600081816105710152610ea40152600081816103b7015281816108ba01528181610ced0152610d7001526114116000f3fe6080604052600436106101a05760003560e01c8063a6f19c84116100ec578063d7b96d4e1161008a578063eda0be6911610064578063eda0be691461051d578063efdcd9741461053f578063f7c618c11461055f578063fc0f372e1461059357600080fd5b8063d7b96d4e146104a1578063d9fb643a146104d5578063e02dd6ec146104fd57600080fd5b8063ac24ef25116100c6578063ac24ef2514610421578063b3f0067414610441578063d38bfff414610461578063d3da743e1461048157600080fd5b8063a6f19c84146103a5578063a8c62e76146103d9578063a96478e0146103f957600080fd5b806367871a9c1161015957806375619ab51161013357806375619ab51461031b57806377662ffc1461033b5780638070c5031461035b578063918f86741461037b57600080fd5b806367871a9c146102b357806368752f5e146102d35780636910dcce146102f357600080fd5b806306fdde03146101ac57806315f5c300146101f6578063238efcbc1461022e57806333a100ca1461024557806354fd4d50146102655780635aa6e6751461029357600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b5060408051808201909152600f81526e232c271020b1b1bab6bab630ba37b960891b60208201525b6040516101ed919061107d565b60405180910390f35b34801561020257600080fd5b50600254610216906001600160a01b031681565b6040516001600160a01b0390911681526020016101ed565b34801561023a57600080fd5b506102436105a9565b005b34801561025157600080fd5b506102436102603660046110e7565b6105fb565b34801561027157600080fd5b506040805180820190915260058152640332e302e360dc1b60208201526101e0565b34801561029f57600080fd5b50600554610216906001600160a01b031681565b3480156102bf57600080fd5b506102436102ce366004611119565b610648565b3480156102df57600080fd5b506102436102ee3660046111a8565b6106d4565b3480156102ff57600080fd5b5061021673d116513eea4efe3908212afbaefc76cb2924568181565b34801561032757600080fd5b506102436103363660046110e7565b6107da565b34801561034757600080fd5b50610243610356366004611214565b610827565b34801561036757600080fd5b50600654610216906001600160a01b031681565b34801561038757600080fd5b50610397670de0b6b3a764000081565b6040519081526020016101ed565b3480156103b157600080fd5b506102167f000000000000000000000000000000000000000000000000000000000000000081565b3480156103e557600080fd5b50600454610216906001600160a01b031681565b34801561040557600080fd5b5061021673365accfca291e7d3914637abf1f7635db165bb0981565b34801561042d57600080fd5b5061024361043c3660046110e7565b610889565b34801561044d57600080fd5b50600754610216906001600160a01b031681565b34801561046d57600080fd5b5061024361047c3660046110e7565b6108e4565b34801561048d57600080fd5b5061024361049c366004611247565b610958565b3480156104ad57600080fd5b506102167f000000000000000000000000000000000000000000000000000000000000000081565b3480156104e157600080fd5b50610216737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b34801561050957600080fd5b5061024361051836600461127a565b610a4c565b34801561052957600080fd5b50610532610aa5565b6040516101ed9190611293565b34801561054b57600080fd5b5061024361055a3660046110e7565b610b7c565b34801561056b57600080fd5b506102167f000000000000000000000000000000000000000000000000000000000000000081565b34801561059f57600080fd5b5061039760035481565b6006546001600160a01b031633146105d457604051637ea33de360e01b815260040160405180910390fd5b60068054600580546001600160a01b03199081166001600160a01b03841617909155169055565b6005546001600160a01b03163314610626576040516305189e0d60e21b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa15801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190611331565b90506106c0848284610bc9565b82156106ce576106ce610d45565b50505050565b6005546001600160a01b031633146106ff576040516305189e0d60e21b815260040160405180910390fd5b82158061070c5750828114155b1561072a5760405163e22b17a960e01b815260040160405180910390fd5b604051806040016040528085858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060408051602085810282810182019093528582529283019290918691869182918501908490808284376000920182905250939094525050825180519192506107b891839160200190610fc8565b5060208281015180516107d1926001850192019061102d565b50505050505050565b6005546001600160a01b03163314610805576040516305189e0d60e21b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610852576040516305189e0d60e21b815260040160405180910390fd5b6001600160a01b0381166108795760405163538ba4f960e01b815260040160405180910390fd5b610884838284610dd3565b505050565b6005546001600160a01b031633146108b4576040516305189e0d60e21b815260040160405180910390fd5b6108e1817f0000000000000000000000000000000000000000000000000000000000000000600019610e19565b50565b6005546001600160a01b0316331461090f576040516305189e0d60e21b815260040160405180910390fd5b6001600160a01b0381166109365760405163538ba4f960e01b815260040160405180910390fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6040516376e1a76760e11b815273d116513eea4efe3908212afbaefc76cb292456816004820152737f39c581f595b53c5cb19bd0b3f8da6c935e2ca060248201523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063edc34ece90606401600060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b50505050808015610a1c57506004546001600160a01b031615155b15610a2957610a29610e55565b610a48737f39c581f595b53c5cb19bd0b3f8da6c935e2ca08383610648565b5050565b6005546001600160a01b03163314610a77576040516305189e0d60e21b815260040160405180910390fd5b670de0b6b3a7640000811115610aa0576040516345fbd9c160e01b815260040160405180910390fd5b600355565b6040805180820190915260608082526020820152604080516000805460606020820284018101855293830181815292939192849290918491840182828015610b1657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610af8575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015610b6e57602002820191906000526020600020905b815481526020019060010190808311610b5a575b505050505081525050905090565b6005546001600160a01b03163314610ba7576040516305189e0d60e21b815260040160405180910390fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b610bd38383610e98565b50808015610beb57506007546001600160a01b031615155b15610c505760075460405163056fa47f60e41b81526001600160a01b038581166004830152909116906356fa47f090602401600060405180830381600087803b158015610c3757600080fd5b505af1158015610c4b573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610c94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb89190611331565b915081600003610cc757505050565b6040516393f7aa6760e01b81526001600160a01b038481166004830152602482018490527f000000000000000000000000000000000000000000000000000000000000000016906393f7aa6790604401600060405180830381600087803b158015610d3157600080fd5b505af11580156107d1573d6000803e3d6000fd5b6002546001600160a01b031615610dd1576002546040516363453ae160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152909116906363453ae190602401600060405180830381600087803b158015610dbd57600080fd5b505af11580156106ce573d6000803e3d6000fd5b565b816014528060345263a9059cbb60601b60005260206000604460106000875af13d156001600051141716610e0f576390b8ec186000526004601cfd5b6000603452505050565b816014528060345263095ea7b360601b60005260206000604460106000875af13d156001600051141716610e0f57633e3f8f736000526004601cfd5b6004805460408051634a7d036960e01b815290516001600160a01b0390921692634a7d036992828201926000929082900301818387803b158015610dbd57600080fd5b6000811580610ed957507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614155b15610ee657506000610fc2565b6000610ef0610aa5565b90506000805b825151811015610f8457670de0b6b3a764000083602001518281518110610f1f57610f1f61134a565b602002602001015186610f329190611376565b610f3c919061138d565b9150610f668684600001518381518110610f5857610f5861134a565b602002602001015184610dd3565b610f7082856113af565b935080610f7c816113c2565b915050610ef6565b50670de0b6b3a764000060035485610f9c9190611376565b610fa6919061138d565b9050610fb3853383610dd3565b610fbd81846113af565b925050505b92915050565b82805482825590600052602060002090810192821561101d579160200282015b8281111561101d57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190610fe8565b50611029929150611068565b5090565b82805482825590600052602060002090810192821561101d579160200282015b8281111561101d57825182559160200191906001019061104d565b5b808211156110295760008155600101611069565b600060208083528351808285015260005b818110156110aa5785810183015185820160400152820161108e565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146110e257600080fd5b919050565b6000602082840312156110f957600080fd5b611102826110cb565b9392505050565b803580151581146110e257600080fd5b60008060006060848603121561112e57600080fd5b611137846110cb565b925061114560208501611109565b915061115360408501611109565b90509250925092565b60008083601f84011261116e57600080fd5b50813567ffffffffffffffff81111561118657600080fd5b6020830191508360208260051b85010111156111a157600080fd5b9250929050565b600080600080604085870312156111be57600080fd5b843567ffffffffffffffff808211156111d657600080fd5b6111e28883890161115c565b909650945060208701359150808211156111fb57600080fd5b506112088782880161115c565b95989497509550505050565b60008060006060848603121561122957600080fd5b611232846110cb565b925060208401359150611153604085016110cb565b6000806040838503121561125a57600080fd5b61126383611109565b915061127160208401611109565b90509250929050565b60006020828403121561128c57600080fd5b5035919050565b6020808252825160408383015280516060840181905260009291820190839060808601905b808310156112e15783516001600160a01b031682529284019260019290920191908401906112b8565b5086840151868203601f190160408801528051808352908501935090840191506000905b808210156113255783518352928401929184019160019190910190611305565b50909695505050505050565b60006020828403121561134357600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610fc257610fc2611360565b6000826113aa57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610fc257610fc2611360565b6000600182016113d4576113d4611360565b506001019056fea264697066735822122082ad94b8efdcc5cbefbcf90c03c4075fe18d0a9de0ca71da3cf9136176ebb27464736f6c63430008130033000000000000000000000000bcfe5c47129253c6b8a9a00565b3358b488d42e000000000000000000000000075736518075a01034fa72d675d36a47e9b06b2fb000000000000000000000000000755fbe4a24d7478bfcfc1e561afce82d1ff62
Deployed Bytecode
0x6080604052600436106101a05760003560e01c8063a6f19c84116100ec578063d7b96d4e1161008a578063eda0be6911610064578063eda0be691461051d578063efdcd9741461053f578063f7c618c11461055f578063fc0f372e1461059357600080fd5b8063d7b96d4e146104a1578063d9fb643a146104d5578063e02dd6ec146104fd57600080fd5b8063ac24ef25116100c6578063ac24ef2514610421578063b3f0067414610441578063d38bfff414610461578063d3da743e1461048157600080fd5b8063a6f19c84146103a5578063a8c62e76146103d9578063a96478e0146103f957600080fd5b806367871a9c1161015957806375619ab51161013357806375619ab51461031b57806377662ffc1461033b5780638070c5031461035b578063918f86741461037b57600080fd5b806367871a9c146102b357806368752f5e146102d35780636910dcce146102f357600080fd5b806306fdde03146101ac57806315f5c300146101f6578063238efcbc1461022e57806333a100ca1461024557806354fd4d50146102655780635aa6e6751461029357600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b5060408051808201909152600f81526e232c271020b1b1bab6bab630ba37b960891b60208201525b6040516101ed919061107d565b60405180910390f35b34801561020257600080fd5b50600254610216906001600160a01b031681565b6040516001600160a01b0390911681526020016101ed565b34801561023a57600080fd5b506102436105a9565b005b34801561025157600080fd5b506102436102603660046110e7565b6105fb565b34801561027157600080fd5b506040805180820190915260058152640332e302e360dc1b60208201526101e0565b34801561029f57600080fd5b50600554610216906001600160a01b031681565b3480156102bf57600080fd5b506102436102ce366004611119565b610648565b3480156102df57600080fd5b506102436102ee3660046111a8565b6106d4565b3480156102ff57600080fd5b5061021673d116513eea4efe3908212afbaefc76cb2924568181565b34801561032757600080fd5b506102436103363660046110e7565b6107da565b34801561034757600080fd5b50610243610356366004611214565b610827565b34801561036757600080fd5b50600654610216906001600160a01b031681565b34801561038757600080fd5b50610397670de0b6b3a764000081565b6040519081526020016101ed565b3480156103b157600080fd5b506102167f000000000000000000000000bcfe5c47129253c6b8a9a00565b3358b488d42e081565b3480156103e557600080fd5b50600454610216906001600160a01b031681565b34801561040557600080fd5b5061021673365accfca291e7d3914637abf1f7635db165bb0981565b34801561042d57600080fd5b5061024361043c3660046110e7565b610889565b34801561044d57600080fd5b50600754610216906001600160a01b031681565b34801561046d57600080fd5b5061024361047c3660046110e7565b6108e4565b34801561048d57600080fd5b5061024361049c366004611247565b610958565b3480156104ad57600080fd5b506102167f00000000000000000000000075736518075a01034fa72d675d36a47e9b06b2fb81565b3480156104e157600080fd5b50610216737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b34801561050957600080fd5b5061024361051836600461127a565b610a4c565b34801561052957600080fd5b50610532610aa5565b6040516101ed9190611293565b34801561054b57600080fd5b5061024361055a3660046110e7565b610b7c565b34801561056b57600080fd5b506102167f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b34801561059f57600080fd5b5061039760035481565b6006546001600160a01b031633146105d457604051637ea33de360e01b815260040160405180910390fd5b60068054600580546001600160a01b03199081166001600160a01b03841617909155169055565b6005546001600160a01b03163314610626576040516305189e0d60e21b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa15801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190611331565b90506106c0848284610bc9565b82156106ce576106ce610d45565b50505050565b6005546001600160a01b031633146106ff576040516305189e0d60e21b815260040160405180910390fd5b82158061070c5750828114155b1561072a5760405163e22b17a960e01b815260040160405180910390fd5b604051806040016040528085858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060408051602085810282810182019093528582529283019290918691869182918501908490808284376000920182905250939094525050825180519192506107b891839160200190610fc8565b5060208281015180516107d1926001850192019061102d565b50505050505050565b6005546001600160a01b03163314610805576040516305189e0d60e21b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610852576040516305189e0d60e21b815260040160405180910390fd5b6001600160a01b0381166108795760405163538ba4f960e01b815260040160405180910390fd5b610884838284610dd3565b505050565b6005546001600160a01b031633146108b4576040516305189e0d60e21b815260040160405180910390fd5b6108e1817f000000000000000000000000bcfe5c47129253c6b8a9a00565b3358b488d42e0600019610e19565b50565b6005546001600160a01b0316331461090f576040516305189e0d60e21b815260040160405180910390fd5b6001600160a01b0381166109365760405163538ba4f960e01b815260040160405180910390fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6040516376e1a76760e11b815273d116513eea4efe3908212afbaefc76cb292456816004820152737f39c581f595b53c5cb19bd0b3f8da6c935e2ca060248201523060448201527f00000000000000000000000075736518075a01034fa72d675d36a47e9b06b2fb6001600160a01b03169063edc34ece90606401600060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b50505050808015610a1c57506004546001600160a01b031615155b15610a2957610a29610e55565b610a48737f39c581f595b53c5cb19bd0b3f8da6c935e2ca08383610648565b5050565b6005546001600160a01b03163314610a77576040516305189e0d60e21b815260040160405180910390fd5b670de0b6b3a7640000811115610aa0576040516345fbd9c160e01b815260040160405180910390fd5b600355565b6040805180820190915260608082526020820152604080516000805460606020820284018101855293830181815292939192849290918491840182828015610b1657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610af8575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015610b6e57602002820191906000526020600020905b815481526020019060010190808311610b5a575b505050505081525050905090565b6005546001600160a01b03163314610ba7576040516305189e0d60e21b815260040160405180910390fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b610bd38383610e98565b50808015610beb57506007546001600160a01b031615155b15610c505760075460405163056fa47f60e41b81526001600160a01b038581166004830152909116906356fa47f090602401600060405180830381600087803b158015610c3757600080fd5b505af1158015610c4b573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610c94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb89190611331565b915081600003610cc757505050565b6040516393f7aa6760e01b81526001600160a01b038481166004830152602482018490527f000000000000000000000000bcfe5c47129253c6b8a9a00565b3358b488d42e016906393f7aa6790604401600060405180830381600087803b158015610d3157600080fd5b505af11580156107d1573d6000803e3d6000fd5b6002546001600160a01b031615610dd1576002546040516363453ae160e01b81526001600160a01b037f000000000000000000000000bcfe5c47129253c6b8a9a00565b3358b488d42e081166004830152909116906363453ae190602401600060405180830381600087803b158015610dbd57600080fd5b505af11580156106ce573d6000803e3d6000fd5b565b816014528060345263a9059cbb60601b60005260206000604460106000875af13d156001600051141716610e0f576390b8ec186000526004601cfd5b6000603452505050565b816014528060345263095ea7b360601b60005260206000604460106000875af13d156001600051141716610e0f57633e3f8f736000526004601cfd5b6004805460408051634a7d036960e01b815290516001600160a01b0390921692634a7d036992828201926000929082900301818387803b158015610dbd57600080fd5b6000811580610ed957507f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca06001600160a01b0316836001600160a01b031614155b15610ee657506000610fc2565b6000610ef0610aa5565b90506000805b825151811015610f8457670de0b6b3a764000083602001518281518110610f1f57610f1f61134a565b602002602001015186610f329190611376565b610f3c919061138d565b9150610f668684600001518381518110610f5857610f5861134a565b602002602001015184610dd3565b610f7082856113af565b935080610f7c816113c2565b915050610ef6565b50670de0b6b3a764000060035485610f9c9190611376565b610fa6919061138d565b9050610fb3853383610dd3565b610fbd81846113af565b925050505b92915050565b82805482825590600052602060002090810192821561101d579160200282015b8281111561101d57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190610fe8565b50611029929150611068565b5090565b82805482825590600052602060002090810192821561101d579160200282015b8281111561101d57825182559160200191906001019061104d565b5b808211156110295760008155600101611069565b600060208083528351808285015260005b818110156110aa5785810183015185820160400152820161108e565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146110e257600080fd5b919050565b6000602082840312156110f957600080fd5b611102826110cb565b9392505050565b803580151581146110e257600080fd5b60008060006060848603121561112e57600080fd5b611137846110cb565b925061114560208501611109565b915061115360408501611109565b90509250925092565b60008083601f84011261116e57600080fd5b50813567ffffffffffffffff81111561118657600080fd5b6020830191508360208260051b85010111156111a157600080fd5b9250929050565b600080600080604085870312156111be57600080fd5b843567ffffffffffffffff808211156111d657600080fd5b6111e28883890161115c565b909650945060208701359150808211156111fb57600080fd5b506112088782880161115c565b95989497509550505050565b60008060006060848603121561122957600080fd5b611232846110cb565b925060208401359150611153604085016110cb565b6000806040838503121561125a57600080fd5b61126383611109565b915061127160208401611109565b90509250929050565b60006020828403121561128c57600080fd5b5035919050565b6020808252825160408383015280516060840181905260009291820190839060808601905b808310156112e15783516001600160a01b031682529284019260019290920191908401906112b8565b5086840151868203601f190160408801528051808352908501935090840191506000905b808210156113255783518352928401929184019160019190910190611305565b50909695505050505050565b60006020828403121561134357600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610fc257610fc2611360565b6000826113aa57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610fc257610fc2611360565b6000600182016113d4576113d4611360565b506001019056fea264697066735822122082ad94b8efdcc5cbefbcf90c03c4075fe18d0a9de0ca71da3cf9136176ebb27464736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bcfe5c47129253c6b8a9a00565b3358b488d42e000000000000000000000000075736518075a01034fa72d675d36a47e9b06b2fb000000000000000000000000000755fbe4a24d7478bfcfc1e561afce82d1ff62
-----Decoded View---------------
Arg [0] : _gauge (address): 0xbcfE5c47129253C6B8a9A00565B3358b488D42E0
Arg [1] : _locker (address): 0x75736518075a01034fa72D675D36a47e9B06B2Fb
Arg [2] : _governance (address): 0x000755Fbe4A24d7478bfcFC1E561AfCE82d1ff62
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000bcfe5c47129253c6b8a9a00565b3358b488d42e0
Arg [1] : 00000000000000000000000075736518075a01034fa72d675d36a47e9b06b2fb
Arg [2] : 000000000000000000000000000755fbe4a24d7478bfcfc1e561afce82d1ff62
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.