Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 25 from a total of 45 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Migrate | 2994094 | 31 days ago | IN | 0 ETH | 0.00013495 | ||||
Migrate | 2946951 | 38 days ago | IN | 0 ETH | 0.00000027 | ||||
Migrate | 2946285 | 38 days ago | IN | 0 ETH | 0.00034245 | ||||
Migrate | 2946168 | 38 days ago | IN | 0 ETH | 0.00000028 | ||||
Migrate | 2928534 | 41 days ago | IN | 0 ETH | 0.00012777 | ||||
Migrate | 2928520 | 41 days ago | IN | 0 ETH | 0.00013172 | ||||
Migrate | 2928497 | 41 days ago | IN | 0 ETH | 0.00015457 | ||||
Migrate | 2871146 | 50 days ago | IN | 0 ETH | 0.00001214 | ||||
Migrate | 2863234 | 51 days ago | IN | 0 ETH | 0.00001235 | ||||
Migrate | 2863229 | 51 days ago | IN | 0 ETH | 0.00001235 | ||||
Migrate | 2863223 | 51 days ago | IN | 0 ETH | 0.00001235 | ||||
Migrate | 2863198 | 51 days ago | IN | 0 ETH | 0.00001771 | ||||
Migrate | 2862860 | 51 days ago | IN | 0 ETH | 0.00001441 | ||||
Migrate | 2861453 | 51 days ago | IN | 0 ETH | 0.00001184 | ||||
Migrate | 2856359 | 52 days ago | IN | 0 ETH | 0.0000178 | ||||
Migrate | 2854272 | 52 days ago | IN | 0 ETH | 0.00001232 | ||||
Migrate | 2854240 | 52 days ago | IN | 0 ETH | 0.00001232 | ||||
Migrate | 2837926 | 55 days ago | IN | 0 ETH | 0.0000194 | ||||
Migrate | 2837917 | 55 days ago | IN | 0 ETH | 0.00002001 | ||||
Migrate | 2837227 | 55 days ago | IN | 0 ETH | 0.00001831 | ||||
Migrate | 2837187 | 55 days ago | IN | 0 ETH | 0.0000189 | ||||
Migrate | 2837122 | 55 days ago | IN | 0 ETH | 0.00001907 | ||||
Migrate | 2835704 | 55 days ago | IN | 0 ETH | 0.00001907 | ||||
Migrate | 2835671 | 55 days ago | IN | 0 ETH | 0.00001908 | ||||
Migrate | 2835640 | 55 days ago | IN | 0 ETH | 0.00002682 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
DefaultCollateralMigrator
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; import {IDefaultCollateralMigrator} from "../interfaces/IDefaultCollateralMigrator.sol"; import {IDefaultCollateral} from "../interfaces/defaultCollateral/IDefaultCollateral.sol"; import {IVault} from "@symbioticfi/core/src/interfaces/vault/IVault.sol"; import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract DefaultCollateralMigrator is IDefaultCollateralMigrator { using SafeERC20 for IERC20; /** * @inheritdoc IDefaultCollateralMigrator */ function migrate( address collateral, address vault, address onBehalfOf, uint256 amount ) external returns (uint256, uint256) { IERC20(collateral).transferFrom(msg.sender, address(this), amount); IDefaultCollateral(collateral).withdraw(address(this), amount); address asset = IDefaultCollateral(collateral).asset(); amount = IERC20(asset).balanceOf(address(this)); if (IERC20(asset).allowance(address(this), vault) < amount) { IERC20(asset).forceApprove(vault, type(uint256).max); } return IVault(vault).deposit(onBehalfOf, amount); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; interface IDefaultCollateralMigrator { /** * @notice Unwrap a particular default collateral and deposit its underlying asset to a given vault. * @param collateral address of the default collateral to unwrap * @param vault address of the vault to deposit the collateral's underlying asset * @param onBehalfOf address of the account to deposit the underlying asset on behalf of * @param amount amount of the default collateral to unwrap and deposit * @return amount of the asset deposited * @return amount of the active shares minted */ function migrate( address collateral, address vault, address onBehalfOf, uint256 amount ) external returns (uint256, uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IDefaultCollateral is IERC20 { /** * @notice Get the collateral's underlying asset. * @return asset address of the underlying asset */ function asset() external view returns (address); /** * @notice Get a maximum possible collateral total supply. * @return maximum collateral total supply */ function limit() external view returns (uint256); /** * @notice Get an address of the limit increaser. * @return address of the limit increaser */ function limitIncreaser() external view returns (address); /** * @notice Deposit a given amount of the underlying asset, and mint the collateral to a particular recipient. * @param recipient address of the collateral's recipient * @param amount amount of the underlying asset * @return amount of the collateral minted */ function deposit(address recipient, uint256 amount) external returns (uint256); /** * @notice Deposit a given amount of the underlying asset using a permit functionality, and mint the collateral to a particular recipient. * @param recipient address of the collateral's recipient * @param amount amount of the underlying asset * @param deadline timestamp of the signature's deadline * @param v v component of the signature * @param r r component of the signature * @param s s component of the signature * @return amount of the collateral minted */ function deposit( address recipient, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external returns (uint256); /** * @notice Withdraw a given amount of the underlying asset, and transfer it to a particular recipient. * @param recipient address of the underlying asset's recipient * @param amount amount of the underlying asset */ function withdraw(address recipient, uint256 amount) external; /** * @notice Increase a limit of maximum collateral total supply. * @param amount amount to increase the limit by * @dev Called only by limitIncreaser. */ function increaseLimit( uint256 amount ) external; /** * @notice Set a new limit increaser. * @param limitIncreaser address of the new limit increaser * @dev Called only by limitIncreaser. */ function setLimitIncreaser( address limitIncreaser ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IMigratableEntity} from "../common/IMigratableEntity.sol"; import {IVaultStorage} from "./IVaultStorage.sol"; interface IVault is IMigratableEntity, IVaultStorage { error AlreadyClaimed(); error AlreadySet(); error DepositLimitReached(); error InsufficientClaim(); error InsufficientDeposit(); error InsufficientRedemption(); error InsufficientWithdrawal(); error InvalidAccount(); error InvalidCaptureEpoch(); error InvalidClaimer(); error InvalidCollateral(); error InvalidEpoch(); error InvalidEpochDuration(); error InvalidLengthEpochs(); error InvalidOnBehalfOf(); error InvalidRecipient(); error MissingRoles(); error NoDepositLimit(); error NoDepositWhitelist(); error NotDelegator(); error NotSlasher(); error NotWhitelistedDepositor(); error TooMuchRedeem(); error TooMuchWithdraw(); /** * @notice Initial parameters needed for a vault deployment. * @param collateral vault's underlying collateral * @param delegator vault's delegator to delegate the stake to networks and operators * @param slasher vault's slasher to provide a slashing mechanism to networks * @param burner vault's burner to issue debt to (e.g., 0xdEaD or some unwrapper contract) * @param epochDuration duration of the vault epoch (it determines sync points for withdrawals) * @param depositWhitelist if enabling deposit whitelist * @param isDepositLimit if enabling deposit limit * @param depositLimit deposit limit (maximum amount of the collateral that can be in the vault simultaneously) * @param defaultAdminRoleHolder address of the initial DEFAULT_ADMIN_ROLE holder * @param depositWhitelistSetRoleHolder address of the initial DEPOSIT_WHITELIST_SET_ROLE holder * @param depositorWhitelistRoleHolder address of the initial DEPOSITOR_WHITELIST_ROLE holder * @param isDepositLimitSetRoleHolder address of the initial IS_DEPOSIT_LIMIT_SET_ROLE holder * @param depositLimitSetRoleHolder address of the initial DEPOSIT_LIMIT_SET_ROLE holder */ struct InitParams { address collateral; address delegator; address slasher; address burner; uint48 epochDuration; bool depositWhitelist; bool isDepositLimit; uint256 depositLimit; address defaultAdminRoleHolder; address depositWhitelistSetRoleHolder; address depositorWhitelistRoleHolder; address isDepositLimitSetRoleHolder; address depositLimitSetRoleHolder; } /** * @notice Hints for an active balance. * @param activeSharesOfHint hint for the active shares of checkpoint * @param activeStakeHint hint for the active stake checkpoint * @param activeSharesHint hint for the active shares checkpoint */ struct ActiveBalanceOfHints { bytes activeSharesOfHint; bytes activeStakeHint; bytes activeSharesHint; } /** * @notice Emitted when a deposit is made. * @param depositor account that made the deposit * @param onBehalfOf account the deposit was made on behalf of * @param amount amount of the collateral deposited * @param shares amount of the active shares minted */ event Deposit(address indexed depositor, address indexed onBehalfOf, uint256 amount, uint256 shares); /** * @notice Emitted when a withdrawal is made. * @param withdrawer account that made the withdrawal * @param claimer account that needs to claim the withdrawal * @param amount amount of the collateral withdrawn * @param burnedShares amount of the active shares burned * @param mintedShares amount of the epoch withdrawal shares minted */ event Withdraw( address indexed withdrawer, address indexed claimer, uint256 amount, uint256 burnedShares, uint256 mintedShares ); /** * @notice Emitted when a redemption is made. * @param redeemer account that redeemed * @param claimer account that needs to claim the withdrawal * @param shares amount of the active shares burned * @param withdrawnAssets amount of the collateral withdrawn * @param mintedShares amount of the epoch withdrawal shares minted */ event Redeem( address indexed redeemer, address indexed claimer, uint256 shares, uint256 withdrawnAssets, uint256 mintedShares ); /** * @notice Emitted when a claim is made. * @param claimer account that claimed * @param recipient account that received the collateral * @param epoch epoch the collateral was claimed for * @param amount amount of the collateral claimed */ event Claim(address indexed claimer, address indexed recipient, uint256 epoch, uint256 amount); /** * @notice Emitted when a batch claim is made. * @param claimer account that claimed * @param recipient account that received the collateral * @param epochs epochs the collateral was claimed for * @param amount amount of the collateral claimed */ event ClaimBatch(address indexed claimer, address indexed recipient, uint256[] epochs, uint256 amount); /** * @notice Emitted when a slash happened. * @param slasher address of the slasher * @param slashedAmount amount of the collateral slashed */ event OnSlash(address indexed slasher, uint256 slashedAmount); /** * @notice Emitted when a deposit whitelist status is enabled/disabled. * @param status if enabled deposit whitelist */ event SetDepositWhitelist(bool status); /** * @notice Emitted when a depositor whitelist status is set. * @param account account for which the whitelist status is set * @param status if whitelisted the account */ event SetDepositorWhitelistStatus(address indexed account, bool status); /** * @notice Emitted when a deposit limit status is enabled/disabled. * @param status if enabled deposit limit */ event SetIsDepositLimit(bool status); /** * @notice Emitted when a deposit limit is set. * @param limit deposit limit (maximum amount of the collateral that can be in the vault simultaneously) */ event SetDepositLimit(uint256 limit); /** * @notice Get a total amount of the collateral that can be slashed. * @return total amount of the slashable collateral */ function totalStake() external view returns (uint256); /** * @notice Get an active balance for a particular account at a given timestamp using hints. * @param account account to get the active balance for * @param timestamp time point to get the active balance for the account at * @param hints hints for checkpoints' indexes * @return active balance for the account at the timestamp */ function activeBalanceOfAt( address account, uint48 timestamp, bytes calldata hints ) external view returns (uint256); /** * @notice Get an active balance for a particular account. * @param account account to get the active balance for * @return active balance for the account */ function activeBalanceOf( address account ) external view returns (uint256); /** * @notice Get withdrawals for a particular account at a given epoch (zero if claimed). * @param epoch epoch to get the withdrawals for the account at * @param account account to get the withdrawals for * @return withdrawals for the account at the epoch */ function withdrawalsOf(uint256 epoch, address account) external view returns (uint256); /** * @notice Get a total amount of the collateral that can be slashed for a given account. * @return total amount of the slashable collateral */ function balanceOf( address account ) external view returns (uint256); /** * @notice Deposit collateral into the vault. * @param onBehalfOf account the deposit is made on behalf of * @param amount amount of the collateral to deposit * @return depositedAmount amount of the collateral deposited * @return mintedShares amount of the active shares minted */ function deposit( address onBehalfOf, uint256 amount ) external returns (uint256 depositedAmount, uint256 mintedShares); /** * @notice Withdraw collateral from the vault (it will be claimable after the next epoch). * @param claimer account that needs to claim the withdrawal * @param amount amount of the collateral to withdraw * @return burnedShares amount of the active shares burned * @return mintedShares amount of the epoch withdrawal shares minted */ function withdraw(address claimer, uint256 amount) external returns (uint256 burnedShares, uint256 mintedShares); /** * @notice Redeem collateral from the vault (it will be claimable after the next epoch). * @param claimer account that needs to claim the withdrawal * @param shares amount of the active shares to redeem * @return withdrawnAssets amount of the collateral withdrawn * @return mintedShares amount of the epoch withdrawal shares minted */ function redeem(address claimer, uint256 shares) external returns (uint256 withdrawnAssets, uint256 mintedShares); /** * @notice Claim collateral from the vault. * @param recipient account that receives the collateral * @param epoch epoch to claim the collateral for * @return amount amount of the collateral claimed */ function claim(address recipient, uint256 epoch) external returns (uint256 amount); /** * @notice Claim collateral from the vault for multiple epochs. * @param recipient account that receives the collateral * @param epochs epochs to claim the collateral for * @return amount amount of the collateral claimed */ function claimBatch(address recipient, uint256[] calldata epochs) external returns (uint256 amount); /** * @notice Slash callback for burning collateral. * @param slashedAmount amount to slash * @param captureTimestamp time point when the stake was captured * @dev Only the slasher can call this function. */ function onSlash(uint256 slashedAmount, uint48 captureTimestamp) external; /** * @notice Enable/disable deposit whitelist. * @param status if enabling deposit whitelist * @dev Only a DEPOSIT_WHITELIST_SET_ROLE holder can call this function. */ function setDepositWhitelist( bool status ) external; /** * @notice Set a depositor whitelist status. * @param account account for which the whitelist status is set * @param status if whitelisting the account * @dev Only a DEPOSITOR_WHITELIST_ROLE holder can call this function. */ function setDepositorWhitelistStatus(address account, bool status) external; /** * @notice Enable/disable deposit limit. * @param status if enabling deposit limit * @dev Only a IS_DEPOSIT_LIMIT_SET_ROLE holder can call this function. */ function setIsDepositLimit( bool status ) external; /** * @notice Set a deposit limit. * @param limit deposit limit (maximum amount of the collateral that can be in the vault simultaneously) * @dev Only a DEPOSIT_LIMIT_SET_ROLE holder can call this function. */ function setDepositLimit( uint256 limit ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../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 An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IMigratableEntity { error AlreadyInitialized(); error InvalidInitialVersion(); error NotFactory(); error NotInitialized(); /** * @notice Get the factory's address. * @return address of the factory */ function FACTORY() external view returns (address); /** * @notice Get the entity's version. * @return version of the entity * @dev Starts from 1. */ function version() external view returns (uint64); /** * @notice Get if the entity is initialized. * @return if the entity is initialized */ function isInitialized() external view returns (bool); /** * @notice Initialize this entity contract by using a given data and setting a particular version and owner. * @param initialVersion initial version of the entity * @param owner initial owner of the entity * @param data some data to use */ function initialize(uint64 initialVersion, address owner, bytes calldata data) external; /** * @notice Migrate this entity to a particular newer version using a given data. * @param newVersion new version of the entity * @param data some data to use */ function migrate(uint64 newVersion, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IVaultStorage { error InvalidTimestamp(); error NoPreviousEpoch(); /** * @notice Get a deposit whitelist enabler/disabler's role. * @return identifier of the whitelist enabler/disabler role */ function DEPOSIT_WHITELIST_SET_ROLE() external view returns (bytes32); /** * @notice Get a depositor whitelist status setter's role. * @return identifier of the depositor whitelist status setter role */ function DEPOSITOR_WHITELIST_ROLE() external view returns (bytes32); /** * @notice Get a deposit limit enabler/disabler's role. * @return identifier of the deposit limit enabler/disabler role */ function IS_DEPOSIT_LIMIT_SET_ROLE() external view returns (bytes32); /** * @notice Get a deposit limit setter's role. * @return identifier of the deposit limit setter role */ function DEPOSIT_LIMIT_SET_ROLE() external view returns (bytes32); /** * @notice Get the delegator factory's address. * @return address of the delegator factory */ function DELEGATOR_FACTORY() external view returns (address); /** * @notice Get the slasher factory's address. * @return address of the slasher factory */ function SLASHER_FACTORY() external view returns (address); /** * @notice Get a vault collateral. * @return address of the underlying collateral */ function collateral() external view returns (address); /** * @dev Get a burner to issue debt to (e.g., 0xdEaD or some unwrapper contract). * @return address of the burner */ function burner() external view returns (address); /** * @notice Get a delegator (it delegates the vault's stake to networks and operators). * @return address of the delegator */ function delegator() external view returns (address); /** * @notice Get a slasher (it provides networks a slashing mechanism). * @return address of the slasher */ function slasher() external view returns (address); /** * @notice Get a time point of the epoch duration set. * @return time point of the epoch duration set */ function epochDurationInit() external view returns (uint48); /** * @notice Get a duration of the vault epoch. * @return duration of the epoch */ function epochDuration() external view returns (uint48); /** * @notice Get an epoch at a given timestamp. * @param timestamp time point to get the epoch at * @return epoch at the timestamp * @dev Reverts if the timestamp is less than the start of the epoch 0. */ function epochAt( uint48 timestamp ) external view returns (uint256); /** * @notice Get a current vault epoch. * @return current epoch */ function currentEpoch() external view returns (uint256); /** * @notice Get a start of the current vault epoch. * @return start of the current epoch */ function currentEpochStart() external view returns (uint48); /** * @notice Get a start of the previous vault epoch. * @return start of the previous epoch * @dev Reverts if the current epoch is 0. */ function previousEpochStart() external view returns (uint48); /** * @notice Get a start of the next vault epoch. * @return start of the next epoch */ function nextEpochStart() external view returns (uint48); /** * @notice Get if the deposit whitelist is enabled. * @return if the deposit whitelist is enabled */ function depositWhitelist() external view returns (bool); /** * @notice Get if a given account is whitelisted as a depositor. * @param account address to check * @return if the account is whitelisted as a depositor */ function isDepositorWhitelisted( address account ) external view returns (bool); /** * @notice Get if the deposit limit is set. * @return if the deposit limit is set */ function isDepositLimit() external view returns (bool); /** * @notice Get a deposit limit (maximum amount of the collateral that can be in the vault simultaneously). * @return deposit limit */ function depositLimit() external view returns (uint256); /** * @notice Get a total number of active shares in the vault at a given timestamp using a hint. * @param timestamp time point to get the total number of active shares at * @param hint hint for the checkpoint index * @return total number of active shares at the timestamp */ function activeSharesAt(uint48 timestamp, bytes memory hint) external view returns (uint256); /** * @notice Get a total number of active shares in the vault. * @return total number of active shares */ function activeShares() external view returns (uint256); /** * @notice Get a total amount of active stake in the vault at a given timestamp using a hint. * @param timestamp time point to get the total active stake at * @param hint hint for the checkpoint index * @return total amount of active stake at the timestamp */ function activeStakeAt(uint48 timestamp, bytes memory hint) external view returns (uint256); /** * @notice Get a total amount of active stake in the vault. * @return total amount of active stake */ function activeStake() external view returns (uint256); /** * @notice Get a total number of active shares for a particular account at a given timestamp using a hint. * @param account account to get the number of active shares for * @param timestamp time point to get the number of active shares for the account at * @param hint hint for the checkpoint index * @return number of active shares for the account at the timestamp */ function activeSharesOfAt(address account, uint48 timestamp, bytes memory hint) external view returns (uint256); /** * @notice Get a number of active shares for a particular account. * @param account account to get the number of active shares for * @return number of active shares for the account */ function activeSharesOf( address account ) external view returns (uint256); /** * @notice Get a total amount of the withdrawals at a given epoch. * @param epoch epoch to get the total amount of the withdrawals at * @return total amount of the withdrawals at the epoch */ function withdrawals( uint256 epoch ) external view returns (uint256); /** * @notice Get a total number of withdrawal shares at a given epoch. * @param epoch epoch to get the total number of withdrawal shares at * @return total number of withdrawal shares at the epoch */ function withdrawalShares( uint256 epoch ) external view returns (uint256); /** * @notice Get a number of withdrawal shares for a particular account at a given epoch (zero if claimed). * @param epoch epoch to get the number of withdrawal shares for the account at * @param account account to get the number of withdrawal shares for * @return number of withdrawal shares for the account at the epoch */ function withdrawalSharesOf(uint256 epoch, address account) external view returns (uint256); /** * @notice Get if the withdrawals are claimed for a particular account at a given epoch. * @param epoch epoch to check the withdrawals for the account at * @param account account to check the withdrawals for * @return if the withdrawals are claimed for the account at the epoch */ function isWithdrawalsClaimed(uint256 epoch, address account) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@symbioticfi/core/src/contracts/=lib/core/src/contracts/", "@symbioticfi/core/src/interfaces/=lib/core/src/interfaces/", "@symbioticfi/core/test/mocks/=lib/core/test/mocks/", "@openzeppelin/contracts-upgradeable/=lib/core/lib/openzeppelin-contracts-upgradeable/contracts/", "core/=lib/core/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts-upgradeable/=lib/core/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"onBehalfOf","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"migrate","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60808060405234601557610609908161001b8239f35b600080fdfe608060409080825260048036101561001657600080fd5b600091823560e01c6334fcff0c1461002d57600080fd5b3461046a57608036600319011261046a576001600160a01b03823581811690819003610466576024908135918383168093036104625760449384359281841684036103ef576064356323b872dd60e01b8852338989015230848901528087890152878a81606460209b8c93875af180156104585761042b575b50813b15610427578a5163f3fef3a360e01b8152308a82019081526020810192909252908a9082908190604001038183865af1801561037d576103fa575b508688918b51928380926338d52e0f60e01b82525afa9081156103b65789916103c0575b50168851946370a0823160e01b8652308887015286868481855afa9586156103b6578996610387575b508951636eb1769f60e11b8152308982015283810186905287818381865afa90811561037d57918a93918c98979695938591610343575b508711610207575b505085516311f9fbc960e21b81526001600160a01b03909316978301978852506020870193909352948592839182906040015b03925af19182156101fd578380936101c2575b50508351928352820152f35b91925092508383813d83116101f6575b6101dc818361046e565b810103126101f357508082519201519038806101b6565b80fd5b503d6101d2565b84513d85823e3d90fd5b919394959690925051928784019063095ea7b360e01b92838352878287015260001981870152808652608086019267ffffffffffffffff938781108582111761032f57918d8f9b9a9998969492819896949082918e5288519082895af161026c6104be565b816102ff575b50806102f5575b15610287575b505050610170565b9193955091939597999a969851938b85015288828501528b8185015283526080830191838310908311176102e257506101a3989795938a936102d28d9997946102d7948b52826104fe565b6104fe565b96388080808061027f565b634e487b7160e01b600090815260418752fd5b50843b1515610279565b8051801592508e908315610317575b50505038610272565b61032793508201810191016104a6565b388d8161030e565b8360418e634e487b7160e01b600052526000fd5b94505096508783813d8311610376575b61035d818361046e565b81010312610371578a96868b945190610168565b600080fd5b503d610353565b8b513d8c823e3d90fd5b9095508681813d83116103af575b61039f818361046e565b8101031261037157519438610131565b503d610395565b8a513d8b823e3d90fd5b90508681813d83116103f3575b6103d7818361046e565b810103126103ef575181811681036103ef5738610108565b8880fd5b503d6103cd565b67ffffffffffffffff819a929a11610415578a5297866100e4565b634e487b7160e01b8252604189528382fd5b8980fd5b61044a90893d8b11610451575b610442818361046e565b8101906104a6565b50386100a6565b503d610438565b8c513d8d823e3d90fd5b8680fd5b8480fd5b8280fd5b90601f8019910116810190811067ffffffffffffffff82111761049057604052565b634e487b7160e01b600052604160045260246000fd5b90816020910312610371575180151581036103715790565b3d156104f9573d9067ffffffffffffffff821161049057604051916104ed601f8201601f19166020018461046e565b82523d6000602084013e565b606090565b6000806105279260018060a01b03169360208151910182865af16105206104be565b9083610570565b8051908115159182610555575b505061053d5750565b60249060405190635274afe760e01b82526004820152fd5b61056892506020809183010191016104a6565b153880610534565b90610597575080511561058557805190602001fd5b604051630a12f52160e11b8152600490fd5b815115806105ca575b6105a8575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156105a056fea264697066735822122042f298145118f94feda6b87b33234b82ce295fd3aaf7c608e4f9cc6156d6462264736f6c63430008190033
Deployed Bytecode
0x608060409080825260048036101561001657600080fd5b600091823560e01c6334fcff0c1461002d57600080fd5b3461046a57608036600319011261046a576001600160a01b03823581811690819003610466576024908135918383168093036104625760449384359281841684036103ef576064356323b872dd60e01b8852338989015230848901528087890152878a81606460209b8c93875af180156104585761042b575b50813b15610427578a5163f3fef3a360e01b8152308a82019081526020810192909252908a9082908190604001038183865af1801561037d576103fa575b508688918b51928380926338d52e0f60e01b82525afa9081156103b65789916103c0575b50168851946370a0823160e01b8652308887015286868481855afa9586156103b6578996610387575b508951636eb1769f60e11b8152308982015283810186905287818381865afa90811561037d57918a93918c98979695938591610343575b508711610207575b505085516311f9fbc960e21b81526001600160a01b03909316978301978852506020870193909352948592839182906040015b03925af19182156101fd578380936101c2575b50508351928352820152f35b91925092508383813d83116101f6575b6101dc818361046e565b810103126101f357508082519201519038806101b6565b80fd5b503d6101d2565b84513d85823e3d90fd5b919394959690925051928784019063095ea7b360e01b92838352878287015260001981870152808652608086019267ffffffffffffffff938781108582111761032f57918d8f9b9a9998969492819896949082918e5288519082895af161026c6104be565b816102ff575b50806102f5575b15610287575b505050610170565b9193955091939597999a969851938b85015288828501528b8185015283526080830191838310908311176102e257506101a3989795938a936102d28d9997946102d7948b52826104fe565b6104fe565b96388080808061027f565b634e487b7160e01b600090815260418752fd5b50843b1515610279565b8051801592508e908315610317575b50505038610272565b61032793508201810191016104a6565b388d8161030e565b8360418e634e487b7160e01b600052526000fd5b94505096508783813d8311610376575b61035d818361046e565b81010312610371578a96868b945190610168565b600080fd5b503d610353565b8b513d8c823e3d90fd5b9095508681813d83116103af575b61039f818361046e565b8101031261037157519438610131565b503d610395565b8a513d8b823e3d90fd5b90508681813d83116103f3575b6103d7818361046e565b810103126103ef575181811681036103ef5738610108565b8880fd5b503d6103cd565b67ffffffffffffffff819a929a11610415578a5297866100e4565b634e487b7160e01b8252604189528382fd5b8980fd5b61044a90893d8b11610451575b610442818361046e565b8101906104a6565b50386100a6565b503d610438565b8c513d8d823e3d90fd5b8680fd5b8480fd5b8280fd5b90601f8019910116810190811067ffffffffffffffff82111761049057604052565b634e487b7160e01b600052604160045260246000fd5b90816020910312610371575180151581036103715790565b3d156104f9573d9067ffffffffffffffff821161049057604051916104ed601f8201601f19166020018461046e565b82523d6000602084013e565b606090565b6000806105279260018060a01b03169360208151910182865af16105206104be565b9083610570565b8051908115159182610555575b505061053d5750565b60249060405190635274afe760e01b82526004820152fd5b61056892506020809183010191016104a6565b153880610534565b90610597575080511561058557805190602001fd5b604051630a12f52160e11b8152600490fd5b815115806105ca575b6105a8575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156105a056fea264697066735822122042f298145118f94feda6b87b33234b82ce295fd3aaf7c608e4f9cc6156d6462264736f6c63430008190033
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.