Source Code
Overview
S Balance
S Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 7986591 | 344 days ago | Contract Creation | 0 S |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Collector
Compiler Version
v0.8.22+commit.4fc1097e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {AccessControlUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol';
import {ReentrancyGuardUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {Address} from 'openzeppelin-contracts/contracts/utils/Address.sol';
import {ICollector} from './ICollector.sol';
/**
* @title Collector
* @notice Stores ERC20 tokens of an ecosystem reserve and allows to dispose of them via approval
* or transfer dynamics or streaming capabilities.
* Modification of Sablier https://github.com/sablierhq/sablier/blob/develop/packages/protocol/contracts/Sablier.sol
* Original can be found also deployed on https://etherscan.io/address/0xCD18eAa163733Da39c232722cBC4E8940b1D8888
* Modifications:
* - Sablier "pulls" the funds from the creator of the stream at creation. In the Aave case, we already have the funds.
* - Anybody can create streams on Sablier. Here, only the funds admin (Aave governance via controller) can
* - Adapted codebase to Solidity 0.8.11, mainly removing SafeMath and CarefulMath to use native safe math
* - Same as with creation, on Sablier the `sender` and `recipient` can cancel a stream. Here, only fund admin and recipient
* @author BGD Labs
**/
contract Collector is AccessControlUpgradeable, ReentrancyGuardUpgradeable, ICollector {
using SafeERC20 for IERC20;
using Address for address payable;
/*** Storage Properties ***/
/// @inheritdoc ICollector
address public constant ETH_MOCK_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/// @inheritdoc ICollector
bytes32 public constant FUNDS_ADMIN_ROLE = 'FUNDS_ADMIN';
// Reserved storage space to account for deprecated inherited storage
// 0 was lastInitializedRevision
// 1-50 were the ____gap
// 51 was the reentrancy guard _status
// 52 was the _fundsAdmin
// On some networks the layout was shifted by 1 due to `initializing` being on slot 1
// The upgrade proposal would in this case manually shift the storage layout to properly align the networks
uint256[53] private ______gap;
/**
* @notice Counter for new stream ids.
*/
uint256 private _nextStreamId;
/**
* @notice The stream objects identifiable by their unsigned integer ids.
*/
mapping(uint256 => Stream) private _streams;
/*** Modifiers ***/
/**
* @dev Throws if the caller does not have the FUNDS_ADMIN role
*/
modifier onlyFundsAdmin() {
if (_onlyFundsAdmin() == false) {
revert OnlyFundsAdmin();
}
_;
}
/**
* @dev Throws if the caller is not the funds admin of the recipient of the stream.
* @param streamId The id of the stream to query.
*/
modifier onlyAdminOrRecipient(uint256 streamId) {
if (_onlyFundsAdmin() == false && msg.sender != _streams[streamId].recipient) {
revert OnlyFundsAdminOrRecipient();
}
_;
}
/**
* @dev Throws if the provided id does not point to a valid stream.
*/
modifier streamExists(uint256 streamId) {
if (!_streams[streamId].isEntity) revert StreamDoesNotExist();
_;
}
constructor() {
_disableInitializers();
}
/*** Contract Logic Starts Here */
/** @notice Initializes the contracts
* @param nextStreamId StreamId to set, applied if greater than 0
* @param admin The default admin managing the FundsAdmins
**/
function initialize(uint256 nextStreamId, address admin) external virtual initializer {
__AccessControl_init();
__ReentrancyGuard_init();
_grantRole(DEFAULT_ADMIN_ROLE, admin);
_grantRole(FUNDS_ADMIN_ROLE, admin);
if (nextStreamId != 0) {
_nextStreamId = nextStreamId;
}
}
/*** View Functions ***/
/// @inheritdoc ICollector
function isFundsAdmin(address admin) external view returns (bool) {
return hasRole(FUNDS_ADMIN_ROLE, admin);
}
/// @inheritdoc ICollector
function getNextStreamId() external view returns (uint256) {
return _nextStreamId;
}
/// @inheritdoc ICollector
function getStream(
uint256 streamId
)
external
view
streamExists(streamId)
returns (
address sender,
address recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime,
uint256 remainingBalance,
uint256 ratePerSecond
)
{
sender = _streams[streamId].sender;
recipient = _streams[streamId].recipient;
deposit = _streams[streamId].deposit;
tokenAddress = _streams[streamId].tokenAddress;
startTime = _streams[streamId].startTime;
stopTime = _streams[streamId].stopTime;
remainingBalance = _streams[streamId].remainingBalance;
ratePerSecond = _streams[streamId].ratePerSecond;
}
/**
* @notice Returns either the delta in seconds between `block.timestamp` and `startTime` or
* between `stopTime` and `startTime, whichever is smaller. If `block.timestamp` is before
* `startTime`, it returns 0.
* @dev Throws if the id does not point to a valid stream.
* @param streamId The id of the stream for which to query the delta.
* @notice Returns the time delta in seconds.
*/
function deltaOf(uint256 streamId) public view streamExists(streamId) returns (uint256 delta) {
Stream memory stream = _streams[streamId];
if (block.timestamp <= stream.startTime) return 0;
if (block.timestamp < stream.stopTime) return block.timestamp - stream.startTime;
return stream.stopTime - stream.startTime;
}
struct BalanceOfLocalVars {
uint256 recipientBalance;
uint256 withdrawalAmount;
uint256 senderBalance;
}
/// @inheritdoc ICollector
function balanceOf(
uint256 streamId,
address who
) public view streamExists(streamId) returns (uint256 balance) {
Stream memory stream = _streams[streamId];
BalanceOfLocalVars memory vars;
uint256 delta = deltaOf(streamId);
vars.recipientBalance = delta * stream.ratePerSecond;
/*
* If the stream `balance` does not equal `deposit`, it means there have been withdrawals.
* We have to subtract the total amount withdrawn from the amount of money that has been
* streamed until now.
*/
if (stream.deposit > stream.remainingBalance) {
vars.withdrawalAmount = stream.deposit - stream.remainingBalance;
vars.recipientBalance = vars.recipientBalance - vars.withdrawalAmount;
}
if (who == stream.recipient) return vars.recipientBalance;
if (who == stream.sender) {
vars.senderBalance = stream.remainingBalance - vars.recipientBalance;
return vars.senderBalance;
}
return 0;
}
/*** Public Effects & Interactions Functions ***/
/// @inheritdoc ICollector
function approve(IERC20 token, address recipient, uint256 amount) external onlyFundsAdmin {
token.forceApprove(recipient, amount);
}
/// @inheritdoc ICollector
function transfer(IERC20 token, address recipient, uint256 amount) external onlyFundsAdmin {
if (recipient == address(0)) revert InvalidZeroAddress();
if (address(token) == ETH_MOCK_ADDRESS) {
payable(recipient).sendValue(amount);
} else {
token.safeTransfer(recipient, amount);
}
}
function _onlyFundsAdmin() internal view returns (bool) {
return hasRole(FUNDS_ADMIN_ROLE, msg.sender);
}
struct CreateStreamLocalVars {
uint256 duration;
uint256 ratePerSecond;
}
/// @inheritdoc ICollector
/**
* @dev Throws if the recipient is the zero address, the contract itself or the caller.
* Throws if the deposit is 0.
* Throws if the start time is before `block.timestamp`.
* Throws if the stop time is before the start time.
* Throws if the duration calculation has a math error.
* Throws if the deposit is smaller than the duration.
* Throws if the deposit is not a multiple of the duration.
* Throws if the rate calculation has a math error.
* Throws if the next stream id calculation has a math error.
* Throws if the contract is not allowed to transfer enough tokens.
* Throws if there is a token transfer failure.
*/
function createStream(
address recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime
) external onlyFundsAdmin returns (uint256) {
if (recipient == address(0)) revert InvalidZeroAddress();
if (recipient == address(this)) revert InvalidRecipient();
if (recipient == msg.sender) revert InvalidRecipient();
if (deposit == 0) revert InvalidZeroAmount();
if (startTime < block.timestamp) revert InvalidStartTime();
if (stopTime <= startTime) revert InvalidStopTime();
CreateStreamLocalVars memory vars;
vars.duration = stopTime - startTime;
/* Without this, the rate per second would be zero. */
if (deposit < vars.duration) revert DepositSmallerTimeDelta();
/* This condition avoids dealing with remainders */
if (deposit % vars.duration > 0) revert DepositNotMultipleTimeDelta();
vars.ratePerSecond = deposit / vars.duration;
/* Create and store the stream object. */
uint256 streamId = _nextStreamId;
_streams[streamId] = Stream({
remainingBalance: deposit,
deposit: deposit,
isEntity: true,
ratePerSecond: vars.ratePerSecond,
recipient: recipient,
sender: address(this),
startTime: startTime,
stopTime: stopTime,
tokenAddress: tokenAddress
});
/* Increment the next stream id. */
_nextStreamId++;
emit CreateStream(
streamId,
address(this),
recipient,
deposit,
tokenAddress,
startTime,
stopTime
);
return streamId;
}
/// @inheritdoc ICollector
/**
* @dev Throws if the id does not point to a valid stream.
* Throws if the caller is not the funds admin or the recipient of the stream.
* Throws if the amount exceeds the available balance.
* Throws if there is a token transfer failure.
*/
function withdrawFromStream(
uint256 streamId,
uint256 amount
) external nonReentrant streamExists(streamId) onlyAdminOrRecipient(streamId) returns (bool) {
if (amount == 0) revert InvalidZeroAmount();
Stream memory stream = _streams[streamId];
uint256 balance = balanceOf(streamId, stream.recipient);
if (balance < amount) revert BalanceExceeded();
_streams[streamId].remainingBalance = stream.remainingBalance - amount;
if (_streams[streamId].remainingBalance == 0) delete _streams[streamId];
IERC20(stream.tokenAddress).safeTransfer(stream.recipient, amount);
emit WithdrawFromStream(streamId, stream.recipient, amount);
return true;
}
/// @inheritdoc ICollector
/**
* @dev Throws if the id does not point to a valid stream.
* Throws if the caller is not the funds admin or the recipient of the stream.
* Throws if there is a token transfer failure.
*/
function cancelStream(
uint256 streamId
) external nonReentrant streamExists(streamId) onlyAdminOrRecipient(streamId) returns (bool) {
Stream memory stream = _streams[streamId];
uint256 senderBalance = balanceOf(streamId, stream.sender);
uint256 recipientBalance = balanceOf(streamId, stream.recipient);
delete _streams[streamId];
IERC20 token = IERC20(stream.tokenAddress);
if (recipientBalance > 0) token.safeTransfer(stream.recipient, recipientBalance);
emit CancelStream(streamId, stream.sender, stream.recipient, senderBalance, recipientBalance);
return true;
}
/// @dev needed in order to receive ETH from the Aave v1 ecosystem reserve
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
struct AccessControlStorage {
mapping(bytes32 role => RoleData) _roles;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;
function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
assembly {
$.slot := AccessControlStorageLocation
}
}
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
AccessControlStorage storage $ = _getAccessControlStorage();
bytes32 previousAdminRole = getRoleAdmin(role);
$._roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (!hasRole(role, account)) {
$._roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (hasRole(role, account)) {
$._roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* 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 ReentrancyGuardUpgradeable is Initializable {
// 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;
/// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
struct ReentrancyGuardStorage {
uint256 _status;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
assembly {
$.slot := ReentrancyGuardStorageLocation
}
}
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
$._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 {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// On the first call to nonReentrant, _status will be NOT_ENTERED
if ($._status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
$._status = ENTERED;
}
function _nonReentrantAfter() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// 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) {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
return $._status == ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165Upgradeable is Initializable, IERC165 {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC-165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
* Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 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 {
/**
* @dev An operation with an ERC-20 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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
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.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
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 silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @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 Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert Errors.FailedCall();
}
}
/**
* @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
* {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value);
}
(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 {Errors.FailedCall}) 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 {Errors.FailedCall} 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 {Errors.FailedCall}.
*/
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
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
interface ICollector {
struct Stream {
uint256 deposit;
uint256 ratePerSecond;
uint256 remainingBalance;
uint256 startTime;
uint256 stopTime;
address recipient;
address sender;
address tokenAddress;
bool isEntity;
}
/**
* @dev Withdraw amount exceeds available balance
*/
error BalanceExceeded();
/**
* @dev Deposit smaller than time delta
*/
error DepositSmallerTimeDelta();
/**
* @dev Deposit not multiple of time delta
*/
error DepositNotMultipleTimeDelta();
/**
* @dev Recipient cannot be the contract itself or msg.sender
*/
error InvalidRecipient();
/**
* @dev Start time cannot be before block.timestamp
*/
error InvalidStartTime();
/**
* @dev Stop time must be greater than startTime
*/
error InvalidStopTime();
/**
* @dev Provided address cannot be the zero-address
*/
error InvalidZeroAddress();
/**
* @dev Amount cannot be zero
*/
error InvalidZeroAmount();
/**
* @dev Only caller with FUNDS_ADMIN role can call
*/
error OnlyFundsAdmin();
/**
* @dev Only caller with FUNDS_ADMIN role or stream recipient can call
*/
error OnlyFundsAdminOrRecipient();
/**
* @dev The provided ID does not belong to an existing stream
*/
error StreamDoesNotExist();
/** @notice Emitted when the new stream is created
* @param streamId The identifier of the stream.
* @param sender The address of the collector.
* @param recipient The address towards which the money is streamed.
* @param deposit The amount of money to be streamed.
* @param tokenAddress The ERC20 token to use as streaming currency.
* @param startTime The unix timestamp for when the stream starts.
* @param stopTime The unix timestamp for when the stream stops.
**/
event CreateStream(
uint256 indexed streamId,
address indexed sender,
address indexed recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime
);
/**
* @notice Emmitted when withdraw happens from the contract to the recipient's account.
* @param streamId The id of the stream to withdraw tokens from.
* @param recipient The address towards which the money is streamed.
* @param amount The amount of tokens to withdraw.
*/
event WithdrawFromStream(uint256 indexed streamId, address indexed recipient, uint256 amount);
/**
* @notice Emmitted when the stream is canceled.
* @param streamId The id of the stream to withdraw tokens from.
* @param sender The address of the collector.
* @param recipient The address towards which the money is streamed.
* @param senderBalance The sender's balance at the moment of cancelling.
* @param recipientBalance The recipient's balance at the moment of cancelling.
*/
event CancelStream(
uint256 indexed streamId,
address indexed sender,
address indexed recipient,
uint256 senderBalance,
uint256 recipientBalance
);
/**
* @notice FUNDS_ADMIN role granted by ACL Manager
**/
function FUNDS_ADMIN_ROLE() external view returns (bytes32);
/** @notice Returns the mock ETH reference address
* @return address The address
**/
function ETH_MOCK_ADDRESS() external pure returns (address);
/**
* @notice Checks if address is funds admin
* @return bool If the address has the funds admin role
**/
function isFundsAdmin(address admin) external view returns (bool);
/**
* @notice Returns the available funds for the given stream id and address.
* @param streamId The id of the stream for which to query the balance.
* @param who The address for which to query the balance.
* @notice Returns the total funds allocated to `who` as uint256.
**/
function balanceOf(uint256 streamId, address who) external view returns (uint256 balance);
/**
* @dev Function for the funds admin to give ERC20 allowance to other parties
* @param token The address of the token to give allowance from
* @param recipient Allowance's recipient
* @param amount Allowance to approve
**/
function approve(IERC20 token, address recipient, uint256 amount) external;
/**
* @notice Function for the funds admin to transfer ERC20 tokens to other parties
* @param token The address of the token to transfer
* @param recipient Transfer's recipient
* @param amount Amount to transfer
**/
function transfer(IERC20 token, address recipient, uint256 amount) external;
/**
* @notice Creates a new stream funded by this contracts itself and paid towards `recipient`.
* @param recipient The address towards which the money is streamed.
* @param deposit The amount of money to be streamed.
* @param tokenAddress The ERC20 token to use as streaming currency.
* @param startTime The unix timestamp for when the stream starts.
* @param stopTime The unix timestamp for when the stream stops.
* @return streamId the uint256 id of the newly created stream.
*/
function createStream(
address recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime
) external returns (uint256 streamId);
/**
* @notice Returns the stream with all its properties.
* @dev Throws if the id does not point to a valid stream.
* @param streamId The id of the stream to query.
* @notice Returns the stream object.
*/
function getStream(
uint256 streamId
)
external
view
returns (
address sender,
address recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime,
uint256 remainingBalance,
uint256 ratePerSecond
);
/**
* @notice Withdraws from the contract to the recipient's account.
* @param streamId The id of the stream to withdraw tokens from.
* @param amount The amount of tokens to withdraw.
* @return bool Returns true if successful.
*/
function withdrawFromStream(uint256 streamId, uint256 amount) external returns (bool);
/**
* @notice Cancels the stream and transfers the tokens back on a pro rata basis.
* @param streamId The id of the stream to cancel.
* @return bool Returns true if successful.
*/
function cancelStream(uint256 streamId) external returns (bool);
/**
* @notice Returns the next available stream id
* @return nextStreamId Returns the stream id.
*/
function getNextStreamId() external view returns (uint256);
}{
"remappings": [
"solidity-utils/=lib/solidity-utils/src/",
"forge-std/=lib/forge-std/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"openzeppelin-contracts-upgradeable/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
"@openzeppelin/contracts-upgradeable/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "shanghai",
"viaIR": false,
"libraries": {
"src/contracts/protocol/libraries/logic/BorrowLogic.sol": {
"BorrowLogic": "0x62325c94E1c49dcDb5937726aB5D8A4c37bCAd36"
},
"src/contracts/protocol/libraries/logic/BridgeLogic.sol": {
"BridgeLogic": "0x621Ef86D8A5C693a06295BC288B95C12D4CE4994"
},
"src/contracts/protocol/libraries/logic/ConfiguratorLogic.sol": {
"ConfiguratorLogic": "0x09e88e877B39D883BAFd46b65E7B06CC56963041"
},
"src/contracts/protocol/libraries/logic/EModeLogic.sol": {
"EModeLogic": "0xC31d2362fAeD85dF79d0bec99693D0EB0Abd3f74"
},
"src/contracts/protocol/libraries/logic/FlashLoanLogic.sol": {
"FlashLoanLogic": "0x34039100cc9584Ae5D741d322e16d0d18CEE8770"
},
"src/contracts/protocol/libraries/logic/LiquidationLogic.sol": {
"LiquidationLogic": "0x4731bF01583F991278692E8727d0700a00A1fBBf"
},
"src/contracts/protocol/libraries/logic/PoolLogic.sol": {
"PoolLogic": "0xf8C97539934ee66a67C26010e8e027D77E821B0C"
},
"src/contracts/protocol/libraries/logic/SupplyLogic.sol": {
"SupplyLogic": "0x185477906B46D9b8DE0DEB73A1bBfb87b5b51BC3"
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"BalanceExceeded","type":"error"},{"inputs":[],"name":"DepositNotMultipleTimeDelta","type":"error"},{"inputs":[],"name":"DepositSmallerTimeDelta","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidStartTime","type":"error"},{"inputs":[],"name":"InvalidStopTime","type":"error"},{"inputs":[],"name":"InvalidZeroAddress","type":"error"},{"inputs":[],"name":"InvalidZeroAmount","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"OnlyFundsAdmin","type":"error"},{"inputs":[],"name":"OnlyFundsAdminOrRecipient","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StreamDoesNotExist","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"streamId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"senderBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"recipientBalance","type":"uint256"}],"name":"CancelStream","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"streamId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"deposit","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stopTime","type":"uint256"}],"name":"CreateStream","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"streamId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFromStream","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_MOCK_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNDS_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"streamId","type":"uint256"},{"internalType":"address","name":"who","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"streamId","type":"uint256"}],"name":"cancelStream","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deposit","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"}],"name":"createStream","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"streamId","type":"uint256"}],"name":"deltaOf","outputs":[{"internalType":"uint256","name":"delta","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextStreamId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"streamId","type":"uint256"}],"name":"getStream","outputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deposit","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"},{"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"internalType":"uint256","name":"ratePerSecond","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nextStreamId","type":"uint256"},{"internalType":"address","name":"admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isFundsAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"streamId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFromStream","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801561000f575f80fd5b5061001861001d565b6100cf565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161561006d5760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100cc5780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b611960806100dc5f395ff3fe60806040526004361061011e575f3560e01c806391d148541161009d578063cc1b4bf611610062578063cc1b4bf614610371578063d547741f14610390578063da35a26f146103af578063e1f21c67146103ce578063f501148c146103ed575f80fd5b806391d14854146102e057806397713592146102ff578063a217fddf14610320578063a82ccd4d14610333578063beabacc814610352575f80fd5b80633656eec2116100e35780633656eec2146101da57806351ee886b146101f95780636db9241b146102385780637a9b2c6c14610257578063894e9a0d14610276575f80fd5b806301ffc9a7146101295780630932f92b1461015d578063248a9ca31461017b5780632f2ff15d1461019a57806336568abe146101bb575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b50610148610143366004611735565b61040c565b60405190151581526020015b60405180910390f35b348015610168575f80fd5b506035545b604051908152602001610154565b348015610186575f80fd5b5061016d610195366004611763565b610442565b3480156101a5575f80fd5b506101b96101b436600461178e565b610462565b005b3480156101c6575f80fd5b506101b96101d536600461178e565b610484565b3480156101e5575f80fd5b5061016d6101f436600461178e565b6104bc565b348015610204575f80fd5b5061022073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6040516001600160a01b039091168152602001610154565b348015610243575f80fd5b50610148610252366004611763565b61065f565b348015610262575f80fd5b506101486102713660046117bc565b6108a4565b348015610281575f80fd5b50610295610290366004611763565b610b24565b604080516001600160a01b03998a1681529789166020890152870195909552959092166060850152608084015260a083015260c082019290925260e081019190915261010001610154565b3480156102eb575f80fd5b506101486102fa36600461178e565b610bc7565b34801561030a575f80fd5b5061016d6a232aa72229afa0a226a4a760a91b81565b34801561032b575f80fd5b5061016d5f81565b34801561033e575f80fd5b5061016d61034d366004611763565b610bfd565b34801561035d575f80fd5b506101b961036c3660046117dc565b610d16565b34801561037c575f80fd5b5061016d61038b36600461181a565b610db2565b34801561039b575f80fd5b506101b96103aa36600461178e565b611104565b3480156103ba575f80fd5b506101b96103c936600461178e565b611120565b3480156103d9575f80fd5b506101b96103e83660046117dc565b611266565b3480156103f8575f80fd5b50610148610407366004611868565b6112a3565b5f6001600160e01b03198216637965db0b60e01b148061043c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f9081525f80516020611914833981519152602052604090206001015490565b61046b82610442565b610474816112bc565b61047e83836112c9565b50505050565b6001600160a01b03811633146104ad5760405163334bd91960e11b815260040160405180910390fd5b6104b7828261136a565b505050565b5f828152603660205260408120600701548390600160a01b900460ff166104f65760405163314c062560e21b815260040160405180910390fd5b5f8481526036602090815260408083208151610120810183528154815260018201548185015260028201548184015260038201546060808301919091526004830154608083015260058301546001600160a01b0390811660a08401526006840154811660c084015260079093015492831660e0830152600160a01b90920460ff1615156101008201528251918201835284825292810184905290810192909252905f6105a187610bfd565b90508260200151816105b39190611897565b82526040830151835111156105e957604083015183516105d391906118ae565b6020830181905282516105e691906118ae565b82525b8260a001516001600160a01b0316866001600160a01b03160361061157505192506106589050565b8260c001516001600160a01b0316866001600160a01b031603610651578151604084015161063f91906118ae565b60409092018290525092506106589050565b5f94505050505b5092915050565b5f6106686113e3565b5f828152603660205260409020600701548290600160a01b900460ff166106a25760405163314c062560e21b815260040160405180910390fd5b826106ab61141a565b1580156106d157505f818152603660205260409020600501546001600160a01b03163314155b156106ef576040516358c6353d60e11b815260040160405180910390fd5b5f84815260366020908152604080832081516101208101835281548152600182015493810193909352600281015491830191909152600381015460608301526004810154608083015260058101546001600160a01b0390811660a08401526006820154811660c0840181905260079092015490811660e0840152600160a01b900460ff1615156101008301529091906107899087906104bc565b90505f61079a878460a001516104bc565b5f88815260366020526040812081815560018101829055600281018290556003810182905560048101919091556005810180546001600160a01b0319908116909155600682018054909116905560070180546001600160a81b031916905560e084015190915081156108205760a0840151610820906001600160a01b0383169084611438565b8360a001516001600160a01b03168460c001516001600160a01b0316897fca3e6079b726e7728802a0537949e2d1c7762304fa641fb06eb56daf2ba8c6b98686604051610877929190918252602082015260400190565b60405180910390a46001965050505050505061089f60015f8051602061193483398151915255565b919050565b5f6108ad6113e3565b5f838152603660205260409020600701548390600160a01b900460ff166108e75760405163314c062560e21b815260040160405180910390fd5b836108f061141a565b15801561091657505f818152603660205260409020600501546001600160a01b03163314155b15610934576040516358c6353d60e11b815260040160405180910390fd5b835f0361095457604051630dd484e760e41b815260040160405180910390fd5b5f85815260366020908152604080832081516101208101835281548152600182015493810193909352600281015491830191909152600381015460608301526004810154608083015260058101546001600160a01b0390811660a084018190526006830154821660c085015260079092015490811660e0840152600160a01b900460ff1615156101008301529091906109ee9088906104bc565b905085811015610a1157604051634d9d73a360e01b815260040160405180910390fd5b858260400151610a2191906118ae565b5f88815260366020526040812060020182905503610a98575f87815260366020526040812081815560018101829055600281018290556003810182905560048101919091556005810180546001600160a01b0319908116909155600682018054909116905560070180546001600160a81b03191690555b610abe8260a00151878460e001516001600160a01b03166114389092919063ffffffff16565b8160a001516001600160a01b0316877f36c3ab437e6a424ed25dc4bfdeb62706aa06558660fab2dab229d2555adaf89c88604051610afe91815260200190565b60405180910390a3600194505050505061043c60015f8051602061193483398151915255565b5f805f805f805f808860365f8281526020019081526020015f2060070160149054906101000a900460ff16610b6c5760405163314c062560e21b815260040160405180910390fd5b5050505f968752505060366020525050604090922060068101546005820154825460078401546003850154600486015460028701546001909701546001600160a01b039687169a958716995093975091909416949092909190565b5f9182525f80516020611914833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f818152603660205260408120600701548290600160a01b900460ff16610c375760405163314c062560e21b815260040160405180910390fd5b5f83815260366020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082018190526004830154608083015260058301546001600160a01b0390811660a08401526006840154811660c084015260079093015492831660e0830152600160a01b90920460ff161515610100820152904211610cd5575f925050610d10565b8060800151421015610cf8576060810151610cf090426118ae565b925050610d10565b80606001518160800151610d0c91906118ae565b9250505b50919050565b610d1e61141a565b15155f03610d3f5760405163277cf38160e01b815260040160405180910390fd5b6001600160a01b038216610d665760405163f6b2911f60e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601610d9e576104b76001600160a01b038316826114aa565b6104b76001600160a01b0384168383611438565b5f610dbb61141a565b15155f03610ddc5760405163277cf38160e01b815260040160405180910390fd5b6001600160a01b038616610e035760405163f6b2911f60e01b815260040160405180910390fd5b306001600160a01b03871603610e2c57604051634e46966960e11b815260040160405180910390fd5b336001600160a01b03871603610e5557604051634e46966960e11b815260040160405180910390fd5b845f03610e7557604051630dd484e760e41b815260040160405180910390fd5b42831015610e9657604051632ca4094f60e21b815260040160405180910390fd5b828211610eb657604051635f5ab34960e01b815260040160405180910390fd5b604080518082019091525f8082526020820152610ed384846118ae565b808252861015610ef65760405163c4e1993b60e01b815260040160405180910390fd5b80515f90610f0490886118d5565b1115610f2357604051636b3cc5b760e11b815260040160405180910390fd5b8051610f2f90876118e8565b8160200181815250505f603554905060405180610120016040528088815260200183602001518152602001888152602001868152602001858152602001896001600160a01b03168152602001306001600160a01b03168152602001876001600160a01b031681526020016001151581525060365f8381526020019081526020015f205f820151815f01556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555060c0820151816006015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555060e0820151816007015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055506101008201518160070160146101000a81548160ff02191690831515021790555090505060355f81548092919061109b906118fb565b9091555050604080518881526001600160a01b0388811660208301529181018790526060810186905290891690309083907f7b01d409597969366dc268d7f957a990d1ca3d3449baf8fb45db67351aecfe789060800160405180910390a4979650505050505050565b61110d82610442565b611116816112bc565b61047e838361136a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156111655750825b90505f8267ffffffffffffffff1660011480156111815750303b155b90508115801561118f575080155b156111ad5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156111d757845460ff60401b1916600160401b1785555b6111df611549565b6111e7611553565b6111f15f876112c9565b5061120a6a232aa72229afa0a226a4a760a91b876112c9565b5086156112175760358790555b831561125d57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b61126e61141a565b15155f0361128f5760405163277cf38160e01b815260040160405180910390fd5b6104b76001600160a01b0384168383611563565b5f61043c6a232aa72229afa0a226a4a760a91b83610bc7565b6112c681336115f2565b50565b5f5f805160206119148339815191526112e28484610bc7565b611361575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556113173390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4600191505061043c565b5f91505061043c565b5f5f805160206119148339815191526113838484610bc7565b15611361575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4600191505061043c565b5f8051602061193483398151915280546001190161141457604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b5f6114336a232aa72229afa0a226a4a760a91b33610bc7565b905090565b6040516001600160a01b038381166024830152604482018390526104b791859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061162f565b60015f8051602061193483398151915255565b804710156114d95760405163cf47918160e01b8152476004820152602481018290526044015b60405180910390fd5b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611522576040519150601f19603f3d011682016040523d82523d5f602084013e611527565b606091505b50509050806104b75760405163d6bda27560e01b815260040160405180910390fd5b61155161169b565b565b61155b61169b565b6115516116e4565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526115b484826116ec565b61047e576040516001600160a01b0384811660248301525f60448301526115e891869182169063095ea7b390606401611465565b61047e848261162f565b6115fc8282610bc7565b61162b5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016114d0565b5050565b5f8060205f8451602086015f885af18061164e576040513d5f823e3d81fd5b50505f513d91508115611665578060011415611672565b6001600160a01b0384163b155b1561047e57604051635274afe760e01b81526001600160a01b03851660048201526024016114d0565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661155157604051631afcd79f60e31b815260040160405180910390fd5b61149761169b565b5f805f8060205f8651602088015f8a5af192503d91505f51905082801561172b5750811561171d578060011461172b565b5f866001600160a01b03163b115b9695505050505050565b5f60208284031215611745575f80fd5b81356001600160e01b03198116811461175c575f80fd5b9392505050565b5f60208284031215611773575f80fd5b5035919050565b6001600160a01b03811681146112c6575f80fd5b5f806040838503121561179f575f80fd5b8235915060208301356117b18161177a565b809150509250929050565b5f80604083850312156117cd575f80fd5b50508035926020909101359150565b5f805f606084860312156117ee575f80fd5b83356117f98161177a565b925060208401356118098161177a565b929592945050506040919091013590565b5f805f805f60a0868803121561182e575f80fd5b85356118398161177a565b94506020860135935060408601356118508161177a565b94979396509394606081013594506080013592915050565b5f60208284031215611878575f80fd5b813561175c8161177a565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761043c5761043c611883565b8181038181111561043c5761043c611883565b634e487b7160e01b5f52601260045260245ffd5b5f826118e3576118e36118c1565b500690565b5f826118f6576118f66118c1565b500490565b5f6001820161190c5761190c611883565b506001019056fe02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a164736f6c6343000816000a
Deployed Bytecode
0x60806040526004361061011e575f3560e01c806391d148541161009d578063cc1b4bf611610062578063cc1b4bf614610371578063d547741f14610390578063da35a26f146103af578063e1f21c67146103ce578063f501148c146103ed575f80fd5b806391d14854146102e057806397713592146102ff578063a217fddf14610320578063a82ccd4d14610333578063beabacc814610352575f80fd5b80633656eec2116100e35780633656eec2146101da57806351ee886b146101f95780636db9241b146102385780637a9b2c6c14610257578063894e9a0d14610276575f80fd5b806301ffc9a7146101295780630932f92b1461015d578063248a9ca31461017b5780632f2ff15d1461019a57806336568abe146101bb575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b50610148610143366004611735565b61040c565b60405190151581526020015b60405180910390f35b348015610168575f80fd5b506035545b604051908152602001610154565b348015610186575f80fd5b5061016d610195366004611763565b610442565b3480156101a5575f80fd5b506101b96101b436600461178e565b610462565b005b3480156101c6575f80fd5b506101b96101d536600461178e565b610484565b3480156101e5575f80fd5b5061016d6101f436600461178e565b6104bc565b348015610204575f80fd5b5061022073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6040516001600160a01b039091168152602001610154565b348015610243575f80fd5b50610148610252366004611763565b61065f565b348015610262575f80fd5b506101486102713660046117bc565b6108a4565b348015610281575f80fd5b50610295610290366004611763565b610b24565b604080516001600160a01b03998a1681529789166020890152870195909552959092166060850152608084015260a083015260c082019290925260e081019190915261010001610154565b3480156102eb575f80fd5b506101486102fa36600461178e565b610bc7565b34801561030a575f80fd5b5061016d6a232aa72229afa0a226a4a760a91b81565b34801561032b575f80fd5b5061016d5f81565b34801561033e575f80fd5b5061016d61034d366004611763565b610bfd565b34801561035d575f80fd5b506101b961036c3660046117dc565b610d16565b34801561037c575f80fd5b5061016d61038b36600461181a565b610db2565b34801561039b575f80fd5b506101b96103aa36600461178e565b611104565b3480156103ba575f80fd5b506101b96103c936600461178e565b611120565b3480156103d9575f80fd5b506101b96103e83660046117dc565b611266565b3480156103f8575f80fd5b50610148610407366004611868565b6112a3565b5f6001600160e01b03198216637965db0b60e01b148061043c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f9081525f80516020611914833981519152602052604090206001015490565b61046b82610442565b610474816112bc565b61047e83836112c9565b50505050565b6001600160a01b03811633146104ad5760405163334bd91960e11b815260040160405180910390fd5b6104b7828261136a565b505050565b5f828152603660205260408120600701548390600160a01b900460ff166104f65760405163314c062560e21b815260040160405180910390fd5b5f8481526036602090815260408083208151610120810183528154815260018201548185015260028201548184015260038201546060808301919091526004830154608083015260058301546001600160a01b0390811660a08401526006840154811660c084015260079093015492831660e0830152600160a01b90920460ff1615156101008201528251918201835284825292810184905290810192909252905f6105a187610bfd565b90508260200151816105b39190611897565b82526040830151835111156105e957604083015183516105d391906118ae565b6020830181905282516105e691906118ae565b82525b8260a001516001600160a01b0316866001600160a01b03160361061157505192506106589050565b8260c001516001600160a01b0316866001600160a01b031603610651578151604084015161063f91906118ae565b60409092018290525092506106589050565b5f94505050505b5092915050565b5f6106686113e3565b5f828152603660205260409020600701548290600160a01b900460ff166106a25760405163314c062560e21b815260040160405180910390fd5b826106ab61141a565b1580156106d157505f818152603660205260409020600501546001600160a01b03163314155b156106ef576040516358c6353d60e11b815260040160405180910390fd5b5f84815260366020908152604080832081516101208101835281548152600182015493810193909352600281015491830191909152600381015460608301526004810154608083015260058101546001600160a01b0390811660a08401526006820154811660c0840181905260079092015490811660e0840152600160a01b900460ff1615156101008301529091906107899087906104bc565b90505f61079a878460a001516104bc565b5f88815260366020526040812081815560018101829055600281018290556003810182905560048101919091556005810180546001600160a01b0319908116909155600682018054909116905560070180546001600160a81b031916905560e084015190915081156108205760a0840151610820906001600160a01b0383169084611438565b8360a001516001600160a01b03168460c001516001600160a01b0316897fca3e6079b726e7728802a0537949e2d1c7762304fa641fb06eb56daf2ba8c6b98686604051610877929190918252602082015260400190565b60405180910390a46001965050505050505061089f60015f8051602061193483398151915255565b919050565b5f6108ad6113e3565b5f838152603660205260409020600701548390600160a01b900460ff166108e75760405163314c062560e21b815260040160405180910390fd5b836108f061141a565b15801561091657505f818152603660205260409020600501546001600160a01b03163314155b15610934576040516358c6353d60e11b815260040160405180910390fd5b835f0361095457604051630dd484e760e41b815260040160405180910390fd5b5f85815260366020908152604080832081516101208101835281548152600182015493810193909352600281015491830191909152600381015460608301526004810154608083015260058101546001600160a01b0390811660a084018190526006830154821660c085015260079092015490811660e0840152600160a01b900460ff1615156101008301529091906109ee9088906104bc565b905085811015610a1157604051634d9d73a360e01b815260040160405180910390fd5b858260400151610a2191906118ae565b5f88815260366020526040812060020182905503610a98575f87815260366020526040812081815560018101829055600281018290556003810182905560048101919091556005810180546001600160a01b0319908116909155600682018054909116905560070180546001600160a81b03191690555b610abe8260a00151878460e001516001600160a01b03166114389092919063ffffffff16565b8160a001516001600160a01b0316877f36c3ab437e6a424ed25dc4bfdeb62706aa06558660fab2dab229d2555adaf89c88604051610afe91815260200190565b60405180910390a3600194505050505061043c60015f8051602061193483398151915255565b5f805f805f805f808860365f8281526020019081526020015f2060070160149054906101000a900460ff16610b6c5760405163314c062560e21b815260040160405180910390fd5b5050505f968752505060366020525050604090922060068101546005820154825460078401546003850154600486015460028701546001909701546001600160a01b039687169a958716995093975091909416949092909190565b5f9182525f80516020611914833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f818152603660205260408120600701548290600160a01b900460ff16610c375760405163314c062560e21b815260040160405180910390fd5b5f83815260366020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082018190526004830154608083015260058301546001600160a01b0390811660a08401526006840154811660c084015260079093015492831660e0830152600160a01b90920460ff161515610100820152904211610cd5575f925050610d10565b8060800151421015610cf8576060810151610cf090426118ae565b925050610d10565b80606001518160800151610d0c91906118ae565b9250505b50919050565b610d1e61141a565b15155f03610d3f5760405163277cf38160e01b815260040160405180910390fd5b6001600160a01b038216610d665760405163f6b2911f60e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601610d9e576104b76001600160a01b038316826114aa565b6104b76001600160a01b0384168383611438565b5f610dbb61141a565b15155f03610ddc5760405163277cf38160e01b815260040160405180910390fd5b6001600160a01b038616610e035760405163f6b2911f60e01b815260040160405180910390fd5b306001600160a01b03871603610e2c57604051634e46966960e11b815260040160405180910390fd5b336001600160a01b03871603610e5557604051634e46966960e11b815260040160405180910390fd5b845f03610e7557604051630dd484e760e41b815260040160405180910390fd5b42831015610e9657604051632ca4094f60e21b815260040160405180910390fd5b828211610eb657604051635f5ab34960e01b815260040160405180910390fd5b604080518082019091525f8082526020820152610ed384846118ae565b808252861015610ef65760405163c4e1993b60e01b815260040160405180910390fd5b80515f90610f0490886118d5565b1115610f2357604051636b3cc5b760e11b815260040160405180910390fd5b8051610f2f90876118e8565b8160200181815250505f603554905060405180610120016040528088815260200183602001518152602001888152602001868152602001858152602001896001600160a01b03168152602001306001600160a01b03168152602001876001600160a01b031681526020016001151581525060365f8381526020019081526020015f205f820151815f01556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555060c0820151816006015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555060e0820151816007015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055506101008201518160070160146101000a81548160ff02191690831515021790555090505060355f81548092919061109b906118fb565b9091555050604080518881526001600160a01b0388811660208301529181018790526060810186905290891690309083907f7b01d409597969366dc268d7f957a990d1ca3d3449baf8fb45db67351aecfe789060800160405180910390a4979650505050505050565b61110d82610442565b611116816112bc565b61047e838361136a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156111655750825b90505f8267ffffffffffffffff1660011480156111815750303b155b90508115801561118f575080155b156111ad5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156111d757845460ff60401b1916600160401b1785555b6111df611549565b6111e7611553565b6111f15f876112c9565b5061120a6a232aa72229afa0a226a4a760a91b876112c9565b5086156112175760358790555b831561125d57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b61126e61141a565b15155f0361128f5760405163277cf38160e01b815260040160405180910390fd5b6104b76001600160a01b0384168383611563565b5f61043c6a232aa72229afa0a226a4a760a91b83610bc7565b6112c681336115f2565b50565b5f5f805160206119148339815191526112e28484610bc7565b611361575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556113173390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4600191505061043c565b5f91505061043c565b5f5f805160206119148339815191526113838484610bc7565b15611361575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4600191505061043c565b5f8051602061193483398151915280546001190161141457604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b5f6114336a232aa72229afa0a226a4a760a91b33610bc7565b905090565b6040516001600160a01b038381166024830152604482018390526104b791859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061162f565b60015f8051602061193483398151915255565b804710156114d95760405163cf47918160e01b8152476004820152602481018290526044015b60405180910390fd5b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611522576040519150601f19603f3d011682016040523d82523d5f602084013e611527565b606091505b50509050806104b75760405163d6bda27560e01b815260040160405180910390fd5b61155161169b565b565b61155b61169b565b6115516116e4565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526115b484826116ec565b61047e576040516001600160a01b0384811660248301525f60448301526115e891869182169063095ea7b390606401611465565b61047e848261162f565b6115fc8282610bc7565b61162b5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016114d0565b5050565b5f8060205f8451602086015f885af18061164e576040513d5f823e3d81fd5b50505f513d91508115611665578060011415611672565b6001600160a01b0384163b155b1561047e57604051635274afe760e01b81526001600160a01b03851660048201526024016114d0565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661155157604051631afcd79f60e31b815260040160405180910390fd5b61149761169b565b5f805f8060205f8651602088015f8a5af192503d91505f51905082801561172b5750811561171d578060011461172b565b5f866001600160a01b03163b115b9695505050505050565b5f60208284031215611745575f80fd5b81356001600160e01b03198116811461175c575f80fd5b9392505050565b5f60208284031215611773575f80fd5b5035919050565b6001600160a01b03811681146112c6575f80fd5b5f806040838503121561179f575f80fd5b8235915060208301356117b18161177a565b809150509250929050565b5f80604083850312156117cd575f80fd5b50508035926020909101359150565b5f805f606084860312156117ee575f80fd5b83356117f98161177a565b925060208401356118098161177a565b929592945050506040919091013590565b5f805f805f60a0868803121561182e575f80fd5b85356118398161177a565b94506020860135935060408601356118508161177a565b94979396509394606081013594506080013592915050565b5f60208284031215611878575f80fd5b813561175c8161177a565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761043c5761043c611883565b8181038181111561043c5761043c611883565b634e487b7160e01b5f52601260045260245ffd5b5f826118e3576118e36118c1565b500690565b5f826118f6576118f66118c1565b500490565b5f6001820161190c5761190c611883565b506001019056fe02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a164736f6c6343000816000a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.