Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Initialize | 2684143 | 224 days ago | IN | 0 ETH | 0.00015345 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x5b3C0725...5173BEbD0 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
VariableRate
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 2000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {ReentrancyGuard} from "../lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol"; import {IERC20} from "../lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol"; import {SafeERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import {IVault} from "./interfaces/IVault.sol"; import {ICoreRef} from "./core/ICoreRef.sol"; contract VariableRate is ReentrancyGuard { using SafeERC20 for IERC20; /* Immutables */ // solhint-disable var-name-mixedcase address public TOKEN; address public VAULT; address public OWNER; /* Variables */ bool public initialized; uint256 public principal; function initialize(address token, address vault, address owner) external nonReentrant { require(!initialized, "VariableRate: already initialized"); initialized = true; TOKEN = token; VAULT = vault; OWNER = owner; } function mint(uint256 amount) external nonReentrant onlyVault { require(IERC20(TOKEN).balanceOf(address(this)) >= principal + amount, "VariableRate: insufficient fund"); principal += amount; } function burn( uint256 amount, uint256 minYield ) external nonReentrant onlyOwner returns (uint256 yield, uint256 fee) { require(amount <= principal, "VariableRate: overspend"); (yield, fee) = IVault(VAULT).burnVariableRate(amount, minYield); require(IERC20(TOKEN).balanceOf(address(this)) >= principal + yield + fee, "VariableRate: insufficient fund"); principal -= amount; IERC20(TOKEN).safeTransfer(OWNER, amount + yield + fee); } function withdraw(uint256 amount) external nonReentrant onlyOwner onlyEmergency { require(amount <= principal, "VariableRate: overspend"); principal -= amount; IERC20(TOKEN).safeTransfer(OWNER, amount); } modifier onlyOwner() { require(msg.sender == OWNER, "VariableRate: not owner"); _; } modifier onlyVault() { require(msg.sender == VAULT, "VariableRate: not vault"); _; } modifier onlyEmergency() { require(ICoreRef(VAULT).emergency(), "VariableRate: not emergency"); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. 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.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; interface IVault { /*============================================================== Event Logs ==============================================================*/ event MintFixedRate(address indexed owner, uint256 id, uint256 mintAmount, uint256 lockedAmount); event BurnFixedRate(address indexed owner, uint256 id, uint256 burnAmount, uint256 yield); event MintVariableRate(address indexed owner, uint256 mintAmount); event BurnVariableRate(address indexed owner, uint256 burnAmount, uint256 yield, uint256 positionFee); event EstimateYield(uint256 currentRate, bool updated); event UpdateYieldManager(address indexed newYieldManager); event UpdateYieldEstimateWindow(uint256 window); event UpdateCurve(uint256 s1, uint256 s2, uint256 s3, uint256 r1, uint256 r2); event UpdatePositionFeeRate(uint256 fee); /*============================================================== Fixed rate LP deposit ==============================================================*/ /** * @notice Deposit a principal amount to lock a fixed yield rate until maturity * @param amount the deposit amount * @param minLockedYield the minimum amount to lock, for slippage protection * @param recipient the address to receive the fixedRate contract * @return owner the address to the fixedRate contract * @return lockedYield the amount locked, which over time releases the yield at fixed rate * @return maturityTimestamp the maturity timestamp */ function mintFixedRate( uint256 amount, uint256 minLockedYield, address recipient ) external returns (address owner, uint256 lockedYield, uint256 maturityTimestamp); /*============================================================== Fixed rate LP withdraw ==============================================================*/ /** * @notice Withdraw a principal amount from a fixed yield rate deposit * @param id the deposit id * @param amount the amount of principal to withdraw * @return yieldToUnlock the yield to unlock from the locked amount * @return yieldToRelease the yield to release to the owner */ function burnFixedRate(uint256 id, uint256 amount) external returns (uint256 yieldToUnlock, uint256 yieldToRelease); /*============================================================== Variable rate LP deposit ==============================================================*/ /** * @notice Deposit a principal amount for variable yield rate * @param amount the deposit amount * @param recipient the address to receive the variableRate contract * @return owner the address to the variableRate contract */ function mintVariableRate(uint256 amount, address recipient) external returns (address owner); /*============================================================== Variable rate LP withdraw ==============================================================*/ /** * @notice Withdraw a principal amount from a variable yield rate deposit * @param amount the amount of principal to withdraw * @param minYield the minimum yield to receive, for slippage protection * @return yield the yield amount * @return fee the position fee */ function burnVariableRate(uint256 amount, uint256 minYield) external returns (uint256 yield, uint256 fee); /*============================================================== Helper Functions ==============================================================*/ /** * @notice get the amount to lock based on the current fixed term rate and the deposit amount * @param amount the deposit amount * @return yieldToLock the amount to lock */ function getYieldToLock(uint256 amount) external view returns (uint256 yieldToLock); /** * @notice get the maximum amount of principal for a fixed term rate * @return amount the maximum amount of principal */ function getMaxFixedRateAmount() external view returns (uint256 amount); /** * @notice get the current fixed term rate from idle yield / total yield * @param amount the deposit amount * @return rate the current fixed term rate */ function getFixedRate(uint256 amount) external view returns (uint256 rate); /** * @notice get the total yield from the protocol * @return totalYield the total yield */ function getTotalYield() external view returns (uint256 totalYield); /** * @notice get the current yield and position fee accrued to a variable rate LP * @param owner the address of the LP * @return yield the current yield * @return fee the current position fee */ function getCurrentVariableRate(address owner) external view returns (uint256 yield, uint256 fee); /*============================================================== Admin Logic ==============================================================*/ /** * @notice Update the yield manager * @param newYieldManager the new yield manager */ function updateYieldManager(address newYieldManager) external; /** * @notice Update the fixed term rate curve * @param s1 the slope of chunk 1 * @param s2 the slope of chunk 2 * @param s3 the slope of chunk 3 * @param r1 the ratio cutoff between chunk 1 and 2 * @param r2 the ratio cutoff between chunk 2 and 3 */ function updateCurve(uint256 s1, uint256 s2, uint256 s3, uint256 r1, uint256 r2) external; /** * @notice Update the position fee * @param fee the new position fee */ function updatePositionFeeRate(uint256 fee) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {ICore} from "../core/ICore.sol"; /// @title CoreRef interface interface ICoreRef { event CoreUpdate(address indexed _core); event EmergencyUpdate(bool _emergency); event MinterUpdate(address indexed _minter, bool _status); event BurnerUpdate(address indexed _burner, bool _status); function emergency() external view returns (bool); function startEmergency() external; function stopEmergency() external; function setCore(address coreAddress) external; function core() external view returns (ICore); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {IPermissions} from "./IPermissions.sol"; /// @title Core Interface interface ICore is IPermissions { function init() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /// @title Permissions interface interface IPermissions { // ----------- Governor only state changing api ----------- function createRole(bytes32 role, bytes32 adminRole) external; function grantGovernor(address governor) external; function grantGuardian(address guardian) external; function grantMinter(address minter) external; function grantBurner(address burner) external; function revokeGovernor(address governor) external; function revokeGuardian(address guardian) external; function revokeMinter(address minter) external; function revokeBurner(address burner) external; // ----------- Revoker only state changing api ----------- function revokeOverride(bytes32 role, address account) external; // ----------- Getters ----------- function isGovernor(address _address) external view returns (bool); function isGuardian(address _address) external view returns (bool); function isMinter(address _address) external view returns (bool); function isBurner(address _address) external view returns (bool); }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 2000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"OWNER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minYield","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"yield","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"principal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a35760003560e01c806382bfefc811610076578063b390c0ab1161005b578063b390c0ab1461015b578063ba5d307814610183578063c0c53b8b1461019a57600080fd5b806382bfefc814610135578063a0712d681461014857600080fd5b8063117803e3146100a8578063158ef93e146100d85780632e1a7d4d1461010d578063411557d114610122575b600080fd5b6003546100bb906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6003546100fd9074010000000000000000000000000000000000000000900460ff1681565b60405190151581526020016100cf565b61012061011b366004610be6565b6101ad565b005b6002546100bb906001600160a01b031681565b6001546100bb906001600160a01b031681565b610120610156366004610be6565b61036a565b61016e610169366004610bff565b6104cc565b604080519283526020830191909152016100cf565b61018c60045481565b6040519081526020016100cf565b6101206101a8366004610c3d565b610763565b6101b5610895565b6003546001600160a01b031633146102145760405162461bcd60e51b815260206004820152601760248201527f5661726961626c65526174653a206e6f74206f776e657200000000000000000060448201526064015b60405180910390fd5b600260009054906101000a90046001600160a01b03166001600160a01b031663caa6fea46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028b9190610c80565b6102d75760405162461bcd60e51b815260206004820152601b60248201527f5661726961626c65526174653a206e6f7420656d657267656e63790000000000604482015260640161020b565b6004548111156103295760405162461bcd60e51b815260206004820152601760248201527f5661726961626c65526174653a206f7665727370656e64000000000000000000604482015260640161020b565b806004600082825461033b9190610cd8565b909155505060035460015461035d916001600160a01b039182169116836108ee565b6103676001600055565b50565b610372610895565b6002546001600160a01b031633146103cc5760405162461bcd60e51b815260206004820152601760248201527f5661726961626c65526174653a206e6f74207661756c74000000000000000000604482015260640161020b565b806004546103da9190610cf1565b6001546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561043b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045f9190610d04565b10156104ad5760405162461bcd60e51b815260206004820152601f60248201527f5661726961626c65526174653a20696e73756666696369656e742066756e6400604482015260640161020b565b80600460008282546104bf9190610cf1565b9091555050600160005550565b6000806104d7610895565b6003546001600160a01b031633146105315760405162461bcd60e51b815260206004820152601760248201527f5661726961626c65526174653a206e6f74206f776e6572000000000000000000604482015260640161020b565b6004548411156105835760405162461bcd60e51b815260206004820152601760248201527f5661726961626c65526174653a206f7665727370656e64000000000000000000604482015260640161020b565b6002546040517f9c3750c700000000000000000000000000000000000000000000000000000000815260048101869052602481018590526001600160a01b0390911690639c3750c79060440160408051808303816000875af11580156105ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106119190610d1d565b60045491935091508190610626908490610cf1565b6106309190610cf1565b6001546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610691573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b59190610d04565b10156107035760405162461bcd60e51b815260206004820152601f60248201527f5661726961626c65526174653a20696e73756666696369656e742066756e6400604482015260640161020b565b83600460008282546107159190610cd8565b9091555050600354610752906001600160a01b0316826107358588610cf1565b61073f9190610cf1565b6001546001600160a01b031691906108ee565b61075c6001600055565b9250929050565b61076b610895565b60035474010000000000000000000000000000000000000000900460ff16156107fc5760405162461bcd60e51b815260206004820152602160248201527f5661726961626c65526174653a20616c726561647920696e697469616c697a6560448201527f6400000000000000000000000000000000000000000000000000000000000000606482015260840161020b565b60038054600180546001600160a01b038088167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560028054878416921691909117905583167fffffffffffffffffffffff00000000000000000000000000000000000000000090911617740100000000000000000000000000000000000000001790556108906001600055565b505050565b6002600054036108e75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161020b565b6002600055565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610890928692916000916109ac918516908490610a3f565b90508051600014806109cd5750808060200190518101906109cd9190610c80565b6108905760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161020b565b6060610a4e8484600085610a56565b949350505050565b606082471015610ace5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161020b565b600080866001600160a01b03168587604051610aea9190610d65565b60006040518083038185875af1925050503d8060008114610b27576040519150601f19603f3d011682016040523d82523d6000602084013e610b2c565b606091505b5091509150610b3d87838387610b48565b979650505050505050565b60608315610bb7578251600003610bb0576001600160a01b0385163b610bb05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161020b565b5081610a4e565b610a4e8383815115610bcc5781518083602001fd5b8060405162461bcd60e51b815260040161020b9190610d81565b600060208284031215610bf857600080fd5b5035919050565b60008060408385031215610c1257600080fd5b50508035926020909101359150565b80356001600160a01b0381168114610c3857600080fd5b919050565b600080600060608486031215610c5257600080fd5b610c5b84610c21565b9250610c6960208501610c21565b9150610c7760408501610c21565b90509250925092565b600060208284031215610c9257600080fd5b81518015158114610ca257600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610ceb57610ceb610ca9565b92915050565b80820180821115610ceb57610ceb610ca9565b600060208284031215610d1657600080fd5b5051919050565b60008060408385031215610d3057600080fd5b505080516020909101519092909150565b60005b83811015610d5c578181015183820152602001610d44565b50506000910152565b60008251610d77818460208701610d41565b9190910192915050565b6020815260008251806020840152610da0816040850160208701610d41565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220000b6a2ec482fa13126bdfd30476485d2881529deded956bc7040c3ea38417d864736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.