Latest 25 from a total of 100,198 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Bridge | 42204565 | 21 secs ago | IN | 0 ETH | 0.00000129 | ||||
| Bridge | 42204549 | 53 secs ago | IN | 0.00545409 ETH | 0.00000075 | ||||
| Bridge | 42204507 | 2 mins ago | IN | 0.0372 ETH | 0.00000078 | ||||
| Bridge | 42204394 | 6 mins ago | IN | 0.003 ETH | 0.0000011 | ||||
| Bridge | 42204373 | 6 mins ago | IN | 0.00029 ETH | 0.00000134 | ||||
| Bridge | 42204358 | 7 mins ago | IN | 0 ETH | 0.00000833 | ||||
| Bridge | 42204339 | 7 mins ago | IN | 0 ETH | 0.00000145 | ||||
| Bridge | 42204332 | 8 mins ago | IN | 0 ETH | 0.00000309 | ||||
| Bridge | 42204315 | 8 mins ago | IN | 0 ETH | 0.0000057 | ||||
| Bridge | 42204307 | 8 mins ago | IN | 0.00104 ETH | 0.00000181 | ||||
| Bridge | 42204246 | 10 mins ago | IN | 0 ETH | 0.00000143 | ||||
| Bridge | 42204243 | 11 mins ago | IN | 0 ETH | 0.00000687 | ||||
| Bridge | 42204216 | 11 mins ago | IN | 0.0029 ETH | 0.00000107 | ||||
| Bridge | 42204093 | 16 mins ago | IN | 0.00007 ETH | 0.00000069 | ||||
| Bridge | 42204047 | 17 mins ago | IN | 0.0097 ETH | 0.00000087 | ||||
| Bridge | 42203999 | 19 mins ago | IN | 0 ETH | 0.00000692 | ||||
| Bridge | 42203978 | 19 mins ago | IN | 0.0007 ETH | 0.00000105 | ||||
| Bridge | 42203920 | 21 mins ago | IN | 0.00071927 ETH | 0.00000572 | ||||
| Bridge | 42203891 | 22 mins ago | IN | 0.039 ETH | 0.00000037 | ||||
| Bridge | 42203880 | 23 mins ago | IN | 0 ETH | 0.00001113 | ||||
| Bridge | 42203798 | 25 mins ago | IN | 0 ETH | 0.00000161 | ||||
| Bridge | 42203624 | 31 mins ago | IN | 0 ETH | 0.00000188 | ||||
| Bridge | 42203615 | 32 mins ago | IN | 0 ETH | 0.00000223 | ||||
| Bridge | 42203614 | 32 mins ago | IN | 0.00026715 ETH | 0.00000082 | ||||
| Bridge | 42203541 | 34 mins ago | IN | 0 ETH | 0.00001612 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 42204549 | 53 secs ago | 0.00545409 ETH | ||||
| 42204507 | 2 mins ago | 0.0372 ETH | ||||
| 42204394 | 6 mins ago | 0.003 ETH | ||||
| 42204373 | 6 mins ago | 0.00029 ETH | ||||
| 42204307 | 8 mins ago | 0.00104 ETH | ||||
| 42204216 | 11 mins ago | 0.0029 ETH | ||||
| 42204093 | 16 mins ago | 0.00007 ETH | ||||
| 42204047 | 17 mins ago | 0.0097 ETH | ||||
| 42203978 | 19 mins ago | 0.0007 ETH | ||||
| 42203920 | 21 mins ago | 0.00071927 ETH | ||||
| 42203891 | 22 mins ago | 0.039 ETH | ||||
| 42203614 | 32 mins ago | 0.00026715 ETH | ||||
| 42203499 | 35 mins ago | 0.00658 ETH | ||||
| 42203497 | 35 mins ago | 0.15 ETH | ||||
| 42203471 | 36 mins ago | 0.0026753 ETH | ||||
| 42203430 | 38 mins ago | 0.005 ETH | ||||
| 42203229 | 44 mins ago | 0.2556113 ETH | ||||
| 42203201 | 45 mins ago | 0.00891795 ETH | ||||
| 42202754 | 1 hr ago | 0.00007884 ETH | ||||
| 42202695 | 1 hr ago | 0.00002934 ETH | ||||
| 42202633 | 1 hr ago | 0.0032 ETH | ||||
| 42202554 | 1 hr ago | 0.13 ETH | ||||
| 42202528 | 1 hr ago | 0.00122716 ETH | ||||
| 42202409 | 1 hr ago | 0.00001372 ETH | ||||
| 42202340 | 1 hr ago | 0.00014465 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MetaBridge
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 999999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IAdapter, IBridge, ISpender} from "contracts/interfaces/Exports.sol";
import {Constants} from "contracts/utils/Exports.sol";
import "./Spender.sol";
contract MetaBridge is IBridge, Ownable, Pausable, ReentrancyGuard {
using SafeERC20 for IERC20;
using Address for address;
ISpender public immutable spender;
// Mapping of adapterId to adapter
mapping(string => address) public adapters;
mapping(string => bool) public adapterRemoved;
/**
* @notice Constructor to create the MetaBridge
* @param _owner The Owner of the MetaBridge set on deployment
* @dev Deploys the Spender. Once the Spender is deployed it cannot be changed
*/
constructor(address _owner) {
spender = new Spender();
_transferOwnership(_owner);
}
/**
* @notice Sets the adapter for an aggregator. It can't be changed later.
* @param adapterId Aggregator's identifier
* @param adapterAddress Address of the contract that contains the logic for this aggregator
*/
function setAdapter(
string calldata adapterId,
address adapterAddress
) external override onlyOwner {
require(adapterAddress.isContract(), "ADAPTER_IS_NOT_A_CONTRACT");
require(!adapterRemoved[adapterId], "ADAPTER_REMOVED");
require(adapters[adapterId] == address(0), "ADAPTER_EXISTS");
require(bytes(adapterId).length > 0, "INVALID_ADAPTED_ID");
adapters[adapterId] = adapterAddress;
emit AdapterSet(adapterId, adapterAddress);
}
/**
* @notice Removes the adapter for an existing aggregator. This can't be undone.
* @param adapterId Adapter's identifier
*/
function removeAdapter(
string calldata adapterId
) external override onlyOwner {
require(adapters[adapterId] != address(0), "ADAPTER_DOES_NOT_EXIST");
delete adapters[adapterId];
adapterRemoved[adapterId] = true;
emit AdapterRemoved(adapterId);
}
/**
* @notice Performs a bridge
* @param adapterId Identifier of the aggregator to be used for the bridge
* @param srcToken Identifier of the source chain
* @param amount Amount of tokens to be transferred from the destination chain
* @param data Dynamic data which is passed in to the delegatecall made to the adapter
* @dev pausable and nonreentrant
*/
function bridge(
string calldata adapterId,
address srcToken,
uint256 amount,
bytes calldata data
) external payable override whenNotPaused nonReentrant {
address adapter = adapters[adapterId];
require(adapter != address(0), "ADAPTER_NOT_FOUND");
// Move ERC20 funds to the spender
if (srcToken != Constants.NATIVE_TOKEN) {
IERC20(srcToken).safeTransferFrom(
msg.sender,
address(spender),
amount
);
} else {
require(msg.value == amount, "MSGVALUE_AMOUNT_MISMATCH");
}
spender.bridge{value: msg.value}(
adapter,
abi.encodePacked(
// bridge signature
IAdapter.bridge.selector,
abi.encode(msg.sender),
data
)
);
}
/**
* @notice Prevents the bridge function from being executed until the contract is unpaused.
*/
function pauseBridge() external onlyOwner {
_pause();
}
/**
* @notice Unpauses the contract to make the bridge function callable.
*/
function unpauseBridge() external onlyOwner {
_unpause();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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 v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// 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 v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}pragma solidity ^0.8.0;
import {IAdapter} from "./IAdapter.sol";
import {IBridge} from "./IBridge.sol";
import {ISpender} from "./ISpender.sol";pragma solidity ^0.8.0;
interface IAdapter {
event Bridge(
address recipient,
address aggregator,
uint256 destChain,
address srcToken,
address destToken,
uint256 srcAmount
);
event Fee(address srcToken, address feeWallet, uint256 fee);
function bridge(
address recipient,
address aggregator,
address spender,
uint256 destChain,
address srcToken,
address destToken,
uint256 srcAmount,
bytes calldata data,
uint256 fee,
address payable feeWallet
) external payable;
}pragma solidity ^0.8.0;
interface IBridge {
event AdapterSet(string adapterId, address addr);
event AdapterRemoved(string adapterId);
function setAdapter(
string calldata adapterId,
address adapterAddress
) external;
function removeAdapter(string calldata adapterId) external;
function bridge(
string calldata adapterId,
address tokenFrom,
uint256 amount,
bytes calldata data
) external payable;
}pragma solidity ^0.8.0;
interface ISpender {
function bridge(
address adapterAddress,
bytes calldata data
) external payable;
}pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Address.sol";
import {IBridge, ISpender} from "contracts/interfaces/Exports.sol";
contract Spender is ISpender {
using Address for address;
IBridge public immutable metabridge;
/**
* @dev MetaBridge creates the Spender. Not intended to be called directly.
*/
constructor() public {
metabridge = IBridge(msg.sender);
}
/**
* @notice Performs a bridge
* @param adapter Address of the adapter to be used for the bridge
* @param data Dynamic data which is passed in to the delegatecall made to the adapter
*/
function bridge(
address adapter,
bytes calldata data
) external payable override {
require(msg.sender == address(metabridge), "FORBIDDEN");
adapter.functionDelegateCall(data, "ADAPTER_DELEGATECALL_FAILED");
}
}pragma solidity ^0.8.0;
library Constants {
address internal constant NATIVE_TOKEN =
0x0000000000000000000000000000000000000000;
}pragma solidity ^0.8.0;
import {Constants} from "./Constants.sol";{
"optimizer": {
"enabled": true,
"runs": 999999
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"adapterId","type":"string"}],"name":"AdapterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"adapterId","type":"string"},{"indexed":false,"internalType":"address","name":"addr","type":"address"}],"name":"AdapterSet","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"adapterRemoved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"adapters","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"adapterId","type":"string"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"adapterId","type":"string"}],"name":"removeAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"adapterId","type":"string"},{"internalType":"address","name":"adapterAddress","type":"address"}],"name":"setAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spender","outputs":[{"internalType":"contract ISpender","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseBridge","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b5060405162001ced38038062001ced8339810160408190526200003491620000f8565b6200003f336200009a565b6000805460ff60a01b19169055600180556040516200005e90620000ea565b604051809103906000f0801580156200007b573d6000803e3d6000fd5b506001600160a01b031660805262000093816200009a565b506200012a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6104e1806200180c83390190565b6000602082840312156200010b57600080fd5b81516001600160a01b03811681146200012357600080fd5b9392505050565b6080516116b8620001546000396000818161028801528181610691015261074501526116b86000f3fe6080604052600436106100c75760003560e01c80638da5cb5b11610074578063b84f5d1e1161004e578063b84f5d1e14610228578063e8edc81614610276578063f2fde38b146102aa57600080fd5b80638da5cb5b1461018c578063a82f143c146101d8578063b5268389146101ed57600080fd5b80635c975abb116100a55780635c975abb14610121578063715018a6146101625780637dd0480f1461017757600080fd5b806339122461146100cc5780633ce33bff146100ee5780633ef11fd714610101575b600080fd5b3480156100d857600080fd5b506100ec6100e7366004611253565b6102ca565b005b6100ec6100fc3660046112a7565b6105a5565b34801561010d57600080fd5b506100ec61011c366004611334565b610843565b34801561012d57600080fd5b5060005474010000000000000000000000000000000000000000900460ff165b60405190151581526020015b60405180910390f35b34801561016e57600080fd5b506100ec6109d6565b34801561018357600080fd5b506100ec6109ea565b34801561019857600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610159565b3480156101e457600080fd5b506100ec6109fa565b3480156101f957600080fd5b5061014d6102083660046113a5565b805160208183018101805160038252928201919093012091525460ff1681565b34801561023457600080fd5b506101b36102433660046113a5565b805160208183018101805160028252928201919093012091525473ffffffffffffffffffffffffffffffffffffffff1681565b34801561028257600080fd5b506101b37f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b657600080fd5b506100ec6102c5366004611474565b610a0a565b6102d2610ac1565b73ffffffffffffffffffffffffffffffffffffffff81163b610355576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f414441505445525f49535f4e4f545f415f434f4e54524143540000000000000060448201526064015b60405180910390fd5b60038383604051610367929190611496565b9081526040519081900360200190205460ff16156103e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f414441505445525f52454d4f5645440000000000000000000000000000000000604482015260640161034c565b600073ffffffffffffffffffffffffffffffffffffffff166002848460405161040b929190611496565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1614610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f414441505445525f455849535453000000000000000000000000000000000000604482015260640161034c565b816104ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f494e56414c49445f414441505445445f49440000000000000000000000000000604482015260640161034c565b8060028484604051610512929190611496565b908152604051908190036020018120805473ffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffffffffffff0000000000000000000000000000000000000000909316929092179091557ff9648cbc19f288e0f271f7e95311238912bf1ea8225e636a13bb1d259126002190610598908590859085906114ef565b60405180910390a1505050565b6105ad610b42565b6105b5610bc7565b6000600287876040516105c9929190611496565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff16905080610658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f414441505445525f4e4f545f464f554e44000000000000000000000000000000604482015260640161034c565b73ffffffffffffffffffffffffffffffffffffffff8516156106bb576106b673ffffffffffffffffffffffffffffffffffffffff8616337f000000000000000000000000000000000000000000000000000000000000000087610c3a565b610724565b833414610724576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4d534756414c55455f414d4f554e545f4d49534d415443480000000000000000604482015260640161034c565b6040805133602082015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691634cfee32691349185917fab138240000000000000000000000000000000000000000000000000000000009101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526107d392918a908a9060200161154d565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016107ff9291906115ee565b6000604051808303818588803b15801561081857600080fd5b505af115801561082c573d6000803e3d6000fd5b50505050505061083b60018055565b505050505050565b61084b610ac1565b600073ffffffffffffffffffffffffffffffffffffffff1660028383604051610875929190611496565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610902576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f414441505445525f444f45535f4e4f545f455849535400000000000000000000604482015260640161034c565b60028282604051610914929190611496565b90815260405190819003602001812080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560019060039061095c9085908590611496565b90815260405190819003602001812080549215157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909316929092179091557fb00061f7cc154fc23eb34671ab724fc7eb7b806abae871abae8f1eafce972135906109ca908490849061161d565b60405180910390a15050565b6109de610ac1565b6109e86000610cd5565b565b6109f2610ac1565b6109e8610d4a565b610a02610ac1565b6109e8610de3565b610a12610ac1565b73ffffffffffffffffffffffffffffffffffffffff8116610ab5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161034c565b610abe81610cd5565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b60005474010000000000000000000000000000000000000000900460ff16156109e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161034c565b600260015403610c33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161034c565b6002600155565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052610ccf908590610e3a565b50505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610d52610b42565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610db93390565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b610deb610f4e565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33610db9565b6000610e9c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610fd29092919063ffffffff16565b9050805160001480610ebd575080806020019051810190610ebd9190611631565b610f49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161034c565b505050565b60005474010000000000000000000000000000000000000000900460ff166109e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161034c565b6060610fe18484600085610fe9565b949350505050565b60608247101561107b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161034c565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516110a49190611653565b60006040518083038185875af1925050503d80600081146110e1576040519150601f19603f3d011682016040523d82523d6000602084013e6110e6565b606091505b50915091506110f787838387611102565b979650505050505050565b606083156111985782516000036111915773ffffffffffffffffffffffffffffffffffffffff85163b611191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161034c565b5081610fe1565b610fe183838151156111ad5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161034c919061166f565b60008083601f8401126111f357600080fd5b50813567ffffffffffffffff81111561120b57600080fd5b60208301915083602082850101111561122357600080fd5b9250929050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461124e57600080fd5b919050565b60008060006040848603121561126857600080fd5b833567ffffffffffffffff81111561127f57600080fd5b61128b868287016111e1565b909450925061129e90506020850161122a565b90509250925092565b600080600080600080608087890312156112c057600080fd5b863567ffffffffffffffff808211156112d857600080fd5b6112e48a838b016111e1565b90985096508691506112f860208a0161122a565b955060408901359450606089013591508082111561131557600080fd5b5061132289828a016111e1565b979a9699509497509295939492505050565b6000806020838503121561134757600080fd5b823567ffffffffffffffff81111561135e57600080fd5b61136a858286016111e1565b90969095509350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156113b757600080fd5b813567ffffffffffffffff808211156113cf57600080fd5b818401915084601f8301126113e357600080fd5b8135818111156113f5576113f5611376565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561143b5761143b611376565b8160405282815287602084870101111561145457600080fd5b826020860160208301376000928101602001929092525095945050505050565b60006020828403121561148657600080fd5b61148f8261122a565b9392505050565b8183823760009101908152919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6040815260006115036040830185876114a6565b905073ffffffffffffffffffffffffffffffffffffffff83166020830152949350505050565b60005b8381101561154457818101518382015260200161152c565b50506000910152565b7fffffffff000000000000000000000000000000000000000000000000000000008516815260008451611587816004850160208901611529565b820183856004830137600093016004019283525090949350505050565b600081518084526115bc816020860160208601611529565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610fe160408301846115a4565b602081526000610fe16020830184866114a6565b60006020828403121561164357600080fd5b8151801515811461148f57600080fd5b60008251611665818460208701611529565b9190910192915050565b60208152600061148f60208301846115a456fea264697066735822122072506545287e639e706b5ac924fb1dc17154f9ae1d31264c54b4f71cdcd9ef6a64736f6c6343000813003360a060405234801561001057600080fd5b50336080526080516104ac610035600039600081816055015260b801526104ac6000f3fe6080604052600436106100295760003560e01c80634cfee3261461002e5780634ed6ef1914610043575b600080fd5b61004161003c366004610347565b6100a0565b005b34801561004f57600080fd5b506100777f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610144576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f464f5242494444454e000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6101d082828080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152601b81527f414441505445525f44454c454741544543414c4c5f4641494c45440000000000602082015273ffffffffffffffffffffffffffffffffffffffff881693925090506101d6565b50505050565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516102009190610409565b600060405180830381855af49150503d806000811461023b576040519150601f19603f3d011682016040523d82523d6000602084013e610240565b606091505b50915091506102518683838761025b565b9695505050505050565b606083156102f15782516000036102ea5773ffffffffffffffffffffffffffffffffffffffff85163b6102ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161013b565b50816102fb565b6102fb8383610303565b949350505050565b8151156103135781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161013b9190610425565b60008060006040848603121561035c57600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461038057600080fd5b9250602084013567ffffffffffffffff8082111561039d57600080fd5b818601915086601f8301126103b157600080fd5b8135818111156103c057600080fd5b8760208285010111156103d257600080fd5b6020830194508093505050509250925092565b60005b838110156104005781810151838201526020016103e8565b50506000910152565b6000825161041b8184602087016103e5565b9190910192915050565b60208152600082518060208401526104448160408501602087016103e5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212204abcbd7ec8b4d7b725614a43b1d1225399c3aaf13795f8e50a196e41b8590eb564736f6c63430008130033000000000000000000000000c3a624e7dba0bf887cb945bc6667bd6abee388d2
Deployed Bytecode
0x6080604052600436106100c75760003560e01c80638da5cb5b11610074578063b84f5d1e1161004e578063b84f5d1e14610228578063e8edc81614610276578063f2fde38b146102aa57600080fd5b80638da5cb5b1461018c578063a82f143c146101d8578063b5268389146101ed57600080fd5b80635c975abb116100a55780635c975abb14610121578063715018a6146101625780637dd0480f1461017757600080fd5b806339122461146100cc5780633ce33bff146100ee5780633ef11fd714610101575b600080fd5b3480156100d857600080fd5b506100ec6100e7366004611253565b6102ca565b005b6100ec6100fc3660046112a7565b6105a5565b34801561010d57600080fd5b506100ec61011c366004611334565b610843565b34801561012d57600080fd5b5060005474010000000000000000000000000000000000000000900460ff165b60405190151581526020015b60405180910390f35b34801561016e57600080fd5b506100ec6109d6565b34801561018357600080fd5b506100ec6109ea565b34801561019857600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610159565b3480156101e457600080fd5b506100ec6109fa565b3480156101f957600080fd5b5061014d6102083660046113a5565b805160208183018101805160038252928201919093012091525460ff1681565b34801561023457600080fd5b506101b36102433660046113a5565b805160208183018101805160028252928201919093012091525473ffffffffffffffffffffffffffffffffffffffff1681565b34801561028257600080fd5b506101b37f000000000000000000000000a5c1ce365ddb5a91ff466774ec4bdf8f97cb9f5581565b3480156102b657600080fd5b506100ec6102c5366004611474565b610a0a565b6102d2610ac1565b73ffffffffffffffffffffffffffffffffffffffff81163b610355576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f414441505445525f49535f4e4f545f415f434f4e54524143540000000000000060448201526064015b60405180910390fd5b60038383604051610367929190611496565b9081526040519081900360200190205460ff16156103e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f414441505445525f52454d4f5645440000000000000000000000000000000000604482015260640161034c565b600073ffffffffffffffffffffffffffffffffffffffff166002848460405161040b929190611496565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1614610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f414441505445525f455849535453000000000000000000000000000000000000604482015260640161034c565b816104ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f494e56414c49445f414441505445445f49440000000000000000000000000000604482015260640161034c565b8060028484604051610512929190611496565b908152604051908190036020018120805473ffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffffffffffff0000000000000000000000000000000000000000909316929092179091557ff9648cbc19f288e0f271f7e95311238912bf1ea8225e636a13bb1d259126002190610598908590859085906114ef565b60405180910390a1505050565b6105ad610b42565b6105b5610bc7565b6000600287876040516105c9929190611496565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff16905080610658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f414441505445525f4e4f545f464f554e44000000000000000000000000000000604482015260640161034c565b73ffffffffffffffffffffffffffffffffffffffff8516156106bb576106b673ffffffffffffffffffffffffffffffffffffffff8616337f000000000000000000000000a5c1ce365ddb5a91ff466774ec4bdf8f97cb9f5587610c3a565b610724565b833414610724576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4d534756414c55455f414d4f554e545f4d49534d415443480000000000000000604482015260640161034c565b6040805133602082015273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a5c1ce365ddb5a91ff466774ec4bdf8f97cb9f551691634cfee32691349185917fab138240000000000000000000000000000000000000000000000000000000009101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526107d392918a908a9060200161154d565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016107ff9291906115ee565b6000604051808303818588803b15801561081857600080fd5b505af115801561082c573d6000803e3d6000fd5b50505050505061083b60018055565b505050505050565b61084b610ac1565b600073ffffffffffffffffffffffffffffffffffffffff1660028383604051610875929190611496565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610902576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f414441505445525f444f45535f4e4f545f455849535400000000000000000000604482015260640161034c565b60028282604051610914929190611496565b90815260405190819003602001812080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560019060039061095c9085908590611496565b90815260405190819003602001812080549215157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909316929092179091557fb00061f7cc154fc23eb34671ab724fc7eb7b806abae871abae8f1eafce972135906109ca908490849061161d565b60405180910390a15050565b6109de610ac1565b6109e86000610cd5565b565b6109f2610ac1565b6109e8610d4a565b610a02610ac1565b6109e8610de3565b610a12610ac1565b73ffffffffffffffffffffffffffffffffffffffff8116610ab5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161034c565b610abe81610cd5565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b60005474010000000000000000000000000000000000000000900460ff16156109e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161034c565b600260015403610c33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161034c565b6002600155565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052610ccf908590610e3a565b50505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610d52610b42565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610db93390565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b610deb610f4e565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33610db9565b6000610e9c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610fd29092919063ffffffff16565b9050805160001480610ebd575080806020019051810190610ebd9190611631565b610f49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161034c565b505050565b60005474010000000000000000000000000000000000000000900460ff166109e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161034c565b6060610fe18484600085610fe9565b949350505050565b60608247101561107b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161034c565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516110a49190611653565b60006040518083038185875af1925050503d80600081146110e1576040519150601f19603f3d011682016040523d82523d6000602084013e6110e6565b606091505b50915091506110f787838387611102565b979650505050505050565b606083156111985782516000036111915773ffffffffffffffffffffffffffffffffffffffff85163b611191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161034c565b5081610fe1565b610fe183838151156111ad5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161034c919061166f565b60008083601f8401126111f357600080fd5b50813567ffffffffffffffff81111561120b57600080fd5b60208301915083602082850101111561122357600080fd5b9250929050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461124e57600080fd5b919050565b60008060006040848603121561126857600080fd5b833567ffffffffffffffff81111561127f57600080fd5b61128b868287016111e1565b909450925061129e90506020850161122a565b90509250925092565b600080600080600080608087890312156112c057600080fd5b863567ffffffffffffffff808211156112d857600080fd5b6112e48a838b016111e1565b90985096508691506112f860208a0161122a565b955060408901359450606089013591508082111561131557600080fd5b5061132289828a016111e1565b979a9699509497509295939492505050565b6000806020838503121561134757600080fd5b823567ffffffffffffffff81111561135e57600080fd5b61136a858286016111e1565b90969095509350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156113b757600080fd5b813567ffffffffffffffff808211156113cf57600080fd5b818401915084601f8301126113e357600080fd5b8135818111156113f5576113f5611376565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561143b5761143b611376565b8160405282815287602084870101111561145457600080fd5b826020860160208301376000928101602001929092525095945050505050565b60006020828403121561148657600080fd5b61148f8261122a565b9392505050565b8183823760009101908152919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6040815260006115036040830185876114a6565b905073ffffffffffffffffffffffffffffffffffffffff83166020830152949350505050565b60005b8381101561154457818101518382015260200161152c565b50506000910152565b7fffffffff000000000000000000000000000000000000000000000000000000008516815260008451611587816004850160208901611529565b820183856004830137600093016004019283525090949350505050565b600081518084526115bc816020860160208601611529565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610fe160408301846115a4565b602081526000610fe16020830184866114a6565b60006020828403121561164357600080fd5b8151801515811461148f57600080fd5b60008251611665818460208701611529565b9190910192915050565b60208152600061148f60208301846115a456fea264697066735822122072506545287e639e706b5ac924fb1dc17154f9ae1d31264c54b4f71cdcd9ef6a64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c3a624e7dba0bf887cb945bc6667bd6abee388d2
-----Decoded View---------------
Arg [0] : _owner (address): 0xC3A624e7DbA0BF887Cb945bC6667BD6aBEE388D2
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c3a624e7dba0bf887cb945bc6667bd6abee388d2
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$1,238.64
Net Worth in ETH
0.631777
Token Allocations
ETH
97.15%
USDT0
2.42%
AVAX
0.37%
Others
0.06%
Multichain Portfolio | 34 Chains
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.
${zeroWidthWarningMessage} Check the actual text at BaseName.
`;
}
const ensOnL2NoteHtml = ensOnL2Note != "" ? `Additional Info
Full Name:
${ensNameForkIconSrc}
Note:
- Name tag is displayed due to forward and reverse resolution. Find out more.
- A Domain Name is not necessarily held by a person popularly associated with the name. ${ensOnL2NoteHtml}
Other names resolving to this address:
${listOtherENSNames}
${moreOtherENSNames}
`;
return result;
}
// ===== UD name tag
const displayUDName = '';
const primaryUDName = '';
const showUDPublicNote = 'false';
let otherUDNamesHtml = "";
function initUDNamePopOver() {
//required to allow bootstrap popover to support table
$.fn.popover.Constructor.Default.allowList.table = [];
$.fn.popover.Constructor.Default.allowList.tr = [];
$.fn.popover.Constructor.Default.allowList.td = [];
$.fn.popover.Constructor.Default.allowList.th = [];
$.fn.popover.Constructor.Default.allowList.div = [];
$.fn.popover.Constructor.Default.allowList.tbody = [];
$.fn.popover.Constructor.Default.allowList.thead = [];
//allowList my inline styling for bootstrap
$.fn.popover.Constructor.Default.allowList['*'].push('style')
let unicodeWarningHtml = "";
if ($("#hdnIsUDContainUnicodeChars").val() == "true") {
unicodeWarningHtml =
`
${unicodeWarningMessage} Check the actual text at Unstoppable Domains.
`;
}
let zeroWidthWarningHtml = "";
if ($("#hdnIsUDContainZeroWidthChars").val() == "true") {
zeroWidthWarningHtml =
`
${unicodeWarningMessage} Check the actual text at Unstoppable Domains.
`;
}
const contentHtml =
`Additional Info
Full Name:
Note:
- Name tag is displayed due to forward and reverse resolution. Find out more
- A Domain Name is not necessarily held by a person popularly associated with the name.
Other names resolving to this address:
${listOtherUDNames}
${moreOtherUDNames}
`;
return result;
}
// ===== end UD name tag
const tooltipForTokenHolding = 'More than 201 tokens found, listing and displaying the total balance of the first 100 tokens only. Click on the Coins icon to see the full list and balance.';
var adjustPosition = 0;
$(document).ready(function () {
switchAmountToValue(document.getElementById("headerAmountValue"), 'Value (USD)', 'Amount', true);
switchAmountToValue(document.getElementById("headerIntAmountValue"), 'Value (USD)', 'Amount', true);
switchMethodColumn(document.getElementById("headerMethod"), 'Method', 'Action', true);
onDocumentReady();
$("[rel='tooltip']").tooltip();
$("[data-bs-toggle-second='tooltip']").tooltip({ trigger: 'hover' });
$("[rel='tooltipEns']").each(function () {
$(this).tooltip({ title: $(this).attr("tooltip-title") });
});
if (hash != '') {
activaTab(hash);
};
onAddressDocReady();
// Note: this is causing "Copied" tooltip not showing when copy button is clicked in V3, and seems like not applicable to v3, comment out first in case there is issue
//$('[data-bs-toggle="tooltip"]').click(function () {
// $('[data-bs-toggle="tooltip"]').tooltip("hide");
//});
document.getElementById("copyaddressbutton").classList.remove("disabled");
if ($("#txtSearchContract").length) {
initialiseKeyupOnDocReady();
}
if (!!$('#ensName')[0]) {
initEnsNamePopOver();
}
if (!!$("#udName")[0]) {
initUDNamePopOver();
}
handleToggle();
if (window.matchMedia("(max-width: 767px)").matches) {
// Mobile
adjustPosition = 90;
} else {
// Others
adjustPosition = 50;
}
if (tooltipForTokenHolding) {
const dropdownMenuBalance = document.getElementById("dropdownMenuBalance");
if (dropdownMenuBalance) {
const dropdownWrapper = dropdownMenuBalance.closest(".dropdown");
if (dropdownWrapper) {
dropdownWrapper.setAttribute("title", tooltipForTokenHolding);
new bootstrap.Tooltip(dropdownWrapper);
}
}
}
});
function displayAudit() {
$('html, body').animate({
scrollTop: $("#auditReportId").offset().top - adjustPosition
});
}
var cThemeMode = getCookie('displaymode');
function handleToggle() {
var className = document.getElementsByClassName('editor');
var classNameCount = className.length;
for (var j = 0; j t.innerWidth()) {
if (mb + d > tb) {
t.css('padding-bottom', ((mb + d) - tb));
}
}
else {
t.css('overflow', 'visible');
}
}).on('hidden.bs.dropdown', function () {
$(this).css({ 'padding-bottom': '', 'overflow': '' });
});
var btn_ERC20_sort = {
count: 0,
reminder_count: 2,
list: [],
default_list: [],
ERC20_sort_start: function (count) {
if (document.getElementsByClassName('list-custom-divider-ERC20')[0]) {
var self = this
if (count != undefined) {
self.count = count
}
var before_el = document.getElementsByClassName('list-custom-divider-ERC20')[0]
var parent_el = before_el.parentNode
var element_selector = parent_el.querySelectorAll(".list-custom-ERC20");
if (self.list.length == 0) {
element_selector.forEach(function (e) {
self.list.push(e);
self.default_list.push(e);
});
}
$(".list-custom-ERC20").remove()
var type = self.count % self.reminder_count
self.sortList(type, parent_el, before_el);
self.count++
}
},
sortList: function (type, parent_el, before_el) {
var self = this
var sorted_list = []
var icon_el = $(before_el).find('button').find('i')
switch (type) {
case 1:
icon_el.attr("class", "fad fa-sort-up")
sorted_list = self.sortUsdAsc()
break;
default:
icon_el.attr("class", "fad fa-sort-down")
sorted_list = self.sortUsdDesc()
}
for (var i = sorted_list.length - 1; i >= 0; i--) {
before_el.insertAdjacentElement('afterend', sorted_list[i])
}
},
sortUsdAsc: function () {
var self = this
var sort_list = self.list
sort_list.sort(function (a, b) {
var target_a_value = self.formatCurrencyToNumber(a.querySelector('.list-usd-value').textContent.trim() || -1);
var target_b_value = self.formatCurrencyToNumber(b.querySelector('.list-usd-value').textContent.trim() || -1);
if (target_a_value == -1 || target_b_value == -1) {
return 1;
}
if (target_a_value target_b_value) {
return 1;
}
return 0
});
return sort_list
},
sortUsdDesc: function () {
var self = this
var sort_list = self.list
sort_list.sort(function (a, b) {
var target_a_value = self.formatCurrencyToNumber(a.querySelector('.list-usd-value').textContent.trim() || -1);
var target_b_value = self.formatCurrencyToNumber(b.querySelector('.list-usd-value').textContent.trim() || -1);
if (target_a_value target_b_value) {
return -1;
}
return 0
});
return sort_list
},
formatCurrencyToNumber: function (strCurrency) {
if (typeof strCurrency == "number")
return strCurrency
else
return Number(strCurrency.replace(/[^0-9.-]+/g, ""));
},
}
function hrefTokenHolding() {
var location = "/tokenholdings?a=0xa20ecbc821fb54064aa7b5c6ac81173b8b34df71"
var queryString = $("input.form-control.form-control-xs.search.mb-3")[0].value
if (queryString) {
location += "&q=" + queryString
}
window.location.href = location
}
$(document).ready(function () {
$("#btn_ERC20_sort").on("click", function (event) {
event.preventDefault();
setTimeout(function () {
btn_ERC20_sort.ERC20_sort_start()
}, 10)
})
btn_ERC20_sort.ERC20_sort_start()
var mainAddress = $("#hdnAddress").val();
// user search for method filters
var searchFuncTimeOut;
$("#ContentPlaceHolder1_inputMethodName").on("keyup", function ($event) {
if (searchFuncTimeOut) {
clearTimeout(searchFuncTimeOut)
}
var searchTerm = $(this).val();
searchFuncTimeOut = setTimeout(function () {
searchFunctions( searchTerm);
}, 350);
});
var isSearchFunctions = false;
$("#dropdownMethod").on("click", function (e) {
if (isSearchFunctions === false) {
searchFunctions('');
isSearchFunctions = true;
}
});
const litDefaultMethodFilterHtml = '';
function searchFunctions(searchTerm) {
if (searchTerm === '' || searchTerm.length > 3) {
const curPath = encodeURIComponent(window.location.search);
$.ajax({
type: 'Get',
url: `/functionSearchHandler.ashx?ca=${mainAddress}&func=${searchTerm ?? ''}&curPath=${curPath}`,
success: function (response) {
$("#searchFunctionResult").html('');
if (response && response.length > 0) {
for (var i = 0; i
${response[i].name}
${response[i].methodId}
`
);
}
$("[data-bs-toggle='tooltip']").tooltip();
}
else {
$("#searchFunctionResult").append(
`