Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
BNBMagaLiquidityVault
Compiler Version
v0.8.30+commit.73712a01
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
error LvZeroAddress(string tag);
error LvZeroAmount();
error LvDestinationUnset(bytes32 id);
error LvCannotRecoverPrimaryToken();
/// @title BNBMAGA Liquidity reserve vault
/// @notice Holds tokens for market making and exchange listings.
contract BNBMagaLiquidityVault is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
IERC20 public immutable token;
bytes32 public constant VAULT_KEY = keccak256("LIQUIDITY");
string public constant VAULT_LABEL = "Liquidity Reserve Vault";
// Optional routing identifiers
mapping(bytes32 => address) private destinations;
event VaultInitialized(bytes32 indexed vaultKey, string label, address token, address owner);
event TokensDeposited(address indexed from, uint256 amount);
event TokensWithdrawn(address indexed to, uint256 amount);
event TokensDistributed(bytes32 indexed id, address indexed to, uint256 amount);
event SpenderApproved(address indexed spender, uint256 amount);
event DestinationUpdated(bytes32 indexed id, address indexed oldAddress, address indexed newAddress);
event ForeignTokenRecovered(address indexed token, address indexed to, uint256 amount);
constructor(address tokenAddress, address initialOwner) Ownable(initialOwner) {
if (tokenAddress == address(0)) revert LvZeroAddress("token");
if (initialOwner == address(0)) revert LvZeroAddress("owner");
token = IERC20(tokenAddress);
emit VaultInitialized(VAULT_KEY, VAULT_LABEL, tokenAddress, initialOwner);
}
// --- Funding ---
function fund(uint256 amount) external onlyOwner { _pull(amount, msg.sender); }
function deposit(uint256 amount) external { _pull(amount, msg.sender); }
// --- Direct withdrawals / distributions ---
function withdraw(address to, uint256 amount) external onlyOwner nonReentrant {
_ensureRecipient(to);
_ensureAmount(amount);
token.safeTransfer(to, amount);
emit TokensWithdrawn(to, amount);
}
function setDestination(bytes32 id, address destination) external onlyOwner {
address old = destinations[id];
destinations[id] = destination;
emit DestinationUpdated(id, old, destination);
}
function getDestination(bytes32 id) external view returns (address) {
return destinations[id];
}
function distributeTo(bytes32 id, uint256 amount) external onlyOwner nonReentrant {
_ensureAmount(amount);
address destination = destinations[id];
if (destination == address(0)) revert LvDestinationUnset(id);
token.safeTransfer(destination, amount);
emit TokensDistributed(id, destination, amount);
}
// --- Allowances / recovery ---
function approveSpender(address spender, uint256 amount) external onlyOwner {
_ensureRecipient(spender);
token.forceApprove(spender, amount);
emit SpenderApproved(spender, amount);
}
function recoverForeignToken(address erc20, address to, uint256 amount)
external
onlyOwner
nonReentrant
{
_ensureRecipient(to);
_ensureAmount(amount);
if (erc20 == address(token)) revert LvCannotRecoverPrimaryToken();
IERC20(erc20).safeTransfer(to, amount);
emit ForeignTokenRecovered(erc20, to, amount);
}
function balance() external view returns (uint256) {
return token.balanceOf(address(this));
}
// --- Internal helpers ---
function _pull(uint256 amount, address from) private {
_ensureAmount(amount);
token.safeTransferFrom(from, address(this), amount);
emit TokensDeposited(from, amount);
}
function _ensureRecipient(address account) private pure {
if (account == address(0)) revert LvZeroAddress("recipient");
}
function _ensureAmount(uint256 amount) private pure {
if (amount == 0) revert LvZeroAmount();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.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 Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(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.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @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.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
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.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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 Context {
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.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @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);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": [],
"evmVersion": "cancun"
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"LvCannotRecoverPrimaryToken","type":"error"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"LvDestinationUnset","type":"error"},{"inputs":[{"internalType":"string","name":"tag","type":"string"}],"name":"LvZeroAddress","type":"error"},{"inputs":[],"name":"LvZeroAmount","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"oldAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"DestinationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ForeignTokenRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SpenderApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"vaultKey","type":"bytes32"},{"indexed":false,"internalType":"string","name":"label","type":"string"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"VaultInitialized","type":"event"},{"inputs":[],"name":"VAULT_KEY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT_LABEL","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveSpender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"distributeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"getDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc20","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverForeignToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"address","name":"destination","type":"address"}],"name":"setDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a060405234801561000f575f5ffd5b50604051610ea3380380610ea383398101604081905261002e916101f6565b806001600160a01b03811661005d57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6100668161018c565b50600180556001600160a01b0382166100aa576040516329a1020960e21b81526020600482015260056024820152643a37b5b2b760d91b6044820152606401610054565b6001600160a01b0381166100e9576040516329a1020960e21b815260206004820152600560248201526437bbb732b960d91b6044820152606401610054565b6001600160a01b038216608052604080518082018252601781527f4c69717569646974792052657365727665205661756c74000000000000000000602082015290517f86cf169ddb9f19bc57304a958748511e956d0b9255fb5895294f9c4ae5b00d58917fff0a641876ad6336a075b1e3ccae9ca7beca8d1d7dcfeb01fc3f00b24fbe0aec9161017d919086908690610227565b60405180910390a25050610276565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146101f1575f5ffd5b919050565b5f5f60408385031215610207575f5ffd5b610210836101db565b915061021e602084016101db565b90509250929050565b606081525f84518060608401528060208701608085015e5f60808285018101919091526001600160a01b03958616602085015293909416604083015250601f909201601f191690910101919050565b608051610beb6102b85f395f8181610276015281816102b60152818161035b0152818161047d0152818161050d01528181610666015261091a0152610beb5ff3fe608060405234801561000f575f5ffd5b50600436106100f0575f3560e01c8063b3e0e18f11610093578063ca1d209d11610063578063ca1d209d14610238578063f2fde38b1461024b578063f3fef3a31461025e578063fc0c546a14610271575f5ffd5b8063b3e0e18f146101f7578063b69ef8a81461020a578063b6b55f2514610212578063b7dcdb1c14610225575f5ffd5b806359193a79116100ce57806359193a7914610183578063715018a6146101cc5780638770bc26146101d45780638da5cb5b146101e7575f5ffd5b8063080d7c4d146100f4578063261b6b371461010957806331cacd001461014e575b5f5ffd5b610107610102366004610a86565b610298565b005b610131610117366004610aae565b5f908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b6101757f86cf169ddb9f19bc57304a958748511e956d0b9255fb5895294f9c4ae5b00d5881565b604051908152602001610145565b6101bf6040518060400160405280601781526020017f4c69717569646974792052657365727665205661756c7400000000000000000081525081565b6040516101459190610ac5565b610107610324565b6101076101e2366004610afa565b610337565b5f546001600160a01b0316610131565b610107610205366004610b34565b61041a565b6101756104f6565b610107610220366004610aae565b610583565b610107610233366004610b54565b610590565b610107610246366004610aae565b6105f5565b610107610259366004610b7e565b6105fd565b61010761026c366004610a86565b610637565b6101317f000000000000000000000000000000000000000000000000000000000000000081565b6102a06106d9565b6102a982610705565b6102dd6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383610748565b816001600160a01b03167f4eb77c12d07449afe482411ab27c7ba84ffcdfb35e6bb4614daf2fbdb67634f38260405161031891815260200190565b60405180910390a25050565b61032c6106d9565b6103355f61080b565b565b61033f6106d9565b61034761085a565b61035082610705565b610359816108b3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036103ab5760405163097a9ce560e11b815260040160405180910390fd5b6103bf6001600160a01b03841683836108d3565b816001600160a01b0316836001600160a01b03167fe75797be6bca4892dff387b21838426edbc9926d3cabb9df3964a98708b0612b8360405161040491815260200190565b60405180910390a361041560018055565b505050565b6104226106d9565b61042a61085a565b610433816108b3565b5f828152600260205260409020546001600160a01b03168061047057604051634814baf960e11b8152600481018490526024015b60405180910390fd5b6104a46001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001682846108d3565b806001600160a01b0316837fcb7b7c0aba0d2db8e9ff8e7394b81caf422415c5639a94196ed37c431edc723d846040516104e091815260200190565b60405180910390a3506104f260018055565b5050565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561055a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061057e9190610b9e565b905090565b61058d8133610904565b50565b6105986106d9565b5f8281526002602052604080822080546001600160a01b031981166001600160a01b038681169182179093559251911692839186917f5958741b16984f7300e1e831337d4bd85dba7c40fc9b0e37118d5fc50590a25791a4505050565b6105836106d9565b6106056106d9565b6001600160a01b03811661062e57604051631e4fbdf760e01b81525f6004820152602401610467565b61058d8161080b565b61063f6106d9565b61064761085a565b61065082610705565b610659816108b3565b61068d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683836108d3565b816001600160a01b03167f6352c5382c4a4578e712449ca65e83cdb392d045dfcf1cad9615189db2da244b826040516106c891815260200190565b60405180910390a26104f260018055565b5f546001600160a01b031633146103355760405163118cdaa760e01b8152336004820152602401610467565b6001600160a01b03811661058d576040516329a1020960e21b81526020600482015260096024820152681c9958da5c1a595b9d60ba1b6044820152606401610467565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610799848261097d565b610805576040516001600160a01b0384811660248301525f60448301526107fb91869182169063095ea7b3906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506109c6565b61080584826109c6565b50505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6002600154036108ac5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610467565b6002600155565b805f0361058d57604051633ed11db760e21b815260040160405180910390fd5b6040516001600160a01b0383811660248301526044820183905261041591859182169063a9059cbb906064016107c9565b61090d826108b3565b6109426001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016823085610a32565b806001600160a01b03167f59062170a285eb80e8c6b8ced60428442a51910635005233fc4ce084a475845e8360405161031891815260200190565b5f5f5f5f60205f8651602088015f8a5af192503d91505f5190508280156109bc575081156109ae57806001146109bc565b5f866001600160a01b03163b115b9695505050505050565b5f5f60205f8451602086015f885af1806109e5576040513d5f823e3d81fd5b50505f513d915081156109fc578060011415610a09565b6001600160a01b0384163b155b1561080557604051635274afe760e01b81526001600160a01b0385166004820152602401610467565b6040516001600160a01b0384811660248301528381166044830152606482018390526108059186918216906323b872dd906084016107c9565b80356001600160a01b0381168114610a81575f5ffd5b919050565b5f5f60408385031215610a97575f5ffd5b610aa083610a6b565b946020939093013593505050565b5f60208284031215610abe575f5ffd5b5035919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f5f5f60608486031215610b0c575f5ffd5b610b1584610a6b565b9250610b2360208501610a6b565b929592945050506040919091013590565b5f5f60408385031215610b45575f5ffd5b50508035926020909101359150565b5f5f60408385031215610b65575f5ffd5b82359150610b7560208401610a6b565b90509250929050565b5f60208284031215610b8e575f5ffd5b610b9782610a6b565b9392505050565b5f60208284031215610bae575f5ffd5b505191905056fea2646970667358221220d8fcbaea832c078194e1e8c3dc37a65c0dc42e999eb7bb7e15769eaca0c2db3d64736f6c634300081e0033000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b000000000000000000000000e4b0db18763e6f1e71fe5e7cf1948b2de0d77df4
Deployed Bytecode
0x608060405234801561000f575f5ffd5b50600436106100f0575f3560e01c8063b3e0e18f11610093578063ca1d209d11610063578063ca1d209d14610238578063f2fde38b1461024b578063f3fef3a31461025e578063fc0c546a14610271575f5ffd5b8063b3e0e18f146101f7578063b69ef8a81461020a578063b6b55f2514610212578063b7dcdb1c14610225575f5ffd5b806359193a79116100ce57806359193a7914610183578063715018a6146101cc5780638770bc26146101d45780638da5cb5b146101e7575f5ffd5b8063080d7c4d146100f4578063261b6b371461010957806331cacd001461014e575b5f5ffd5b610107610102366004610a86565b610298565b005b610131610117366004610aae565b5f908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b6101757f86cf169ddb9f19bc57304a958748511e956d0b9255fb5895294f9c4ae5b00d5881565b604051908152602001610145565b6101bf6040518060400160405280601781526020017f4c69717569646974792052657365727665205661756c7400000000000000000081525081565b6040516101459190610ac5565b610107610324565b6101076101e2366004610afa565b610337565b5f546001600160a01b0316610131565b610107610205366004610b34565b61041a565b6101756104f6565b610107610220366004610aae565b610583565b610107610233366004610b54565b610590565b610107610246366004610aae565b6105f5565b610107610259366004610b7e565b6105fd565b61010761026c366004610a86565b610637565b6101317f000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b81565b6102a06106d9565b6102a982610705565b6102dd6001600160a01b037f000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b168383610748565b816001600160a01b03167f4eb77c12d07449afe482411ab27c7ba84ffcdfb35e6bb4614daf2fbdb67634f38260405161031891815260200190565b60405180910390a25050565b61032c6106d9565b6103355f61080b565b565b61033f6106d9565b61034761085a565b61035082610705565b610359816108b3565b7f000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b6001600160a01b0316836001600160a01b0316036103ab5760405163097a9ce560e11b815260040160405180910390fd5b6103bf6001600160a01b03841683836108d3565b816001600160a01b0316836001600160a01b03167fe75797be6bca4892dff387b21838426edbc9926d3cabb9df3964a98708b0612b8360405161040491815260200190565b60405180910390a361041560018055565b505050565b6104226106d9565b61042a61085a565b610433816108b3565b5f828152600260205260409020546001600160a01b03168061047057604051634814baf960e11b8152600481018490526024015b60405180910390fd5b6104a46001600160a01b037f000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b1682846108d3565b806001600160a01b0316837fcb7b7c0aba0d2db8e9ff8e7394b81caf422415c5639a94196ed37c431edc723d846040516104e091815260200190565b60405180910390a3506104f260018055565b5050565b6040516370a0823160e01b81523060048201525f907f000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b6001600160a01b0316906370a0823190602401602060405180830381865afa15801561055a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061057e9190610b9e565b905090565b61058d8133610904565b50565b6105986106d9565b5f8281526002602052604080822080546001600160a01b031981166001600160a01b038681169182179093559251911692839186917f5958741b16984f7300e1e831337d4bd85dba7c40fc9b0e37118d5fc50590a25791a4505050565b6105836106d9565b6106056106d9565b6001600160a01b03811661062e57604051631e4fbdf760e01b81525f6004820152602401610467565b61058d8161080b565b61063f6106d9565b61064761085a565b61065082610705565b610659816108b3565b61068d6001600160a01b037f000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b1683836108d3565b816001600160a01b03167f6352c5382c4a4578e712449ca65e83cdb392d045dfcf1cad9615189db2da244b826040516106c891815260200190565b60405180910390a26104f260018055565b5f546001600160a01b031633146103355760405163118cdaa760e01b8152336004820152602401610467565b6001600160a01b03811661058d576040516329a1020960e21b81526020600482015260096024820152681c9958da5c1a595b9d60ba1b6044820152606401610467565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610799848261097d565b610805576040516001600160a01b0384811660248301525f60448301526107fb91869182169063095ea7b3906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506109c6565b61080584826109c6565b50505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6002600154036108ac5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610467565b6002600155565b805f0361058d57604051633ed11db760e21b815260040160405180910390fd5b6040516001600160a01b0383811660248301526044820183905261041591859182169063a9059cbb906064016107c9565b61090d826108b3565b6109426001600160a01b037f000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b16823085610a32565b806001600160a01b03167f59062170a285eb80e8c6b8ced60428442a51910635005233fc4ce084a475845e8360405161031891815260200190565b5f5f5f5f60205f8651602088015f8a5af192503d91505f5190508280156109bc575081156109ae57806001146109bc565b5f866001600160a01b03163b115b9695505050505050565b5f5f60205f8451602086015f885af1806109e5576040513d5f823e3d81fd5b50505f513d915081156109fc578060011415610a09565b6001600160a01b0384163b155b1561080557604051635274afe760e01b81526001600160a01b0385166004820152602401610467565b6040516001600160a01b0384811660248301528381166044830152606482018390526108059186918216906323b872dd906084016107c9565b80356001600160a01b0381168114610a81575f5ffd5b919050565b5f5f60408385031215610a97575f5ffd5b610aa083610a6b565b946020939093013593505050565b5f60208284031215610abe575f5ffd5b5035919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f5f5f60608486031215610b0c575f5ffd5b610b1584610a6b565b9250610b2360208501610a6b565b929592945050506040919091013590565b5f5f60408385031215610b45575f5ffd5b50508035926020909101359150565b5f5f60408385031215610b65575f5ffd5b82359150610b7560208401610a6b565b90509250929050565b5f60208284031215610b8e575f5ffd5b610b9782610a6b565b9392505050565b5f60208284031215610bae575f5ffd5b505191905056fea2646970667358221220d8fcbaea832c078194e1e8c3dc37a65c0dc42e999eb7bb7e15769eaca0c2db3d64736f6c634300081e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b000000000000000000000000e4b0db18763e6f1e71fe5e7cf1948b2de0d77df4
-----Decoded View---------------
Arg [0] : tokenAddress (address): 0xBb0E53741f2D1ebFb87F6a89632242F58A08f13B
Arg [1] : initialOwner (address): 0xE4b0db18763E6F1E71FE5e7CF1948B2de0d77dF4
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000bb0e53741f2d1ebfb87f6a89632242f58a08f13b
Arg [1] : 000000000000000000000000e4b0db18763e6f1e71fe5e7cf1948b2de0d77df4
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.