Latest 25 from a total of 13,393 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw Gas Tok... | 22816738 | 212 days ago | IN | 0 ETH | 0.00010029 | ||||
| Receive Message | 22778293 | 217 days ago | IN | 0 ETH | 0.00103302 | ||||
| Receive Message | 22768722 | 218 days ago | IN | 0 ETH | 0.00206275 | ||||
| Receive Message | 22730022 | 224 days ago | IN | 0 ETH | 0.00007901 | ||||
| Receive Message | 22725150 | 224 days ago | IN | 0 ETH | 0.00124338 | ||||
| Receive Message | 22724303 | 224 days ago | IN | 0 ETH | 0.00027642 | ||||
| Receive Message | 22723529 | 225 days ago | IN | 0 ETH | 0.00027218 | ||||
| Receive Message | 22723186 | 225 days ago | IN | 0 ETH | 0.00039134 | ||||
| Receive Message | 22722626 | 225 days ago | IN | 0 ETH | 0.00006641 | ||||
| Receive Message | 22722398 | 225 days ago | IN | 0 ETH | 0.00008423 | ||||
| Receive Message | 22722079 | 225 days ago | IN | 0 ETH | 0.00006585 | ||||
| Receive Message | 22721172 | 225 days ago | IN | 0 ETH | 0.00008901 | ||||
| Receive Message | 22720981 | 225 days ago | IN | 0 ETH | 0.00010585 | ||||
| Receive Message | 22719648 | 225 days ago | IN | 0 ETH | 0.00036386 | ||||
| Receive Message | 22719201 | 225 days ago | IN | 0 ETH | 0.00067122 | ||||
| Receive Message | 22718925 | 225 days ago | IN | 0 ETH | 0.00049185 | ||||
| Receive Message | 22718915 | 225 days ago | IN | 0 ETH | 0.00047631 | ||||
| Receive Message | 22718860 | 225 days ago | IN | 0 ETH | 0.00061451 | ||||
| Receive Message | 22718696 | 225 days ago | IN | 0 ETH | 0.00055532 | ||||
| Receive Message | 22718587 | 225 days ago | IN | 0 ETH | 0.00060614 | ||||
| Receive Message | 22718438 | 225 days ago | IN | 0 ETH | 0.0004818 | ||||
| Receive Message | 22718065 | 225 days ago | IN | 0 ETH | 0.00054078 | ||||
| Receive Message | 22717680 | 225 days ago | IN | 0 ETH | 0.00070596 | ||||
| Receive Message | 22717453 | 225 days ago | IN | 0 ETH | 0.0005842 | ||||
| Receive Message | 22717355 | 225 days ago | IN | 0 ETH | 0.0006191 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 22816738 | 212 days ago | 0.07687 ETH | ||||
| Send Message | 22748718 | 221 days ago | 0.00059409 ETH | ||||
| Send Message | 22748559 | 221 days ago | 0.00059409 ETH | ||||
| Send Message | 22729805 | 224 days ago | 0.00056371 ETH | ||||
| Send Message | 22728947 | 224 days ago | 0.00056371 ETH | ||||
| Send Message | 22728193 | 224 days ago | 0.00056371 ETH | ||||
| Send Message | 22728085 | 224 days ago | 0.00056371 ETH | ||||
| Send Message | 22725324 | 224 days ago | 0.00056371 ETH | ||||
| Send Message | 22725109 | 224 days ago | 0.00010262 ETH | ||||
| Send Message | 22725076 | 224 days ago | 0.00056371 ETH | ||||
| Send Message | 22724833 | 224 days ago | 0.00001371 ETH | ||||
| Send Message | 22724494 | 224 days ago | 0.00056371 ETH | ||||
| Send Message | 22723646 | 225 days ago | 0.00056371 ETH | ||||
| Send Message | 22722681 | 225 days ago | 0.00056371 ETH | ||||
| Send Message | 22722363 | 225 days ago | 0.00056371 ETH | ||||
| Send Message | 22722204 | 225 days ago | 0.00016063 ETH | ||||
| Send Message | 22720976 | 225 days ago | 0.00145699 ETH | ||||
| Send Message | 22720153 | 225 days ago | 0.00053947 ETH | ||||
| Send Message | 22719312 | 225 days ago | 0.00055642 ETH | ||||
| Send Message | 22719294 | 225 days ago | 0.00055642 ETH | ||||
| Send Message | 22715891 | 226 days ago | 0.00015613 ETH | ||||
| Send Message | 22715536 | 226 days ago | 0.00055642 ETH | ||||
| Send Message | 22715459 | 226 days ago | 0.00055642 ETH | ||||
| Send Message | 22715360 | 226 days ago | 0.00055642 ETH | ||||
| Send Message | 22715203 | 226 days ago | 0.00055642 ETH |
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
WormholeMessenger
Compiler Version
v0.8.18+commit.87f61d96
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IGasOracle} from "./interfaces/IGasOracle.sol";
import {IMessenger} from "./interfaces/IMessenger.sol";
import {IWormhole} from "./interfaces/IWormhole.sol";
import {GasUsage} from "./GasUsage.sol";
import {GasOracle} from "./GasOracle.sol";
import {HashUtils} from "./libraries/HashUtils.sol";
contract WormholeMessenger is Ownable, GasUsage {
using HashUtils for bytes32;
IWormhole private immutable wormhole;
uint public immutable chainId;
bytes32 public otherChainIds;
uint32 private nonce;
uint8 private commitmentLevel;
mapping(uint16 chainId => bytes32 wormholeMessengerAddress) private otherWormholeMessengers;
mapping(bytes32 messageHash => uint isReceived) public receivedMessages;
mapping(bytes32 messageHash => uint isSent) public sentMessages;
event MessageSent(bytes32 indexed message, uint64 sequence);
event MessageReceived(bytes32 indexed message, uint64 sequence);
event Received(address, uint);
constructor(
uint chainId_,
bytes32 otherChainIds_,
IWormhole wormhole_,
uint8 commitmentLevel_,
IGasOracle gasOracle_
) GasUsage(gasOracle_) {
chainId = chainId_;
otherChainIds = otherChainIds_;
wormhole = wormhole_;
commitmentLevel = commitmentLevel_;
}
function sendMessage(bytes32 message) external payable {
require(uint8(message[0]) == chainId, "WormholeMessenger: wrong chainId");
require(otherChainIds[uint8(message[1])] != 0, "Messenger: wrong destination");
bytes32 messageWithSender = message.hashWithSenderAddress(msg.sender);
uint32 nonce_ = nonce;
uint64 sequence = wormhole.publishMessage(nonce_, abi.encodePacked(messageWithSender), commitmentLevel);
unchecked {
nonce = nonce_ + 1;
}
require(sentMessages[messageWithSender] == 0, "WormholeMessenger: has message");
sentMessages[messageWithSender] = 1;
emit MessageSent(messageWithSender, sequence);
}
function receiveMessage(bytes memory encodedMsg) external {
(IWormhole.VM memory vm, bool valid, string memory reason) = wormhole.parseAndVerifyVM(encodedMsg);
require(valid, reason);
require(vm.payload.length == 32, "WormholeMessenger: wrong length");
bytes32 messageWithSender = bytes32(vm.payload);
require(uint8(messageWithSender[1]) == chainId, "WormholeMessenger: wrong chainId");
require(otherWormholeMessengers[vm.emitterChainId] == vm.emitterAddress, "WormholeMessenger: wrong emitter");
receivedMessages[messageWithSender] = 1;
emit MessageReceived(messageWithSender, vm.sequence);
}
function setCommitmentLevel(uint8 value) external onlyOwner {
commitmentLevel = value;
}
function setOtherChainIds(bytes32 value) external onlyOwner {
otherChainIds = value;
}
function registerWormholeMessenger(uint16 chainId_, bytes32 address_) external onlyOwner {
otherWormholeMessengers[chainId_] = address_;
}
function withdrawGasTokens(uint amount) external onlyOwner {
payable(msg.sender).transfer(amount);
}
fallback() external payable {
revert("Unsupported");
}
receive() external payable {
emit Received(msg.sender, msg.value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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.8.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-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;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
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));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
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");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
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");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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
* ====
*
* [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://diligence.consensys.net/posts/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.5.11/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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.2._
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v2.5._
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.2._
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v2.5._
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v2.5._
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v2.5._
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v2.5._
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*
* _Available since v3.0._
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IBridge, MessengerProtocol} from "./interfaces/IBridge.sol";
import {Router} from "./Router.sol";
import {Messenger} from "./Messenger.sol";
import {MessengerGateway} from "./MessengerGateway.sol";
import {IGasOracle} from "./interfaces/IGasOracle.sol";
import {GasUsage} from "./GasUsage.sol";
import {WormholeMessenger} from "./WormholeMessenger.sol";
import {HashUtils} from "./libraries/HashUtils.sol";
/**
* @title Bridge
* @dev A contract with functions to facilitate bridging tokens across different blockchains.
*/
contract Bridge is GasUsage, Router, MessengerGateway, IBridge {
using SafeERC20 for IERC20;
using HashUtils for bytes32;
uint public immutable override chainId;
mapping(bytes32 messageHash => uint isProcessed) public override processedMessages;
mapping(bytes32 messageHash => uint isSent) public override sentMessages;
// Info about bridges on other chains
mapping(uint chainId => bytes32 bridgeAddress) public override otherBridges;
// Info about tokens on other chains
mapping(uint chainId => mapping(bytes32 tokenAddress => bool isSupported)) public override otherBridgeTokens;
/**
* @dev Emitted when tokens are sent on the source blockchain.
*/
event TokensSent(
uint amount,
bytes32 recipient,
uint destinationChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger
);
/**
* @dev Emitted when the tokens are received on the destination blockchain.
*/
event TokensReceived(uint amount, bytes32 recipient, uint nonce, MessengerProtocol messenger, bytes32 message);
/**
* @dev Emitted when this contract receives the bridging fee.
*/
event ReceiveFee(uint bridgeTransactionCost, uint messageTransactionCost);
/**
* @dev Emitted when this contract charged the sender with the tokens for the bridging fee.
*/
event BridgingFeeFromTokens(uint gas);
/**
* @dev Emitted when the contract receives native tokens (e.g. Ether on the Ethereum network) from the admin to
* supply the gas for bridging.
*/
event Received(address sender, uint amount);
constructor(
uint chainId_,
uint chainPrecision_,
Messenger allbridgeMessenger_,
WormholeMessenger wormholeMessenger_,
IGasOracle gasOracle_
) Router(chainPrecision_) MessengerGateway(allbridgeMessenger_, wormholeMessenger_) GasUsage(gasOracle_) {
chainId = chainId_;
}
/**
* @notice Initiates a swap and bridge process of a given token for a token on another blockchain.
* @dev This function is used to initiate a cross-chain transfer. The specified amount of token is first transferred
* to the pool on the current chain, and then an event `TokensSent` is emitted to signal that tokens have been sent
* on the source chain. See the function `receiveTokens`.
* The bridging fee required for the cross-chain transfer can be paid in two ways:
* - by sending the required amount of native gas token along with the transaction
* (See `getTransactionCost` in the `GasUsage` contract and `getMessageCost` in the `MessengerGateway` contract).
* - by setting the parameter `feeTokenAmount` with the bridging fee amount in the source tokens
* (See the function `getBridgingCostInTokens`).
* @param token The token to be swapped.
* @param amount The amount of tokens to be swapped (including `feeTokenAmount`).
* @param destinationChainId The ID of the destination chain.
* @param receiveToken The token to receive in exchange for the swapped token.
* @param nonce An identifier that is used to ensure that each transfer is unique and can only be processed once.
* @param messenger The chosen way of delivering the message across chains.
* @param feeTokenAmount The amount of tokens to be deducted from the transferred amount as a bridging fee.
*
*/
function swapAndBridge(
bytes32 token,
uint amount,
bytes32 recipient,
uint destinationChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger,
uint feeTokenAmount
) external payable override whenCanSwap {
require(amount > feeTokenAmount, "Bridge: amount too low for fee");
require(recipient != 0, "Bridge: bridge to the zero address");
uint bridgingFee = msg.value + _convertBridgingFeeInTokensToNativeToken(msg.sender, token, feeTokenAmount);
uint amountAfterFee = amount - feeTokenAmount;
uint vUsdAmount = _sendAndSwapToVUsd(token, msg.sender, amountAfterFee);
_sendTokens(vUsdAmount, recipient, destinationChainId, receiveToken, nonce, messenger, bridgingFee);
}
/**
* @notice Completes the bridging process by sending the tokens on the destination chain to the recipient.
* @dev This function is called only after a bridging has been initiated by a user
* through the `swapAndBridge` function on the source chain.
* @param amount The amount of tokens being bridged.
* @param recipient The recipient address for the bridged tokens.
* @param sourceChainId The ID of the source chain.
* @param receiveToken The address of the token being received.
* @param nonce A unique nonce for the bridging transaction.
* @param messenger The protocol used to relay the message.
* @param receiveAmountMin The minimum amount of receiveToken required to be received.
*/
function receiveTokens(
uint amount,
bytes32 recipient,
uint sourceChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger,
uint receiveAmountMin
) external payable override whenCanSwap {
require(otherBridges[sourceChainId] != bytes32(0), "Bridge: source not registered");
bytes32 messageWithSender = this
.hashMessage(amount, recipient, sourceChainId, chainId, receiveToken, nonce, messenger)
.hashWithSender(otherBridges[sourceChainId]);
require(processedMessages[messageWithSender] == 0, "Bridge: message processed");
// mark the transfer as received on the destination chain
processedMessages[messageWithSender] = 1;
// check if tokens has been sent on the source chain
require(this.hasReceivedMessage(messageWithSender, messenger), "Bridge: no message");
uint receiveAmount = _receiveAndSwapFromVUsd(
receiveToken,
address(uint160(uint(recipient))),
amount,
receiveAmountMin
);
// pass extra gas to the recipient
if (msg.value > 0) {
// ignore if passing extra gas failed
// solc-ignore-next-line unused-call-retval
payable(address(uint160(uint(recipient)))).call{value: msg.value}("");
}
emit TokensReceived(receiveAmount, recipient, nonce, messenger, messageWithSender);
}
/**
* @notice Allows the admin to add new supported chain destination.
* @dev Registers the address of a bridge deployed on a different chain.
* @param chainId_ The chain ID of the bridge to register.
* @param bridgeAddress The address of the bridge contract to register.
*/
function registerBridge(uint chainId_, bytes32 bridgeAddress) external override onlyOwner {
otherBridges[chainId_] = bridgeAddress;
}
/**
* @notice Allows the admin to add a new supported destination token.
* @dev Adds the address of a token on another chain to the list of supported tokens for the specified chain.
* @param chainId_ The chain ID where the token is deployed.
* @param tokenAddress The address of the token to add as a supported token.
*/
function addBridgeToken(uint chainId_, bytes32 tokenAddress) external override onlyOwner {
otherBridgeTokens[chainId_][tokenAddress] = true;
}
/**
* @notice Allows the admin to remove support for a destination token.
* @dev Removes the address of a token on another chain from the list of supported tokens for the specified chain.
* @param chainId_ The chain ID where the token is deployed.
* @param tokenAddress The address of the token to remove from the list of supported tokens.
*/
function removeBridgeToken(uint chainId_, bytes32 tokenAddress) external override onlyOwner {
otherBridgeTokens[chainId_][tokenAddress] = false;
}
/**
* @notice Allows the admin to withdraw the bridging fee collected in native tokens.
*/
function withdrawGasTokens(uint amount) external override onlyOwner {
payable(msg.sender).transfer(amount);
}
/**
* @notice Allows the admin to withdraw the bridging fee collected in tokens.
* @param token The address of the token contract.
*/
function withdrawBridgingFeeInTokens(IERC20 token) external onlyOwner {
uint toWithdraw = token.balanceOf(address(this));
if (toWithdraw > 0) {
token.safeTransfer(msg.sender, toWithdraw);
}
}
/**
* @dev Calculates the amount of bridging fee nominated in a given token, which includes:
* - the gas cost of making the receive transaction on the destination chain,
* - the gas cost of sending the message to the destination chain using the specified messenger protocol.
* @param destinationChainId The ID of the destination chain.
* @param messenger The chosen way of delivering the message across chains.
* @param tokenAddress The address of the token contract on the source chain.
* @return The total price of bridging, with the precision according to the token's `decimals()` value.
*/
function getBridgingCostInTokens(
uint destinationChainId,
MessengerProtocol messenger,
address tokenAddress
) external view override returns (uint) {
return
gasOracle.getTransactionGasCostInUSD(
destinationChainId,
gasUsage[destinationChainId] + getMessageGasUsage(destinationChainId, messenger)
) / fromGasOracleScalingFactor[tokenAddress];
}
/**
* @dev Produces a hash of transfer parameters, which is used as a message to the bridge on the destination chain
* to notify that the tokens on the source chain has been sent.
* @param amount The amount of tokens being transferred.
* @param recipient The address of the recipient on the destination chain.
* @param sourceChainId The ID of the source chain.
* @param destinationChainId The ID of the destination chain.
* @param receiveToken The token being received on the destination chain.
* @param nonce The unique nonce.
* @param messenger The chosen way of delivering the message across chains.
*/
function hashMessage(
uint amount,
bytes32 recipient,
uint sourceChainId,
uint destinationChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger
) external pure override returns (bytes32) {
return
keccak256(abi.encodePacked(amount, recipient, sourceChainId, receiveToken, nonce, messenger))
.replaceChainBytes(uint8(sourceChainId), uint8(destinationChainId));
}
function _sendTokens(
uint amount,
bytes32 recipient,
uint destinationChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger,
uint bridgingFee
) internal {
require(destinationChainId != chainId, "Bridge: wrong destination chain");
require(otherBridgeTokens[destinationChainId][receiveToken], "Bridge: unknown chain or token");
bytes32 message = this.hashMessage(
amount,
recipient,
chainId,
destinationChainId,
receiveToken,
nonce,
messenger
);
require(sentMessages[message] == 0, "Bridge: tokens already sent");
// mark the transfer as sent on the source chain
sentMessages[message] = 1;
uint bridgeTransactionCost = this.getTransactionCost(destinationChainId);
uint messageTransactionCost = _sendMessage(message, messenger);
emit ReceiveFee(bridgeTransactionCost, messageTransactionCost);
unchecked {
require(bridgingFee >= bridgeTransactionCost + messageTransactionCost, "Bridge: not enough fee");
}
emit TokensSent(amount, recipient, destinationChainId, receiveToken, nonce, messenger);
}
/**
* @dev Charges the bridging fee in tokens and calculates the amount of native tokens that correspond
* to the charged fee using the current exchange rate.
* @param user The address of the user who is paying the bridging fee
* @param tokenAddress The address of the token used to pay the bridging fee
* @param feeTokenAmount The amount of tokens to pay as the bridging fee
* @return bridging fee amount in the native tokens (e.g. in wei for Ethereum)
*/
function _convertBridgingFeeInTokensToNativeToken(
address user,
bytes32 tokenAddress,
uint feeTokenAmount
) internal returns (uint) {
if (feeTokenAmount == 0) return 0;
address tokenAddress_ = address(uint160(uint(tokenAddress)));
IERC20 token = IERC20(tokenAddress_);
token.safeTransferFrom(user, address(this), feeTokenAmount);
uint fee = (bridgingFeeConversionScalingFactor[tokenAddress_] * feeTokenAmount) / gasOracle.price(chainId);
emit BridgingFeeFromTokens(fee);
return fee;
}
fallback() external payable {
revert("Unsupported");
}
receive() external payable {
emit Received(msg.sender, msg.value);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IGasOracle} from "./interfaces/IGasOracle.sol";
/**
* @title GasOracle
* @dev A contract that provides gas price and native token USD price data on other blockchains.
*/
contract GasOracle is Ownable, IGasOracle {
struct ChainData {
// price of the chain's native token in USD
uint128 price;
// price of a gas unit in the chain's native token with precision according to the const ORACLE_PRECISION
uint128 gasPrice;
}
uint private constant ORACLE_PRECISION = 18;
uint private constant ORACLE_SCALING_FACTOR = 10 ** ORACLE_PRECISION;
// number to divide by to change precision from gas oracle price precision to chain precision
uint private immutable fromOracleToChainScalingFactor;
mapping(uint chainId => ChainData) public override chainData;
// current chain ID
uint public immutable override chainId;
constructor(uint chainId_, uint chainPrecision) {
chainId = chainId_;
fromOracleToChainScalingFactor = 10 ** (ORACLE_PRECISION - chainPrecision);
}
/**
* @notice Sets the chain data for a given chain ID.
* @param chainId_ The ID of the given chain to set data for.
* @param price_ The price of the given chain's native token in USD.
* @param gasPrice The price of a gas unit in the given chain's native token (with precision according to the const
* `ORACLE_PRECISION`).
*/
function setChainData(uint chainId_, uint128 price_, uint128 gasPrice) external override onlyOwner {
chainData[chainId_].price = price_;
chainData[chainId_].gasPrice = gasPrice;
}
/**
* @notice Sets only the price for a given chain ID.
* @param chainId_ The ID of the given chain to set the price for.
* @param price_ The price of the given chain's native token in USD.
*/
function setPrice(uint chainId_, uint128 price_) external override onlyOwner {
chainData[chainId_].price = price_;
}
/**
* @notice Sets only the gas price for a given chain ID.
* @param chainId_ The ID of the given chain to set the gas price for.
* @param gasPrice The price of a gas unit in the given chain's native token (with precision according to the const
* `ORACLE_PRECISION`).
*/
function setGasPrice(uint chainId_, uint128 gasPrice) external override onlyOwner {
chainData[chainId_].gasPrice = gasPrice;
}
/**
* @notice Calculates the gas cost of a transaction on another chain in the current chain's native token.
* @param otherChainId The ID of the chain for which to get the gas cost.
* @param gasAmount The amount of gas used in a transaction.
* @return The gas cost of a transaction in the current chain's native token
*/
function getTransactionGasCostInNativeToken(
uint otherChainId,
uint gasAmount
) external view override returns (uint) {
return
(chainData[otherChainId].gasPrice * gasAmount * chainData[otherChainId].price) /
chainData[chainId].price /
fromOracleToChainScalingFactor;
}
/**
* @notice Calculates the gas cost of a transaction on another chain in USD.
* @param otherChainId The ID of the chain for which to get the gas cost.
* @param gasAmount The amount of gas used in a transaction.
* @return The gas cost of a transaction in USD with precision of `ORACLE_PRECISION`
*/
function getTransactionGasCostInUSD(uint otherChainId, uint gasAmount) external view override returns (uint) {
return (chainData[otherChainId].gasPrice * gasAmount * chainData[otherChainId].price) / ORACLE_SCALING_FACTOR;
}
/**
* @notice Get the cross-rate between the two chains' native tokens.
* @param otherChainId The ID of the other chain to get the cross-rate for.
*/
function crossRate(uint otherChainId) external view override returns (uint) {
return (chainData[otherChainId].price * ORACLE_SCALING_FACTOR) / chainData[chainId].price;
}
/**
* @notice Get the price of a given chain's native token in USD.
* @param chainId_ The ID of the given chain to get the price.
* @return the price of the given chain's native token in USD with precision of const ORACLE_PRECISION
*/
function price(uint chainId_) external view override returns (uint) {
return chainData[chainId_].price;
}
fallback() external payable {
revert("Unsupported");
}
receive() external payable {
revert("Unsupported");
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IGasOracle} from "./interfaces/IGasOracle.sol";
/**
* @dev Contract module which allows children to store typical gas usage of a certain transaction on another chain.
*/
abstract contract GasUsage is Ownable {
IGasOracle internal gasOracle;
mapping(uint chainId => uint amount) public gasUsage;
constructor(IGasOracle gasOracle_) {
gasOracle = gasOracle_;
}
/**
* @dev Sets the amount of gas used for a transaction on a given chain.
* @param chainId The ID of the chain.
* @param gasAmount The amount of gas used on the chain.
*/
function setGasUsage(uint chainId, uint gasAmount) external onlyOwner {
gasUsage[chainId] = gasAmount;
}
/**
* @dev Sets the Gas Oracle contract address.
* @param gasOracle_ The address of the Gas Oracle contract.
*/
function setGasOracle(IGasOracle gasOracle_) external onlyOwner {
gasOracle = gasOracle_;
}
/**
* @notice Get the gas cost of a transaction on another chain in the current chain's native token.
* @param chainId The ID of the chain for which to get the gas cost.
* @return The calculated gas cost of the transaction in the current chain's native token
*/
function getTransactionCost(uint chainId) external view returns (uint) {
unchecked {
return gasOracle.getTransactionGasCostInNativeToken(chainId, gasUsage[chainId]);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
enum MessengerProtocol {
None,
Allbridge,
Wormhole,
LayerZero
}
interface IBridge {
function chainId() external view returns (uint);
function processedMessages(bytes32) external view returns (uint);
function sentMessages(bytes32) external view returns (uint);
function otherBridges(uint) external view returns (bytes32);
function otherBridgeTokens(uint, bytes32) external view returns (bool);
function getBridgingCostInTokens(
uint destinationChainId,
MessengerProtocol messenger,
address tokenAddress
) external view returns (uint);
function hashMessage(
uint amount,
bytes32 recipient,
uint sourceChainId,
uint destinationChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger
) external pure returns (bytes32);
function receiveTokens(
uint amount,
bytes32 recipient,
uint sourceChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger,
uint receiveAmountMin
) external payable;
function withdrawGasTokens(uint amount) external;
function registerBridge(uint chainId, bytes32 bridgeAddress) external;
function addBridgeToken(uint chainId, bytes32 tokenAddress) external;
function removeBridgeToken(uint chainId, bytes32 tokenAddress) external;
function swapAndBridge(
bytes32 token,
uint amount,
bytes32 recipient,
uint destinationChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger,
uint feeTokenAmount
) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
interface IGasOracle {
function chainData(uint chainId) external view returns (uint128 price, uint128 gasPrice);
function chainId() external view returns (uint);
function crossRate(uint otherChainId) external view returns (uint);
function getTransactionGasCostInNativeToken(uint otherChainId, uint256 gasAmount) external view returns (uint);
function getTransactionGasCostInUSD(uint otherChainId, uint256 gasAmount) external view returns (uint);
function price(uint chainId) external view returns (uint);
function setChainData(uint chainId, uint128 price, uint128 gasPrice) external;
function setGasPrice(uint chainId, uint128 gasPrice) external;
function setPrice(uint chainId, uint128 price) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
interface IMessenger {
function sentMessagesBlock(bytes32 message) external view returns (uint);
function receivedMessages(bytes32 message) external view returns (uint);
function sendMessage(bytes32 message) external payable;
function receiveMessage(bytes32 message, uint v1v2, bytes32 r1, bytes32 s1, bytes32 r2, bytes32 s2) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {MessengerProtocol} from "./IBridge.sol";
interface IRouter {
function canSwap() external view returns (uint8);
function swap(uint amount, bytes32 token, bytes32 receiveToken, address recipient, uint receiveAmountMin) external;
}// contracts/Messages.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.18;
interface Structs {
struct Provider {
uint16 chainId;
uint16 governanceChainId;
bytes32 governanceContract;
}
struct GuardianSet {
address[] keys;
uint32 expirationTime;
}
struct Signature {
bytes32 r;
bytes32 s;
uint8 v;
uint8 guardianIndex;
}
struct VM {
uint8 version;
uint32 timestamp;
uint32 nonce;
uint16 emitterChainId;
bytes32 emitterAddress;
uint64 sequence;
uint8 consistencyLevel;
bytes payload;
uint32 guardianSetIndex;
Signature[] signatures;
bytes32 hash;
}
}
interface IWormhole is Structs {
event LogMessagePublished(
address indexed sender,
uint64 sequence,
uint32 nonce,
bytes payload,
uint8 consistencyLevel
);
function publishMessage(
uint32 nonce,
bytes memory payload,
uint8 consistencyLevel
) external payable returns (uint64 sequence);
function parseAndVerifyVM(
bytes calldata encodedVM
) external view returns (Structs.VM memory vm, bool valid, string memory reason);
function verifyVM(Structs.VM memory vm) external view returns (bool valid, string memory reason);
function verifySignatures(
bytes32 hash,
Structs.Signature[] memory signatures,
Structs.GuardianSet memory guardianSet
) external pure returns (bool valid, string memory reason);
function parseVM(bytes memory encodedVM) external pure returns (Structs.VM memory vm);
function getGuardianSet(uint32 index) external view returns (Structs.GuardianSet memory);
function getCurrentGuardianSetIndex() external view returns (uint32);
function getGuardianSetExpiry() external view returns (uint32);
function governanceActionIsConsumed(bytes32 hash) external view returns (bool);
function isInitialized(address impl) external view returns (bool);
function chainId() external view returns (uint16);
function governanceChainId() external view returns (uint16);
function governanceContract() external view returns (bytes32);
function messageFee() external view returns (uint);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
library HashUtils {
function replaceChainBytes(
bytes32 data,
uint8 sourceChainId,
uint8 destinationChainId
) internal pure returns (bytes32 result) {
assembly {
mstore(0x00, data)
mstore8(0x00, sourceChainId)
mstore8(0x01, destinationChainId)
result := mload(0x0)
}
}
function hashWithSender(bytes32 message, bytes32 sender) internal pure returns (bytes32 result) {
assembly {
mstore(0x00, message)
mstore(0x20, sender)
result := or(
and(
message,
0xffff000000000000000000000000000000000000000000000000000000000000 // First 2 bytes
),
and(
keccak256(0x00, 0x40),
0x0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff // Last 30 bytes
)
)
}
}
function hashWithSenderAddress(bytes32 message, address sender) internal pure returns (bytes32 result) {
assembly {
mstore(0x00, message)
mstore(0x20, sender)
result := or(
and(
message,
0xffff000000000000000000000000000000000000000000000000000000000000 // First 2 bytes
),
and(
keccak256(0x00, 0x40),
0x0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff // Last 30 bytes
)
)
}
}
function hashed(bytes32 message) internal pure returns (bytes32 result) {
assembly {
mstore(0x00, message)
result := keccak256(0x00, 0x20)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IGasOracle} from "./interfaces/IGasOracle.sol";
import {IMessenger} from "./interfaces/IMessenger.sol";
import {GasUsage} from "./GasUsage.sol";
import {HashUtils} from "./libraries/HashUtils.sol";
/**
* @dev This contract implements the Allbridge messenger cross-chain communication protocol.
*/
contract Messenger is Ownable, GasUsage, IMessenger {
using HashUtils for bytes32;
// current chain ID
uint public immutable chainId;
// supported destination chain IDs
bytes32 public otherChainIds;
// the primary account that is responsible for validation that a message has been sent on the source chain
address private primaryValidator;
// the secondary accounts that are responsible for validation that a message has been sent on the source chain
mapping(address => bool) private secondaryValidators;
mapping(bytes32 messageHash => uint blockNumber) public override sentMessagesBlock;
mapping(bytes32 messageHash => uint isReceived) public override receivedMessages;
event MessageSent(bytes32 indexed message);
event MessageReceived(bytes32 indexed message);
/**
* @dev Emitted when the contract receives native gas tokens (e.g. Ether on the Ethereum network).
*/
event Received(address, uint);
/**
* @dev Emitted when the mapping of secondary validators is updated.
*/
event SecondaryValidatorsSet(address[] oldValidators, address[] newValidators);
constructor(
uint chainId_,
bytes32 otherChainIds_,
IGasOracle gasOracle_,
address primaryValidator_,
address[] memory validators
) GasUsage(gasOracle_) {
chainId = chainId_;
otherChainIds = otherChainIds_;
primaryValidator = primaryValidator_;
uint length = validators.length;
for (uint index; index < length; ) {
secondaryValidators[validators[index]] = true;
unchecked {
index++;
}
}
}
/**
* @notice Sends a message to another chain.
* @dev Emits a {MessageSent} event, which signals to the off-chain messaging service to invoke the `receiveMessage`
* function on the destination chain to deliver the message.
*
* Requirements:
*
* - the first byte of the message must be the current chain ID.
* - the second byte of the message must be the destination chain ID.
* - the same message cannot be sent second time.
* - messaging fee must be payed. (See `getTransactionCost` of the `GasUsage` contract).
* @param message The message to be sent to the destination chain.
*/
function sendMessage(bytes32 message) external payable override {
require(uint8(message[0]) == chainId, "Messenger: wrong chainId");
require(otherChainIds[uint8(message[1])] != 0, "Messenger: wrong destination");
bytes32 messageWithSender = message.hashWithSenderAddress(msg.sender);
require(sentMessagesBlock[messageWithSender] == 0, "Messenger: has message");
sentMessagesBlock[messageWithSender] = block.number;
require(msg.value >= this.getTransactionCost(uint8(message[1])), "Messenger: not enough fee");
emit MessageSent(messageWithSender);
}
/**
* @notice Delivers a message to the destination chain.
* @dev Emits an {MessageReceived} event indicating the message has been delivered.
*
* Requirements:
*
* - a valid signature of the primary validator.
* - a valid signature of one of the secondary validators.
* - the second byte of the message must be the current chain ID.
*/
function receiveMessage(
bytes32 message,
uint v1v2,
bytes32 r1,
bytes32 s1,
bytes32 r2,
bytes32 s2
) external override {
bytes32 hashedMessage = message.hashed();
require(ecrecover(hashedMessage, uint8(v1v2 >> 8), r1, s1) == primaryValidator, "Messenger: invalid primary");
require(secondaryValidators[ecrecover(hashedMessage, uint8(v1v2), r2, s2)], "Messenger: invalid secondary");
require(uint8(message[1]) == chainId, "Messenger: wrong chainId");
receivedMessages[message] = 1;
emit MessageReceived(message);
}
/**
* @dev Allows the admin to withdraw the messaging fee collected in native gas tokens.
*/
function withdrawGasTokens(uint amount) external onlyOwner {
payable(msg.sender).transfer(amount);
}
/**
* @dev Allows the admin to set the primary validator address.
*/
function setPrimaryValidator(address value) external onlyOwner {
primaryValidator = value;
}
/**
* @dev Allows the admin to set the addresses of secondary validators.
*/
function setSecondaryValidators(address[] memory oldValidators, address[] memory newValidators) external onlyOwner {
uint length = oldValidators.length;
uint index;
for (; index < length; ) {
secondaryValidators[oldValidators[index]] = false;
unchecked {
index++;
}
}
length = newValidators.length;
index = 0;
for (; index < length; ) {
secondaryValidators[newValidators[index]] = true;
unchecked {
index++;
}
}
emit SecondaryValidatorsSet(oldValidators, newValidators);
}
/**
* @dev Allows the admin to update a list of supported destination chain IDs
* @param value Each byte of the `value` parameter represents whether a chain ID with such index is supported
* as a valid message destination.
*/
function setOtherChainIds(bytes32 value) external onlyOwner {
otherChainIds = value;
}
fallback() external payable {
revert("Unsupported");
}
receive() external payable {
emit Received(msg.sender, msg.value);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IGasOracle} from "./interfaces/IGasOracle.sol";
import {Messenger} from "./Messenger.sol";
import {MessengerProtocol} from "./interfaces/IBridge.sol";
import {WormholeMessenger} from "./WormholeMessenger.sol";
/**
* @dev This abstract contract provides functions for cross-chain communication and supports different messaging
* protocols.
*/
abstract contract MessengerGateway is Ownable {
Messenger private allbridgeMessenger;
WormholeMessenger private wormholeMessenger;
constructor(Messenger allbridgeMessenger_, WormholeMessenger wormholeMessenger_) {
allbridgeMessenger = allbridgeMessenger_;
wormholeMessenger = wormholeMessenger_;
}
/**
* @dev Sets the Allbridge Messenger contract address.
* @param allbridgeMessenger_ The address of the Messenger contract.
*/
function setAllbridgeMessenger(Messenger allbridgeMessenger_) external onlyOwner {
allbridgeMessenger = allbridgeMessenger_;
}
/**
* @dev Sets the Wormhole Messenger contract address.
* @param wormholeMessenger_ The address of the WormholeMessenger contract.
*/
function setWormholeMessenger(WormholeMessenger wormholeMessenger_) external onlyOwner {
wormholeMessenger = wormholeMessenger_;
}
/**
* @notice Get the gas cost of a messaging transaction on another chain in the current chain's native token.
* @param chainId The ID of the chain where to send the message.
* @param protocol The messenger used to send the message.
* @return The calculated gas cost of the messaging transaction in the current chain's native token.
*/
function getMessageCost(uint chainId, MessengerProtocol protocol) external view returns (uint) {
if (protocol == MessengerProtocol.Allbridge) {
return allbridgeMessenger.getTransactionCost(chainId);
} else if (protocol == MessengerProtocol.Wormhole) {
return wormholeMessenger.getTransactionCost(chainId);
}
return 0;
}
/**
* @notice Get the amount of gas a messaging transaction uses on a given chain.
* @param chainId The ID of the chain where to send the message.
* @param protocol The messenger used to send the message.
* @return The amount of gas a messaging transaction uses.
*/
function getMessageGasUsage(uint chainId, MessengerProtocol protocol) public view returns (uint) {
if (protocol == MessengerProtocol.Allbridge) {
return allbridgeMessenger.gasUsage(chainId);
} else if (protocol == MessengerProtocol.Wormhole) {
return wormholeMessenger.gasUsage(chainId);
}
return 0;
}
/**
* @notice Checks whether a given message has been received via the specified messenger protocol.
* @param message The message to check.
* @param protocol The messenger used to send the message.
* @return A boolean indicating whether the message has been received.
*/
function hasReceivedMessage(bytes32 message, MessengerProtocol protocol) external view returns (bool) {
if (protocol == MessengerProtocol.Allbridge) {
return allbridgeMessenger.receivedMessages(message) != 0;
} else if (protocol == MessengerProtocol.Wormhole) {
return wormholeMessenger.receivedMessages(message) != 0;
} else {
revert("Not implemented");
}
}
/**
* @notice Checks whether a given message has been sent.
* @param message The message to check.
* @return A boolean indicating whether the message has been sent.
*/
function hasSentMessage(bytes32 message) external view returns (bool) {
return allbridgeMessenger.sentMessagesBlock(message) != 0 || wormholeMessenger.sentMessages(message) != 0;
}
function _sendMessage(bytes32 message, MessengerProtocol protocol) internal returns (uint messageCost) {
if (protocol == MessengerProtocol.Allbridge) {
messageCost = allbridgeMessenger.getTransactionCost(uint8(message[1]));
allbridgeMessenger.sendMessage{value: messageCost}(message);
} else if (protocol == MessengerProtocol.Wormhole) {
messageCost = wormholeMessenger.getTransactionCost(uint8(message[1]));
wormholeMessenger.sendMessage{value: messageCost}(message);
} else {
revert("Not implemented");
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {RewardManager} from "./RewardManager.sol";
/**
* 4AD - D = 4A(x + y) - (D³ / 4xy)
* X - is value of real stable token
* Y - is value of virtual usd
*/
contract Pool is RewardManager {
using SafeERC20 for ERC20;
uint private constant SYSTEM_PRECISION = 3;
int private constant PP = 1e4; // Price Precision
uint private constant MAX_TOKEN_BALANCE = 2 ** 40; // Max possible token balance
/**
* @dev Gas optimization: both the 'feeShareBP' and 'router' fields are used during the 'swapFromVUsd', 'swapToVUsd'
* operations and can occupy the same slot.
*/
uint16 public feeShareBP;
address public router;
uint public tokenBalance;
uint public vUsdBalance;
uint public balanceRatioMinBP;
uint public reserves;
uint public immutable a;
uint public d;
uint private immutable tokenAmountReduce;
uint private immutable tokenAmountIncrease;
// can restrict deposit or withdraw operations
address private stopAuthority;
// is deposit operation allowed
uint public canDeposit = 1;
// is withdraw operation allowed
uint public canWithdraw = 1;
event SwappedToVUsd(address sender, address token, uint amount, uint vUsdAmount, uint fee);
event SwappedFromVUsd(address recipient, address token, uint vUsdAmount, uint amount, uint fee);
constructor(
address router_,
uint a_,
ERC20 token_,
uint16 feeShareBP_,
uint balanceRatioMinBP_,
string memory lpName,
string memory lpSymbol
) RewardManager(token_, lpName, lpSymbol) {
a = a_;
router = router_;
stopAuthority = owner();
feeShareBP = feeShareBP_;
balanceRatioMinBP = balanceRatioMinBP_;
uint decimals = token_.decimals();
tokenAmountReduce = decimals > SYSTEM_PRECISION ? 10 ** (decimals - SYSTEM_PRECISION) : 0;
tokenAmountIncrease = decimals < SYSTEM_PRECISION ? 10 ** (SYSTEM_PRECISION - decimals) : 0;
}
/**
* @dev Throws if called by any account other than the router.
*/
modifier onlyRouter() {
require(router == msg.sender, "Pool: is not router");
_;
}
/**
* @dev Throws if called by any account other than the stopAuthority.
*/
modifier onlyStopAuthority() {
require(stopAuthority == msg.sender, "Pool: is not stopAuthority");
_;
}
/**
* @dev Modifier to prevent function from disbalancing the pool over a threshold defined by `balanceRatioMinBP`
*/
modifier validateBalanceRatio() {
_;
if (tokenBalance > vUsdBalance) {
require((vUsdBalance * BP) / tokenBalance >= balanceRatioMinBP, "Pool: low vUSD balance");
} else if (tokenBalance < vUsdBalance) {
require((tokenBalance * BP) / vUsdBalance >= balanceRatioMinBP, "Pool: low token balance");
}
}
/**
* @dev Modifier to make a function callable only when the deposit is allowed.
*/
modifier whenCanDeposit() {
require(canDeposit == 1, "Pool: deposit prohibited");
_;
}
/**
* @dev Modifier to make a function callable only when the withdraw is allowed.
*/
modifier whenCanWithdraw() {
require(canWithdraw == 1, "Pool: withdraw prohibited");
_;
}
/**
* @dev Calculates the price and deposit token according to the amount and price, then adds the same amount to the X
* and to the Y
* @param amount The deposited amount
*/
function deposit(uint amount) external whenCanDeposit {
uint oldD = d;
uint amountSP = _toSystemPrecision(amount);
require(amountSP > 0, "Pool: too little");
token.safeTransferFrom(msg.sender, address(this), amount);
// Add deposited amount to reserves
reserves += amountSP;
uint oldBalance = (tokenBalance + vUsdBalance);
if (oldD == 0 || oldBalance == 0) {
// Split balance equally on the first deposit
uint halfAmount = amountSP >> 1;
tokenBalance += halfAmount;
vUsdBalance += halfAmount;
} else {
// Add amount proportionally to each pool
tokenBalance += (amountSP * tokenBalance) / oldBalance;
vUsdBalance += (amountSP * vUsdBalance) / oldBalance;
}
_updateD();
// Deposit as many LP tokens as the D increase
_depositLp(msg.sender, d - oldD);
require(tokenBalance < MAX_TOKEN_BALANCE, "Pool: too much");
}
/*
* @dev Subtracts X and Y for that amount, calculates current price and withdraw the token to the user according to
* the price
* @param amount The deposited amount
*/
function withdraw(uint amountLp) external whenCanWithdraw {
uint oldD = d;
_withdrawLp(msg.sender, amountLp);
// Always withdraw tokens in amount equal to amountLp
// Withdraw proportionally from token and vUsd balance
uint oldBalance = (tokenBalance + vUsdBalance);
tokenBalance -= (amountLp * tokenBalance) / oldBalance;
vUsdBalance -= (amountLp * vUsdBalance) / oldBalance;
require(tokenBalance + vUsdBalance < oldBalance, "Pool: zero changes");
// Check if there is enough funds in reserve to withdraw
require(amountLp <= reserves, "Pool: reserves");
// Adjust reserves by withdraw amount
reserves -= amountLp;
// Update D and transfer tokens to the sender
_updateD();
require(d < oldD, "Pool: zero D changes");
token.safeTransfer(msg.sender, _fromSystemPrecision(amountLp));
}
/**
* @notice Calculates new virtual USD value from the given amount of tokens.
* @dev Calculates new Y according to new X.
* NOTICE: Prior to calling this the router must transfer tokens from the user to the pool.
* @param amount The amount of tokens to swap.
* @param zeroFee When true it allows to swap without incurring any fees. It is intended for use with service
* accounts.
* @return returns the difference between the old and the new value of vUsdBalance
*/
function swapToVUsd(
address user,
uint amount,
bool zeroFee
) external onlyRouter validateBalanceRatio returns (uint) {
uint result; // 0 by default
uint fee;
if (amount > 0) {
if (!zeroFee) {
fee = (amount * feeShareBP) / BP;
}
uint amountIn = _toSystemPrecision(amount - fee);
// Incorporate rounding dust into the fee
fee = amount - _fromSystemPrecision(amountIn);
// Adjust token and reserve balances after the fee is applied
tokenBalance += amountIn;
reserves += amountIn;
uint vUsdNewAmount = this.getY(tokenBalance);
if (vUsdBalance > vUsdNewAmount) {
result = vUsdBalance - vUsdNewAmount;
}
vUsdBalance = vUsdNewAmount;
_addRewards(fee);
}
emit SwappedToVUsd(user, address(token), amount, result, fee);
return result;
}
/**
* @notice Calculates the amount of tokens from the given virtual USD value, and transfers it to the user.
* @dev Calculates new X according to new Y.
* @param user The address of the recipient.
* @param amount The amount of vUSD to swap.
* @param receiveAmountMin The minimum amount of tokens required to be received during the swap, otherwise the
* transaction reverts.
* @param zeroFee When true it allows to swap without incurring any fees. It is intended for use with service
* accounts.
* @return returns the difference between the old and the new value of vUsdBalance
*/
function swapFromVUsd(
address user,
uint amount,
uint receiveAmountMin,
bool zeroFee
) external onlyRouter validateBalanceRatio returns (uint) {
uint resultSP; // 0 by default
uint result; // 0 by default
uint fee;
if (amount > 0) {
vUsdBalance += amount;
uint newAmount = this.getY(vUsdBalance);
if (tokenBalance > newAmount) {
resultSP = tokenBalance - newAmount;
result = _fromSystemPrecision(resultSP);
} // Otherwise result/resultSP stay 0
// Check if there is enough funds in reserve to pay
require(resultSP <= reserves, "Pool: reserves");
// Remove from reserves including fee, apply fee later
reserves -= resultSP;
if (!zeroFee) {
fee = (result * feeShareBP) / BP;
}
// We can use unchecked here because feeShareBP <= BP
unchecked {
result -= fee;
}
tokenBalance = newAmount;
require(result >= receiveAmountMin, "Pool: slippage");
token.safeTransfer(user, result);
_addRewards(fee);
}
emit SwappedFromVUsd(user, address(token), amount, result, fee);
return result;
}
/**
* @dev Sets admin fee share.
*/
function setFeeShare(uint16 feeShareBP_) external onlyOwner {
require(feeShareBP_ <= BP, "Pool: too large");
feeShareBP = feeShareBP_;
}
function adjustTotalLpAmount() external onlyOwner {
if (d > totalSupply()) {
_depositLp(owner(), d - totalSupply());
}
}
/**
* @dev Sets the threshold over which the pool can't be disbalanced.
*/
function setBalanceRatioMinBP(uint balanceRatioMinBP_) external onlyOwner {
require(balanceRatioMinBP_ <= BP, "Pool: too large");
balanceRatioMinBP = balanceRatioMinBP_;
}
/**
* @dev Switches off the possibility to make deposits.
*/
function stopDeposit() external onlyStopAuthority {
canDeposit = 0;
}
/**
* @dev Switches on the possibility to make deposits.
*/
function startDeposit() external onlyOwner {
canDeposit = 1;
}
/**
* @dev Switches off the possibility to make withdrawals.
*/
function stopWithdraw() external onlyStopAuthority {
canWithdraw = 0;
}
/**
* @dev Switches on the possibility to make withdrawals.
*/
function startWithdraw() external onlyOwner {
canWithdraw = 1;
}
/**
* @dev Sets the address of the stopAuthority account.
*/
function setStopAuthority(address stopAuthority_) external onlyOwner {
stopAuthority = stopAuthority_;
}
/**
* @dev Sets the address of the Router contract.
*/
function setRouter(address router_) external onlyOwner {
router = router_;
}
/**
* @dev y = (sqrt(x(4AD³ + x (4A(D - x) - D )²)) + x (4A(D - x) - D ))/8Ax.
*/
function getY(uint x) external view returns (uint) {
uint d_ = d; // Gas optimization
uint a4 = a << 2;
uint a8 = a4 << 1;
// 4A(D - x) - D
int part1 = int(a4) * (int(d_) - int(x)) - int(d_);
// x * (4AD³ + x(part1²))
uint part2 = x * (a4 * d_ * d_ * d_ + x * uint(part1 * part1));
// (sqrt(part2) + x(part1)) / 8Ax)
return SafeCast.toUint256(int(_sqrt(part2)) + int(x) * part1) / (a8 * x) + 1; // +1 to offset rounding errors
}
/**
* @dev price = (1/2) * ((D³ + 8ADx² - 8Ax³ - 2Dx²) / (4x * sqrt(x(4AD³ + x (4A(D - x) - D )²))))
*/
function getPrice() external view returns (uint) {
uint x = tokenBalance;
uint a8 = a << 3;
uint dCubed = d * d * d;
// 4A(D - x) - D
int p1 = int(a << 2) * (int(d) - int(x)) - int(d);
// x * 4AD³ + x(p1²)
uint p2 = x * ((a << 2) * dCubed + x * uint(p1 * p1));
// D³ + 8ADx² - 8Ax³ - 2Dx²
int p3 = int(dCubed) + int((a << 3) * d * x * x) - int(a8 * x * x * x) - int((d << 1) * x * x);
// 1/2 * p3 / (4x * sqrt(p2))
return SafeCast.toUint256((PP >> 1) + ((PP * p3) / int((x << 2) * _sqrt(p2))));
}
function _updateD() internal {
uint x = tokenBalance;
uint y = vUsdBalance;
// a = 8 * Axy(x+y)
// b = 4 * xy(4A - 1) / 3
// c = sqrt(a² + b³)
// D = cbrt(a + c) + cbrt(a - c)
uint xy = x * y;
uint a_ = a;
// Axy(x+y)
uint p1 = a_ * xy * (x + y);
// xy(4A - 1) / 3
uint p2 = (xy * ((a_ << 2) - 1)) / 3;
// p1² + p2³
uint p3 = _sqrt((p1 * p1) + (p2 * p2 * p2));
unchecked {
uint d_ = _cbrt(p1 + p3);
if (p3 > p1) {
d_ -= _cbrt(p3 - p1);
} else {
d_ += _cbrt(p1 - p3);
}
d = (d_ << 1);
}
}
function _toSystemPrecision(uint amount) internal view returns (uint) {
if (tokenAmountReduce > 0) {
return amount / tokenAmountReduce;
} else if (tokenAmountIncrease > 0) {
return amount * tokenAmountIncrease;
}
return amount;
}
function _fromSystemPrecision(uint amount) internal view returns (uint) {
if (tokenAmountReduce > 0) {
return amount * tokenAmountReduce;
} else if (tokenAmountIncrease > 0) {
return amount / tokenAmountIncrease;
}
return amount;
}
function _sqrt(uint n) internal pure returns (uint) {
unchecked {
if (n > 0) {
uint x = (n >> 1) + 1;
uint y = (x + n / x) >> 1;
while (x > y) {
x = y;
y = (x + n / x) >> 1;
}
return x;
}
return 0;
}
}
function _cbrt(uint n) internal pure returns (uint) {
unchecked {
uint x = 0;
for (uint y = 1 << 255; y > 0; y >>= 3) {
x <<= 1;
uint z = 3 * x * (x + 1) + 1;
if (n / y >= z) {
n -= y * z;
x += 1;
}
}
return x;
}
}
fallback() external payable {
revert("Unsupported");
}
receive() external payable {
revert("Unsupported");
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract RewardManager is Ownable, ERC20 {
using SafeERC20 for ERC20;
uint private constant P = 52;
uint internal constant BP = 1e4;
// Accumulated rewards per share, shifted left by P bits
uint public accRewardPerShareP;
// Reward token
ERC20 public immutable token;
// Info of each user reward debt
mapping(address user => uint amount) public userRewardDebt;
// Admin fee share (in basis points)
uint public adminFeeShareBP;
// Unclaimed admin fee amount
uint public adminFeeAmount;
event Deposit(address indexed user, uint amount);
event Withdraw(address indexed user, uint amount);
event RewardsClaimed(address indexed user, uint amount);
constructor(ERC20 token_, string memory lpName, string memory lpSymbol) ERC20(lpName, lpSymbol) {
token = token_;
// Default admin fee is 20%
adminFeeShareBP = BP / 5;
}
/**
* @notice Claims pending rewards for the current staker without updating the stake balance.
*/
function claimRewards() external {
uint userLpAmount = balanceOf(msg.sender);
if (userLpAmount > 0) {
uint rewards = (userLpAmount * accRewardPerShareP) >> P;
uint pending = rewards - userRewardDebt[msg.sender];
if (pending > 0) {
userRewardDebt[msg.sender] = rewards;
token.safeTransfer(msg.sender, pending);
emit RewardsClaimed(msg.sender, pending);
}
}
}
/**
* @notice Sets the basis points of the admin fee share from rewards.
*/
function setAdminFeeShare(uint adminFeeShareBP_) external onlyOwner {
require(adminFeeShareBP_ <= BP, "RewardManager: too high");
adminFeeShareBP = adminFeeShareBP_;
}
/**
* @notice Allows the admin to claim the collected admin fee.
*/
function claimAdminFee() external onlyOwner {
if (adminFeeAmount > 0) {
token.safeTransfer(msg.sender, adminFeeAmount);
adminFeeAmount = 0;
}
}
/**
* @notice Returns pending rewards for the staker.
* @param user The address of the staker.
*/
function pendingReward(address user) external view returns (uint) {
return ((balanceOf(user) * accRewardPerShareP) >> P) - userRewardDebt[user];
}
/**
* @dev Returns the number of decimals used to get user representation of LP tokens.
*/
function decimals() public pure override returns (uint8) {
return 3;
}
/**
* @dev Adds reward to the pool, splits admin fee share and updates the accumulated rewards per share.
*/
function _addRewards(uint rewardAmount) internal {
if (totalSupply() > 0) {
uint adminFeeRewards = (rewardAmount * adminFeeShareBP) / BP;
unchecked {
rewardAmount -= adminFeeRewards;
}
accRewardPerShareP += (rewardAmount << P) / totalSupply();
adminFeeAmount += adminFeeRewards;
}
}
/**
* @dev Deposits LP amount for the user, updates user reward debt and pays pending rewards.
*/
function _depositLp(address to, uint lpAmount) internal {
uint pending;
uint userLpAmount = balanceOf(to); // Gas optimization
if (userLpAmount > 0) {
pending = ((userLpAmount * accRewardPerShareP) >> P) - userRewardDebt[to];
}
userLpAmount += lpAmount;
_mint(to, lpAmount);
userRewardDebt[to] = (userLpAmount * accRewardPerShareP) >> P;
if (pending > 0) {
token.safeTransfer(to, pending);
emit RewardsClaimed(to, pending);
}
emit Deposit(to, lpAmount);
}
/**
* @dev Withdraws LP amount for the user, updates user reward debt and pays out pending rewards.
*/
function _withdrawLp(address from, uint lpAmount) internal {
uint userLpAmount = balanceOf(from); // Gas optimization
require(userLpAmount >= lpAmount, "RewardManager: not enough amount");
uint pending;
if (userLpAmount > 0) {
pending = ((userLpAmount * accRewardPerShareP) >> P) - userRewardDebt[from];
}
userLpAmount -= lpAmount;
_burn(from, lpAmount);
userRewardDebt[from] = (userLpAmount * accRewardPerShareP) >> P;
if (pending > 0) {
token.safeTransfer(from, pending);
emit RewardsClaimed(from, pending);
}
emit Withdraw(from, lpAmount);
}
function _transfer(address, address, uint) internal pure override {
revert("Unsupported");
}
function _approve(address, address, uint) internal pure override {
revert("Unsupported");
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IRouter} from "./interfaces/IRouter.sol";
import {MessengerProtocol} from "./interfaces/IBridge.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Pool} from "./Pool.sol";
abstract contract Router is Ownable, IRouter {
using SafeERC20 for ERC20;
uint private immutable chainPrecision;
uint internal constant ORACLE_PRECISION = 18;
mapping(bytes32 tokenId => Pool) public pools;
// precomputed values to divide by to change the precision from the Gas Oracle precision to the token precision
mapping(address tokenAddress => uint scalingFactor) internal fromGasOracleScalingFactor;
// precomputed values of the scaling factor required for paying the bridging fee with stable tokens
mapping(address tokenAddress => uint scalingFactor) internal bridgingFeeConversionScalingFactor;
// can restrict swap operations
address private stopAuthority;
/**
* @dev The rebalancer is an account responsible for balancing the liquidity pools. It ensures that the pool is
* balanced by executing zero-fee swaps when the pool is imbalanced.
*
* Gas optimization: both the 'rebalancer' and 'canSwap' fields are used in the 'swap' and 'swapAndBridge'
* functions and can occupy the same slot.
*/
address private rebalancer;
uint8 public override canSwap = 1;
/**
* @dev Emitted during the on-chain swap of tokens.
*/
event Swapped(
address sender,
address recipient,
bytes32 sendToken,
bytes32 receiveToken,
uint sendAmount,
uint receiveAmount
);
constructor(uint chainPrecision_) {
chainPrecision = chainPrecision_;
stopAuthority = owner();
}
/**
* @dev Modifier to make a function callable only when the swap is allowed.
*/
modifier whenCanSwap() {
require(canSwap == 1, "Router: swap prohibited");
_;
}
/**
* @dev Throws if called by any account other than the stopAuthority.
*/
modifier onlyStopAuthority() {
require(stopAuthority == msg.sender, "Router: is not stopAuthority");
_;
}
/**
* @notice Swaps a given pair of tokens on the same blockchain.
* @param amount The amount of tokens to be swapped.
* @param token The token to be swapped.
* @param receiveToken The token to receive in exchange for the swapped token.
* @param recipient The address to receive the tokens.
* @param receiveAmountMin The minimum amount of tokens required to receive during the swap.
*/
function swap(
uint amount,
bytes32 token,
bytes32 receiveToken,
address recipient,
uint receiveAmountMin
) external override whenCanSwap {
uint vUsdAmount = _sendAndSwapToVUsd(token, msg.sender, amount);
uint receivedAmount = _receiveAndSwapFromVUsd(receiveToken, recipient, vUsdAmount, receiveAmountMin);
emit Swapped(msg.sender, recipient, token, receiveToken, amount, receivedAmount);
}
/**
* @notice Allows the admin to add new supported liquidity pools.
* @dev Adds the address of the `Pool` contract to the list of supported liquidity pools.
* @param pool The address of the `Pool` contract.
* @param token The address of the token in the liquidity pool.
*/
function addPool(Pool pool, bytes32 token) external onlyOwner {
pools[token] = pool;
address tokenAddress = address(uint160(uint(token)));
uint tokenDecimals = ERC20(tokenAddress).decimals();
bridgingFeeConversionScalingFactor[tokenAddress] = 10 ** (ORACLE_PRECISION - tokenDecimals + chainPrecision);
fromGasOracleScalingFactor[tokenAddress] = 10 ** (ORACLE_PRECISION - tokenDecimals);
}
/**
* @dev Switches off the possibility to make swaps.
*/
function stopSwap() external onlyStopAuthority {
canSwap = 0;
}
/**
* @dev Switches on the possibility to make swaps.
*/
function startSwap() external onlyOwner {
canSwap = 1;
}
/**
* @dev Allows the admin to set the address of the stopAuthority.
*/
function setStopAuthority(address stopAuthority_) external onlyOwner {
stopAuthority = stopAuthority_;
}
/**
* @dev Allows the admin to set the address of the rebalancer.
*/
function setRebalancer(address rebalancer_) external onlyOwner {
rebalancer = rebalancer_;
}
function _receiveAndSwapFromVUsd(
bytes32 token,
address recipient,
uint vUsdAmount,
uint receiveAmountMin
) internal returns (uint) {
Pool tokenPool = pools[token];
require(address(tokenPool) != address(0), "Router: no receive pool");
return tokenPool.swapFromVUsd(recipient, vUsdAmount, receiveAmountMin, recipient == rebalancer);
}
function _sendAndSwapToVUsd(bytes32 token, address user, uint amount) internal virtual returns (uint) {
Pool pool = pools[token];
require(address(pool) != address(0), "Router: no pool");
ERC20(address(uint160(uint(token)))).safeTransferFrom(user, address(pool), amount);
return pool.swapToVUsd(user, amount, user == rebalancer);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRESS;
assembly {
let payloadStart := add(payload, 32)
let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)
}
}
function log() internal view {
_sendLogPayload(abi.encodeWithSignature("log()"));
}
function logInt(int p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(int)", p0));
}
function logUint(uint p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
}
function logString(string memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
}
function logBool(bool p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
}
function logAddress(address p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
}
function logBytes(bytes memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes)", p0));
}
function logBytes1(bytes1 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0));
}
function logBytes2(bytes2 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0));
}
function logBytes3(bytes3 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0));
}
function logBytes4(bytes4 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0));
}
function logBytes5(bytes5 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0));
}
function logBytes6(bytes6 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0));
}
function logBytes7(bytes7 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0));
}
function logBytes8(bytes8 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0));
}
function logBytes9(bytes9 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0));
}
function logBytes10(bytes10 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0));
}
function logBytes11(bytes11 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0));
}
function logBytes12(bytes12 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0));
}
function logBytes13(bytes13 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0));
}
function logBytes14(bytes14 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0));
}
function logBytes15(bytes15 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0));
}
function logBytes16(bytes16 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0));
}
function logBytes17(bytes17 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0));
}
function logBytes18(bytes18 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0));
}
function logBytes19(bytes19 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0));
}
function logBytes20(bytes20 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0));
}
function logBytes21(bytes21 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0));
}
function logBytes22(bytes22 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0));
}
function logBytes23(bytes23 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0));
}
function logBytes24(bytes24 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0));
}
function logBytes25(bytes25 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0));
}
function logBytes26(bytes26 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0));
}
function logBytes27(bytes27 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0));
}
function logBytes28(bytes28 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0));
}
function logBytes29(bytes29 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0));
}
function logBytes30(bytes30 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0));
}
function logBytes31(bytes31 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0));
}
function logBytes32(bytes32 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0));
}
function log(uint p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
}
function log(string memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
}
function log(bool p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
}
function log(address p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
}
function log(uint p0, uint p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1));
}
function log(uint p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1));
}
function log(uint p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1));
}
function log(uint p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1));
}
function log(string memory p0, uint p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1));
}
function log(string memory p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1));
}
function log(string memory p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1));
}
function log(string memory p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1));
}
function log(bool p0, uint p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1));
}
function log(bool p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1));
}
function log(bool p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1));
}
function log(bool p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1));
}
function log(address p0, uint p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1));
}
function log(address p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1));
}
function log(address p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1));
}
function log(address p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1));
}
function log(uint p0, uint p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2));
}
function log(uint p0, uint p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2));
}
function log(uint p0, uint p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2));
}
function log(uint p0, uint p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2));
}
function log(uint p0, string memory p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2));
}
function log(uint p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2));
}
function log(uint p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2));
}
function log(uint p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2));
}
function log(uint p0, bool p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2));
}
function log(uint p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2));
}
function log(uint p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2));
}
function log(uint p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2));
}
function log(uint p0, address p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2));
}
function log(uint p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2));
}
function log(uint p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2));
}
function log(uint p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2));
}
function log(string memory p0, uint p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2));
}
function log(string memory p0, uint p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2));
}
function log(string memory p0, uint p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2));
}
function log(string memory p0, uint p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2));
}
function log(string memory p0, string memory p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2));
}
function log(string memory p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2));
}
function log(string memory p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2));
}
function log(string memory p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2));
}
function log(string memory p0, bool p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2));
}
function log(string memory p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2));
}
function log(string memory p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2));
}
function log(string memory p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2));
}
function log(string memory p0, address p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2));
}
function log(string memory p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2));
}
function log(string memory p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2));
}
function log(string memory p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2));
}
function log(bool p0, uint p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2));
}
function log(bool p0, uint p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2));
}
function log(bool p0, uint p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2));
}
function log(bool p0, uint p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2));
}
function log(bool p0, string memory p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2));
}
function log(bool p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2));
}
function log(bool p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2));
}
function log(bool p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2));
}
function log(bool p0, bool p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2));
}
function log(bool p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2));
}
function log(bool p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2));
}
function log(bool p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2));
}
function log(bool p0, address p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2));
}
function log(bool p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2));
}
function log(bool p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2));
}
function log(bool p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2));
}
function log(address p0, uint p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2));
}
function log(address p0, uint p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2));
}
function log(address p0, uint p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2));
}
function log(address p0, uint p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2));
}
function log(address p0, string memory p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2));
}
function log(address p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2));
}
function log(address p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2));
}
function log(address p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2));
}
function log(address p0, bool p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2));
}
function log(address p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2));
}
function log(address p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2));
}
function log(address p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2));
}
function log(address p0, address p1, uint p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2));
}
function log(address p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2));
}
function log(address p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2));
}
function log(address p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2));
}
function log(uint p0, uint p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3));
}
function log(uint p0, uint p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3));
}
function log(uint p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3));
}
function log(uint p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3));
}
function log(uint p0, address p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3));
}
function log(uint p0, address p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3));
}
function log(uint p0, address p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3));
}
function log(uint p0, address p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3));
}
function log(uint p0, address p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3));
}
function log(uint p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3));
}
function log(uint p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3));
}
function log(uint p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3));
}
function log(uint p0, address p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3));
}
function log(uint p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3));
}
function log(uint p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3));
}
function log(uint p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3));
}
function log(uint p0, address p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3));
}
function log(uint p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3));
}
function log(uint p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3));
}
function log(uint p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3));
}
function log(address p0, uint p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3));
}
function log(address p0, uint p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3));
}
function log(address p0, uint p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3));
}
function log(address p0, uint p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3));
}
function log(address p0, uint p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3));
}
function log(address p0, uint p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3));
}
function log(address p0, uint p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3));
}
function log(address p0, uint p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3));
}
function log(address p0, uint p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3));
}
function log(address p0, uint p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3));
}
function log(address p0, uint p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, uint p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3));
}
function log(address p0, uint p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3));
}
function log(address p0, uint p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3));
}
function log(address p0, uint p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3));
}
function log(address p0, uint p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, uint p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {IBridge, MessengerProtocol} from "../interfaces/IBridge.sol";
import {Router} from "../Router.sol";
contract TestBridgeForSwap is IBridge, Router {
uint public chainId;
mapping(bytes32 messageHash => uint isProcessed) public override processedMessages;
mapping(bytes32 messageHash => uint isSent) public override sentMessages;
// Info about bridges on other chains
mapping(uint chainId => bytes32 bridgeAddress) public override otherBridges;
// Info about tokens on other chains
mapping(uint chainId => mapping(bytes32 tokenAddress => bool isSupported)) public override otherBridgeTokens;
event vUsdSent(uint amount);
constructor() Router(18) {}
function swapAndBridge(
bytes32 token,
uint amount,
bytes32 recipient,
uint destinationChainId,
bytes32 receiveToken,
uint nonce,
MessengerProtocol messenger,
uint feeTokenAmount
) external payable override {}
function receiveTokens(
uint amount,
bytes32,
uint,
bytes32 receiveToken,
uint,
MessengerProtocol,
uint receiveAmountMin
) external payable override {}
function withdrawGasTokens(uint amount) external override onlyOwner {}
function registerBridge(uint chainId_, bytes32 bridgeAddress_) external override onlyOwner {}
function addBridgeToken(uint chainId_, bytes32 tokenAddress_) external override onlyOwner {}
function removeBridgeToken(uint chainId_, bytes32 tokenAddress_) external override onlyOwner {}
function getBridgingCostInTokens(
uint,
MessengerProtocol,
address
) external pure override returns (uint) {
return 0;
}
function hashMessage(
uint,
bytes32,
uint,
uint,
bytes32,
uint,
MessengerProtocol
) external pure override returns (bytes32) {
return 0;
}
function _sendAndSwapToVUsd(bytes32 token, address user, uint amount) internal override returns (uint) {
uint vUsdAmount = super._sendAndSwapToVUsd(token, user, amount);
emit vUsdSent(vUsdAmount);
return vUsdAmount;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {IMessenger} from "../interfaces/IMessenger.sol";
contract TestMessenger is IMessenger {
bool public isHasMessage = false;
event Sent();
function sentMessagesBlock(bytes32) external view override returns (uint) {
return isHasMessage ? 1 : 0;
}
function receivedMessages(bytes32) external view override returns (uint) {
return isHasMessage ? 1 : 0;
}
function sendMessage(bytes32) external payable override {
emit Sent();
}
function receiveMessage(
bytes32 message,
uint v1v2,
bytes32 r1,
bytes32 s1,
bytes32 r2,
bytes32 s2
) external override {
// Do nothing
}
function getTransactionCost(uint) external pure returns (uint) {
return 1000;
}
function setIsHasMessage(bool isHasMessage_) external {
isHasMessage = isHasMessage_;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Pool} from "../Pool.sol";
import {RewardManager} from "../RewardManager.sol";
contract TestPool is Pool {
constructor(
address router_,
uint a_,
ERC20 token_,
uint16 feeShareBP_,
uint balanceRatioMinBP_
) Pool(router_, a_, token_, feeShareBP_, balanceRatioMinBP_, "LP", "LP") {}
function setVUsdBalance(uint vUsdBalance_) public {
vUsdBalance = vUsdBalance_;
}
function setTokenBalance(uint tokenBalance_) public {
tokenBalance = tokenBalance_;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {RewardManager} from "../RewardManager.sol";
contract TestPoolForRewards is RewardManager {
// solhint-disable-next-line no-empty-blocks
constructor(ERC20 token) RewardManager(token, "LP", "LP") {}
function deposit(uint amount) external {
_depositLp(msg.sender, amount);
}
function withdraw(uint amount) external {
_withdrawLp(msg.sender, amount);
}
function addRewards(uint amount) external {
_addRewards(amount);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Token is ERC20 {
uint8 internal _decimals;
constructor(string memory _name, string memory _symbol, uint _amount, uint8 __decimals) ERC20(_name, _symbol) {
_mint(msg.sender, _amount);
_decimals = __decimals;
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}{
"optimizer": {
"enabled": true,
"runs": 1000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"chainId_","type":"uint256"},{"internalType":"bytes32","name":"otherChainIds_","type":"bytes32"},{"internalType":"contract IWormhole","name":"wormhole_","type":"address"},{"internalType":"uint8","name":"commitmentLevel_","type":"uint8"},{"internalType":"contract IGasOracle","name":"gasOracle_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"message","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"sequence","type":"uint64"}],"name":"MessageReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"message","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"sequence","type":"uint64"}],"name":"MessageSent","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":"","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"Received","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"chainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"}],"name":"gasUsage","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"}],"name":"getTransactionCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"otherChainIds","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedMsg","type":"bytes"}],"name":"receiveMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"messageHash","type":"bytes32"}],"name":"receivedMessages","outputs":[{"internalType":"uint256","name":"isReceived","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"chainId_","type":"uint16"},{"internalType":"bytes32","name":"address_","type":"bytes32"}],"name":"registerWormholeMessenger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"message","type":"bytes32"}],"name":"sendMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"messageHash","type":"bytes32"}],"name":"sentMessages","outputs":[{"internalType":"uint256","name":"isSent","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"value","type":"uint8"}],"name":"setCommitmentLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IGasOracle","name":"gasOracle_","type":"address"}],"name":"setGasOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"gasAmount","type":"uint256"}],"name":"setGasUsage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"value","type":"bytes32"}],"name":"setOtherChainIds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawGasTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60c060405234801561001057600080fd5b50604051620013e7380380620013e7833981016040819052610031916100f7565b8061003b3361008f565b600180546001600160a01b0319166001600160a01b0392831617905560a095909552506003929092559091166080526004805460ff60201b191664010000000060ff9093169290920291909117905561015e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100f457600080fd5b50565b600080600080600060a0868803121561010f57600080fd5b85519450602086015193506040860151610128816100df565b606087015190935060ff8116811461013f57600080fd5b6080870151909250610150816100df565b809150509295509295909350565b60805160a05161124e62000199600039600081816103320152818161058d0152610a440152600081816107360152610925015261124e6000f3fe6080604052600436106101125760003560e01c806382e3702d116100a5578063a87b815211610074578063f2fde38b11610059578063f2fde38b14610387578063f69f8151146103a7578063f953cec7146103d457610151565b8063a87b815214610354578063e12c9ca81461037457610151565b806382e3702d146102ab5780638da5cb5b146102d857806394012c49146103005780639a8a05921461032057610151565b806346a2f51e116100e157806346a2f51e146102405780635fa1ebd914610256578063715018a614610276578063731061b71461028b57610151565b80631268cee81461019e57806318b51308146101c05780631db2a314146101f357806336d6825a1461021357610151565b3661015157604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a1005b60405162461bcd60e51b815260206004820152600b60248201527f556e737570706f7274656400000000000000000000000000000000000000000060448201526064015b60405180910390fd5b3480156101aa57600080fd5b506101be6101b9366004610c34565b6103f4565b005b3480156101cc57600080fd5b506101e06101db366004610c34565b61042d565b6040519081526020015b60405180910390f35b3480156101ff57600080fd5b506101be61020e366004610c5c565b6104d0565b34801561021f57600080fd5b506101e061022e366004610c34565b60026020526000908152604090205481565b34801561024c57600080fd5b506101e060035481565b34801561026257600080fd5b506101be610271366004610c80565b6104fa565b34801561028257600080fd5b506101be610514565b34801561029757600080fd5b506101be6102a6366004610cb2565b610528565b3480156102b757600080fd5b506101e06102c6366004610c34565b60076020526000908152604090205481565b3480156102e457600080fd5b506000546040516001600160a01b0390911681526020016101ea565b34801561030c57600080fd5b506101be61031b366004610c34565b610547565b34801561032c57600080fd5b506101e07f000000000000000000000000000000000000000000000000000000000000000081565b34801561036057600080fd5b506101be61036f366004610cf3565b610554565b6101be610382366004610c34565b61058b565b34801561039357600080fd5b506101be6103a2366004610cf3565b61088e565b3480156103b357600080fd5b506101e06103c2366004610c34565b60066020526000908152604090205481565b3480156103e057600080fd5b506101be6103ef366004610dcc565b61091e565b6103fc610b7d565b604051339082156108fc029083906000818181858888f19350505050158015610429573d6000803e3d6000fd5b5050565b6001546000828152600260205260408082205490517fca24994c00000000000000000000000000000000000000000000000000000000815260048101859052602481019190915290916001600160a01b03169063ca24994c90604401602060405180830381865afa1580156104a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ca9190610e4c565b92915050565b6104d8610b7d565b6004805460ff9092166401000000000264ff0000000019909216919091179055565b610502610b7d565b60009182526002602052604090912055565b61051c610b7d565b6105266000610bd7565b565b610530610b7d565b61ffff909116600090815260056020526040902055565b61054f610b7d565b600355565b61055c610b7d565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7f00000000000000000000000000000000000000000000000000000000000000008160001a146105fd5760405162461bcd60e51b815260206004820181905260248201527f576f726d686f6c654d657373656e6765723a2077726f6e6720636861696e49646044820152606401610195565b6003548160011a6020811061061457610614610e65565b1a60f81b7fff00000000000000000000000000000000000000000000000000000000000000166000036106895760405162461bcd60e51b815260206004820152601c60248201527f4d657373656e6765723a2077726f6e672064657374696e6174696f6e000000006044820152606401610195565b600081815233602052604081207dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffff00000000000000000000000000000000000000000000000000000000000083161760045460408051602080820185905282518083039091018152818301928390527fb19a437e0000000000000000000000000000000000000000000000000000000090925292935063ffffffff8216926000926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263b19a437e9261077c9287929160ff6401000000009092049190911690604401610ecb565b6020604051808303816000875af115801561079b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bf9190610f1a565b6004805463ffffffff19166001850163ffffffff16179055600084815260076020526040902054909150156108365760405162461bcd60e51b815260206004820152601e60248201527f576f726d686f6c654d657373656e6765723a20686173206d65737361676500006044820152606401610195565b60008381526007602090815260409182902060019055905167ffffffffffffffff8316815284917f3d268d705c99ec99e84748365f374dea1d745080faad9ddfa8c2715d20b50cb0910160405180910390a250505050565b610896610b7d565b6001600160a01b0381166109125760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610195565b61091b81610bd7565b50565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c0fd8bde856040518263ffffffff1660e01b815260040161096f9190610f35565b600060405180830381865afa15801561098c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109b49190810190611099565b9250925092508181906109da5760405162461bcd60e51b81526004016101959190610f35565b508260e0015151602014610a305760405162461bcd60e51b815260206004820152601f60248201527f576f726d686f6c654d657373656e6765723a2077726f6e67206c656e677468006044820152606401610195565b60008360e00151610a40906111f1565b90507f00000000000000000000000000000000000000000000000000000000000000008160011a14610ab45760405162461bcd60e51b815260206004820181905260248201527f576f726d686f6c654d657373656e6765723a2077726f6e6720636861696e49646044820152606401610195565b6080840151606085015161ffff1660009081526005602052604090205414610b1e5760405162461bcd60e51b815260206004820181905260248201527f576f726d686f6c654d657373656e6765723a2077726f6e6720656d69747465726044820152606401610195565b6000818152600660209081526040918290206001905560a0860151915167ffffffffffffffff909216825282917f556d717a59d7ef2969f5a9f2c6f9199f9a4e78cb7704aa4162ee70f7d2b771f1910160405180910390a25050505050565b6000546001600160a01b031633146105265760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610195565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610c4657600080fd5b5035919050565b60ff8116811461091b57600080fd5b600060208284031215610c6e57600080fd5b8135610c7981610c4d565b9392505050565b60008060408385031215610c9357600080fd5b50508035926020909101359150565b61ffff8116811461091b57600080fd5b60008060408385031215610cc557600080fd5b8235610cd081610ca2565b946020939093013593505050565b6001600160a01b038116811461091b57600080fd5b600060208284031215610d0557600080fd5b8135610c7981610cde565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715610d4957610d49610d10565b60405290565b604051610160810167ffffffffffffffff81118282101715610d4957610d49610d10565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9c57610d9c610d10565b604052919050565b600067ffffffffffffffff821115610dbe57610dbe610d10565b50601f01601f191660200190565b600060208284031215610dde57600080fd5b813567ffffffffffffffff811115610df557600080fd5b8201601f81018413610e0657600080fd5b8035610e19610e1482610da4565b610d73565b818152856020838501011115610e2e57600080fd5b81602084016020830137600091810160200191909152949350505050565b600060208284031215610e5e57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60005b83811015610e96578181015183820152602001610e7e565b50506000910152565b60008151808452610eb7816020860160208601610e7b565b601f01601f19169290920160200192915050565b63ffffffff84168152606060208201526000610eea6060830185610e9f565b905060ff83166040830152949350505050565b805167ffffffffffffffff81168114610f1557600080fd5b919050565b600060208284031215610f2c57600080fd5b610c7982610efd565b602081526000610c796020830184610e9f565b8051610f1581610c4d565b805163ffffffff81168114610f1557600080fd5b8051610f1581610ca2565b600082601f830112610f8357600080fd5b8151610f91610e1482610da4565b818152846020838601011115610fa657600080fd5b610fb7826020830160208701610e7b565b949350505050565b600082601f830112610fd057600080fd5b8151602067ffffffffffffffff821115610fec57610fec610d10565b610ffa818360051b01610d73565b82815260079290921b8401810191818101908684111561101957600080fd5b8286015b8481101561107e57608081890312156110365760008081fd5b61103e610d26565b81518152848201518582015260408083015161105981610c4d565b9082015260608281015161106c81610c4d565b9082015283529183019160800161101d565b509695505050505050565b80518015158114610f1557600080fd5b6000806000606084860312156110ae57600080fd5b835167ffffffffffffffff808211156110c657600080fd5b9085019061016082880312156110db57600080fd5b6110e3610d4f565b6110ec83610f48565b81526110fa60208401610f53565b602082015261110b60408401610f53565b604082015261111c60608401610f67565b60608201526080830151608082015261113760a08401610efd565b60a082015261114860c08401610f48565b60c082015260e08301518281111561115f57600080fd5b61116b89828601610f72565b60e08301525061010061117f818501610f53565b90820152610120838101518381111561119757600080fd5b6111a38a828701610fbf565b9183019190915250610140838101519082015294506111c460208701611089565b935060408601519150808211156111da57600080fd5b506111e786828701610f72565b9150509250925092565b80516020808301519190811015611212576000198160200360031b1b821691505b5091905056fea26469706673582212204a7b7ebd47197665534a7f63b0546ff87ef7ce726b42918c22c10f66d24d758f64736f6c634300081200330000000000000000000000000000000000000000000000000000000000000001000001000101000000000000000000000000000000000000000000000000000000000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000bdf6139f2841a7856ca154d851182c52f5b96e0
Deployed Bytecode
0x6080604052600436106101125760003560e01c806382e3702d116100a5578063a87b815211610074578063f2fde38b11610059578063f2fde38b14610387578063f69f8151146103a7578063f953cec7146103d457610151565b8063a87b815214610354578063e12c9ca81461037457610151565b806382e3702d146102ab5780638da5cb5b146102d857806394012c49146103005780639a8a05921461032057610151565b806346a2f51e116100e157806346a2f51e146102405780635fa1ebd914610256578063715018a614610276578063731061b71461028b57610151565b80631268cee81461019e57806318b51308146101c05780631db2a314146101f357806336d6825a1461021357610151565b3661015157604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a1005b60405162461bcd60e51b815260206004820152600b60248201527f556e737570706f7274656400000000000000000000000000000000000000000060448201526064015b60405180910390fd5b3480156101aa57600080fd5b506101be6101b9366004610c34565b6103f4565b005b3480156101cc57600080fd5b506101e06101db366004610c34565b61042d565b6040519081526020015b60405180910390f35b3480156101ff57600080fd5b506101be61020e366004610c5c565b6104d0565b34801561021f57600080fd5b506101e061022e366004610c34565b60026020526000908152604090205481565b34801561024c57600080fd5b506101e060035481565b34801561026257600080fd5b506101be610271366004610c80565b6104fa565b34801561028257600080fd5b506101be610514565b34801561029757600080fd5b506101be6102a6366004610cb2565b610528565b3480156102b757600080fd5b506101e06102c6366004610c34565b60076020526000908152604090205481565b3480156102e457600080fd5b506000546040516001600160a01b0390911681526020016101ea565b34801561030c57600080fd5b506101be61031b366004610c34565b610547565b34801561032c57600080fd5b506101e07f000000000000000000000000000000000000000000000000000000000000000181565b34801561036057600080fd5b506101be61036f366004610cf3565b610554565b6101be610382366004610c34565b61058b565b34801561039357600080fd5b506101be6103a2366004610cf3565b61088e565b3480156103b357600080fd5b506101e06103c2366004610c34565b60066020526000908152604090205481565b3480156103e057600080fd5b506101be6103ef366004610dcc565b61091e565b6103fc610b7d565b604051339082156108fc029083906000818181858888f19350505050158015610429573d6000803e3d6000fd5b5050565b6001546000828152600260205260408082205490517fca24994c00000000000000000000000000000000000000000000000000000000815260048101859052602481019190915290916001600160a01b03169063ca24994c90604401602060405180830381865afa1580156104a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ca9190610e4c565b92915050565b6104d8610b7d565b6004805460ff9092166401000000000264ff0000000019909216919091179055565b610502610b7d565b60009182526002602052604090912055565b61051c610b7d565b6105266000610bd7565b565b610530610b7d565b61ffff909116600090815260056020526040902055565b61054f610b7d565b600355565b61055c610b7d565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7f00000000000000000000000000000000000000000000000000000000000000018160001a146105fd5760405162461bcd60e51b815260206004820181905260248201527f576f726d686f6c654d657373656e6765723a2077726f6e6720636861696e49646044820152606401610195565b6003548160011a6020811061061457610614610e65565b1a60f81b7fff00000000000000000000000000000000000000000000000000000000000000166000036106895760405162461bcd60e51b815260206004820152601c60248201527f4d657373656e6765723a2077726f6e672064657374696e6174696f6e000000006044820152606401610195565b600081815233602052604081207dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffff00000000000000000000000000000000000000000000000000000000000083161760045460408051602080820185905282518083039091018152818301928390527fb19a437e0000000000000000000000000000000000000000000000000000000090925292935063ffffffff8216926000926001600160a01b037f00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b169263b19a437e9261077c9287929160ff6401000000009092049190911690604401610ecb565b6020604051808303816000875af115801561079b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bf9190610f1a565b6004805463ffffffff19166001850163ffffffff16179055600084815260076020526040902054909150156108365760405162461bcd60e51b815260206004820152601e60248201527f576f726d686f6c654d657373656e6765723a20686173206d65737361676500006044820152606401610195565b60008381526007602090815260409182902060019055905167ffffffffffffffff8316815284917f3d268d705c99ec99e84748365f374dea1d745080faad9ddfa8c2715d20b50cb0910160405180910390a250505050565b610896610b7d565b6001600160a01b0381166109125760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610195565b61091b81610bd7565b50565b60008060007f00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b6001600160a01b031663c0fd8bde856040518263ffffffff1660e01b815260040161096f9190610f35565b600060405180830381865afa15801561098c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109b49190810190611099565b9250925092508181906109da5760405162461bcd60e51b81526004016101959190610f35565b508260e0015151602014610a305760405162461bcd60e51b815260206004820152601f60248201527f576f726d686f6c654d657373656e6765723a2077726f6e67206c656e677468006044820152606401610195565b60008360e00151610a40906111f1565b90507f00000000000000000000000000000000000000000000000000000000000000018160011a14610ab45760405162461bcd60e51b815260206004820181905260248201527f576f726d686f6c654d657373656e6765723a2077726f6e6720636861696e49646044820152606401610195565b6080840151606085015161ffff1660009081526005602052604090205414610b1e5760405162461bcd60e51b815260206004820181905260248201527f576f726d686f6c654d657373656e6765723a2077726f6e6720656d69747465726044820152606401610195565b6000818152600660209081526040918290206001905560a0860151915167ffffffffffffffff909216825282917f556d717a59d7ef2969f5a9f2c6f9199f9a4e78cb7704aa4162ee70f7d2b771f1910160405180910390a25050505050565b6000546001600160a01b031633146105265760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610195565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610c4657600080fd5b5035919050565b60ff8116811461091b57600080fd5b600060208284031215610c6e57600080fd5b8135610c7981610c4d565b9392505050565b60008060408385031215610c9357600080fd5b50508035926020909101359150565b61ffff8116811461091b57600080fd5b60008060408385031215610cc557600080fd5b8235610cd081610ca2565b946020939093013593505050565b6001600160a01b038116811461091b57600080fd5b600060208284031215610d0557600080fd5b8135610c7981610cde565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715610d4957610d49610d10565b60405290565b604051610160810167ffffffffffffffff81118282101715610d4957610d49610d10565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9c57610d9c610d10565b604052919050565b600067ffffffffffffffff821115610dbe57610dbe610d10565b50601f01601f191660200190565b600060208284031215610dde57600080fd5b813567ffffffffffffffff811115610df557600080fd5b8201601f81018413610e0657600080fd5b8035610e19610e1482610da4565b610d73565b818152856020838501011115610e2e57600080fd5b81602084016020830137600091810160200191909152949350505050565b600060208284031215610e5e57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60005b83811015610e96578181015183820152602001610e7e565b50506000910152565b60008151808452610eb7816020860160208601610e7b565b601f01601f19169290920160200192915050565b63ffffffff84168152606060208201526000610eea6060830185610e9f565b905060ff83166040830152949350505050565b805167ffffffffffffffff81168114610f1557600080fd5b919050565b600060208284031215610f2c57600080fd5b610c7982610efd565b602081526000610c796020830184610e9f565b8051610f1581610c4d565b805163ffffffff81168114610f1557600080fd5b8051610f1581610ca2565b600082601f830112610f8357600080fd5b8151610f91610e1482610da4565b818152846020838601011115610fa657600080fd5b610fb7826020830160208701610e7b565b949350505050565b600082601f830112610fd057600080fd5b8151602067ffffffffffffffff821115610fec57610fec610d10565b610ffa818360051b01610d73565b82815260079290921b8401810191818101908684111561101957600080fd5b8286015b8481101561107e57608081890312156110365760008081fd5b61103e610d26565b81518152848201518582015260408083015161105981610c4d565b9082015260608281015161106c81610c4d565b9082015283529183019160800161101d565b509695505050505050565b80518015158114610f1557600080fd5b6000806000606084860312156110ae57600080fd5b835167ffffffffffffffff808211156110c657600080fd5b9085019061016082880312156110db57600080fd5b6110e3610d4f565b6110ec83610f48565b81526110fa60208401610f53565b602082015261110b60408401610f53565b604082015261111c60608401610f67565b60608201526080830151608082015261113760a08401610efd565b60a082015261114860c08401610f48565b60c082015260e08301518281111561115f57600080fd5b61116b89828601610f72565b60e08301525061010061117f818501610f53565b90820152610120838101518381111561119757600080fd5b6111a38a828701610fbf565b9183019190915250610140838101519082015294506111c460208701611089565b935060408601519150808211156111da57600080fd5b506111e786828701610f72565b9150509250925092565b80516020808301519190811015611212576000198160200360031b1b821691505b5091905056fea26469706673582212204a7b7ebd47197665534a7f63b0546ff87ef7ce726b42918c22c10f66d24d758f64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000001000001000101000000000000000000000000000000000000000000000000000000000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000bdf6139f2841a7856ca154d851182c52f5b96e0
-----Decoded View---------------
Arg [0] : chainId_ (uint256): 1
Arg [1] : otherChainIds_ (bytes32): 0x0000010001010000000000000000000000000000000000000000000000000000
Arg [2] : wormhole_ (address): 0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B
Arg [3] : commitmentLevel_ (uint8): 15
Arg [4] : gasOracle_ (address): 0x0BdF6139F2841A7856Ca154D851182C52F5b96e0
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [1] : 0000010001010000000000000000000000000000000000000000000000000000
Arg [2] : 00000000000000000000000098f3c9e6e3face36baad05fe09d375ef1464288b
Arg [3] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [4] : 0000000000000000000000000bdf6139f2841a7856ca154d851182c52f5b96e0
Deployed Bytecode Sourcemap
430:3046:18:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3436:31;;;3445:10;188:74:31;;3457:9:18;293:2:31;278:18;;271:34;3436:31:18;;161:18:31;3436:31:18;;;;;;;430:3046;;3360:21;;-1:-1:-1;;;3360:21:18;;518:2:31;3360:21:18;;;500::31;557:2;537:18;;;530:30;596:13;576:18;;;569:41;627:18;;3360:21:18;;;;;;;;3204:112;;;;;;;;;;-1:-1:-1;3204:112:18;;;;;:::i;:::-;;:::i;:::-;;1369:201:12;;;;;;;;;;-1:-1:-1;1369:201:12;;;;;:::i;:::-;;:::i;:::-;;;987:25:31;;;975:2;960:18;1369:201:12;;;;;;;;2838:100:18;;;;;;;;;;-1:-1:-1;2838:100:18;;;;;:::i;:::-;;:::i;386:52:12:-;;;;;;;;;;-1:-1:-1;386:52:12;;;;;:::i;:::-;;;;;;;;;;;;;;595:28:18;;;;;;;;;;;;;;;;721:116:12;;;;;;;;;;-1:-1:-1;721:116:12;;;;;:::i;:::-;;:::i;1831:101:0:-;;;;;;;;;;;;;:::i;3048:150:18:-;;;;;;;;;;-1:-1:-1;3048:150:18;;;;;:::i;:::-;;:::i;867:63::-;;;;;;;;;;-1:-1:-1;867:63:18;;;;;:::i;:::-;;;;;;;;;;;;;;1201:85:0;;;;;;;;;;-1:-1:-1;1247:7:0;1273:6;1201:85;;-1:-1:-1;;;;;1273:6:0;;;2596:74:31;;2584:2;2569:18;1201:85:0;2450:226:31;2944:98:18;;;;;;;;;;-1:-1:-1;2944:98:18;;;;;:::i;:::-;;:::i;560:29::-;;;;;;;;;;;;;;;974:103:12;;;;;;;;;;-1:-1:-1;974:103:12;;;;;:::i;:::-;;:::i;1448:712:18:-;;;;;;:::i;:::-;;:::i;2081:198:0:-;;;;;;;;;;-1:-1:-1;2081:198:0;;;;;:::i;:::-;;:::i;790:71:18:-;;;;;;;;;;-1:-1:-1;790:71:18;;;;;:::i;:::-;;;;;;;;;;;;;;2166:666;;;;;;;;;;-1:-1:-1;2166:666:18;;;;;:::i;:::-;;:::i;3204:112::-;1094:13:0;:11;:13::i;:::-;3273:36:18::1;::::0;3281:10:::1;::::0;3273:36;::::1;;;::::0;3302:6;;3273:36:::1;::::0;;;3302:6;3281:10;3273:36;::::1;;;;;;;;;;;;;::::0;::::1;;;;;;3204:112:::0;:::o;1369:201:12:-;1481:9;;1434:4;1535:17;;;:8;:17;;;;;;;1481:72;;;;;;;;5427:25:31;;;5468:18;;;5461:34;;;;1434:4:12;;-1:-1:-1;;;;;1481:9:12;;:44;;5400:18:31;;1481:72:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1474:79;1369:201;-1:-1:-1;;1369:201:12:o;2838:100:18:-;1094:13:0;:11;:13::i;:::-;2908:15:18::1;:23:::0;;::::1;::::0;;::::1;::::0;::::1;-1:-1:-1::0;;2908:23:18;;::::1;::::0;;;::::1;::::0;;2838:100::o;721:116:12:-;1094:13:0;:11;:13::i;:::-;801:17:12::1;::::0;;;:8:::1;:17;::::0;;;;;:29;721:116::o;1831:101:0:-;1094:13;:11;:13::i;:::-;1895:30:::1;1922:1;1895:18;:30::i;:::-;1831:101::o:0;3048:150:18:-;1094:13:0;:11;:13::i;:::-;3147:33:18::1;::::0;;::::1;;::::0;;;:23:::1;:33;::::0;;;;:44;3048:150::o;2944:98::-;1094:13:0;:11;:13::i;:::-;3014::18::1;:21:::0;2944:98::o;974:103:12:-;1094:13:0;:11;:13::i;:::-;1048:9:12::1;:22:::0;;-1:-1:-1;;1048:22:12::1;-1:-1:-1::0;;;;;1048:22:12;;;::::1;::::0;;;::::1;::::0;;974:103::o;1448:712:18:-;1542:7;1527;1535:1;1527:10;1521:28;1513:73;;;;-1:-1:-1;;;1513:73:18;;6086:2:31;1513:73:18;;;6068:21:31;;;6105:18;;;6098:30;6164:34;6144:18;;;6137:62;6216:18;;1513:73:18;5884:356:31;1513:73:18;1604:13;;1624:7;1632:1;1624:10;1604:32;;;;;;;:::i;:::-;;;;:37;;1640:1;1604:37;1596:78;;;;-1:-1:-1;;;1596:78:18;;6447:2:31;1596:78:18;;;6429:21:31;6486:2;6466:18;;;6459:30;6525;6505:18;;;6498:58;6573:18;;1596:78:18;6245:352:31;1596:78:18;1684:25;1172:21:24;;;1742:10:18;1213:4:24;1206:20;1483:4;1467:21;;1510:66;1442:169;1323:66;1269:155;;1249:376;1780:5:18;;1846:35;;;;;;;6731:19:31;;;1846:35:18;;;;;;;;;;6766:12:31;;;1846:35:18;;;;1814:85;;;;6731:19:31;;-1:-1:-1;1780:5:18;;;;1764:13;;-1:-1:-1;;;;;1814:8:18;:23;;;;:85;;1780:5;;1846:35;1883:15;;;;;;;;;;1814:85;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1934:5;:18;;-1:-1:-1;;1934:18:18;1951:1;1942:10;;1934:18;;;;;-1:-1:-1;1981:31:18;;;:12;:31;;;;;;1796:103;;-1:-1:-1;1981:36:18;1973:79;;;;-1:-1:-1;;;1973:79:18;;8298:2:31;1973:79:18;;;8280:21:31;8337:2;8317:18;;;8310:30;8376:32;8356:18;;;8349:60;8426:18;;1973:79:18;8096:354:31;1973:79:18;2062:31;;;;:12;:31;;;;;;;;;2096:1;2062:35;;2113:40;;8629:18:31;8617:31;;8599:50;;2062:31:18;;2113:40;;8572:18:31;2113:40:18;;;;;;;1503:657;;;1448:712;:::o;2081:198:0:-;1094:13;:11;:13::i;:::-;-1:-1:-1;;;;;2169:22:0;::::1;2161:73;;;::::0;-1:-1:-1;;;2161:73:0;;8862:2:31;2161:73:0::1;::::0;::::1;8844:21:31::0;8901:2;8881:18;;;8874:30;8940:34;8920:18;;;8913:62;9011:8;8991:18;;;8984:36;9037:19;;2161:73:0::1;8660:402:31::0;2161:73:0::1;2244:28;2263:8;2244:18;:28::i;:::-;2081:198:::0;:::o;2166:666:18:-;2235:22;2259:10;2271:20;2295:8;-1:-1:-1;;;;;2295:25:18;;2321:10;2295:37;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;2295:37:18;;;;;;;;;;;;:::i;:::-;2234:98;;;;;;2351:5;2358:6;2343:22;;;;;-1:-1:-1;;;2343:22:18;;;;;;;;:::i;:::-;;2383:2;:10;;;:17;2404:2;2383:23;2375:67;;;;-1:-1:-1;;;2375:67:18;;13867:2:31;2375:67:18;;;13849:21:31;13906:2;13886:18;;;13879:30;13945:33;13925:18;;;13918:61;13996:18;;2375:67:18;13665:355:31;2375:67:18;2453:25;2489:2;:10;;;2481:19;;;:::i;:::-;2453:47;-1:-1:-1;2549:7:18;2453:47;2542:1;2524:20;2518:38;2510:83;;;;-1:-1:-1;;;2510:83:18;;6086:2:31;2510:83:18;;;6068:21:31;;;6105:18;;;6098:30;6164:34;6144:18;;;6137:62;6216:18;;2510:83:18;5884:356:31;2510:83:18;2658:17;;;;2636;;;;2612:42;;;;;;:23;:42;;;;;;:63;2604:108;;;;-1:-1:-1;;;2604:108:18;;14529:2:31;2604:108:18;;;14511:21:31;;;14548:18;;;14541:30;14607:34;14587:18;;;14580:62;14659:18;;2604:108:18;14327:356:31;2604:108:18;2723:35;;;;:16;:35;;;;;;;;;2761:1;2723:39;;2813:11;;;;2778:47;;8629:18:31;8617:31;;;8599:50;;2723:35:18;;2778:47;;8572:18:31;2778:47:18;;;;;;;2224:608;;;;2166:666;:::o;1359:130:0:-;1247:7;1273:6;-1:-1:-1;;;;;1273:6:0;719:10:7;1422:23:0;1414:68;;;;-1:-1:-1;;;1414:68:0;;14890:2:31;1414:68:0;;;14872:21:31;;;14909:18;;;14902:30;14968:34;14948:18;;;14941:62;15020:18;;1414:68:0;14688:356:31;2433:187:0;2506:16;2525:6;;-1:-1:-1;;;;;2541:17:0;;;-1:-1:-1;;2541:17:0;;;;;;2573:40;;2525:6;;;;;;;2573:40;;2506:16;2573:40;2496:124;2433:187;:::o;656:180:31:-;715:6;768:2;756:9;747:7;743:23;739:32;736:52;;;784:1;781;774:12;736:52;-1:-1:-1;807:23:31;;656:180;-1:-1:-1;656:180:31:o;1023:114::-;1107:4;1100:5;1096:16;1089:5;1086:27;1076:55;;1127:1;1124;1117:12;1142:243;1199:6;1252:2;1240:9;1231:7;1227:23;1223:32;1220:52;;;1268:1;1265;1258:12;1220:52;1307:9;1294:23;1326:29;1349:5;1326:29;:::i;:::-;1374:5;1142:243;-1:-1:-1;;;1142:243:31:o;1572:248::-;1640:6;1648;1701:2;1689:9;1680:7;1676:23;1672:32;1669:52;;;1717:1;1714;1707:12;1669:52;-1:-1:-1;;1740:23:31;;;1810:2;1795:18;;;1782:32;;-1:-1:-1;1572:248:31:o;1825:117::-;1910:6;1903:5;1899:18;1892:5;1889:29;1879:57;;1932:1;1929;1922:12;1947:313;2014:6;2022;2075:2;2063:9;2054:7;2050:23;2046:32;2043:52;;;2091:1;2088;2081:12;2043:52;2130:9;2117:23;2149:30;2173:5;2149:30;:::i;:::-;2198:5;2250:2;2235:18;;;;2222:32;;-1:-1:-1;;;1947:313:31:o;2681:166::-;-1:-1:-1;;;;;2772:5:31;2768:54;2761:5;2758:65;2748:93;;2837:1;2834;2827:12;2852:278;2930:6;2983:2;2971:9;2962:7;2958:23;2954:32;2951:52;;;2999:1;2996;2989:12;2951:52;3038:9;3025:23;3057:43;3094:5;3057:43;:::i;3399:184::-;-1:-1:-1;;;3448:1:31;3441:88;3548:4;3545:1;3538:15;3572:4;3569:1;3562:15;3588:253;3660:2;3654:9;3702:4;3690:17;;3737:18;3722:34;;3758:22;;;3719:62;3716:88;;;3784:18;;:::i;:::-;3820:2;3813:22;3588:253;:::o;3846:255::-;3918:2;3912:9;3960:6;3948:19;;3997:18;3982:34;;4018:22;;;3979:62;3976:88;;;4044:18;;:::i;4106:275::-;4177:2;4171:9;4242:2;4223:13;;-1:-1:-1;;4219:27:31;4207:40;;4277:18;4262:34;;4298:22;;;4259:62;4256:88;;;4324:18;;:::i;:::-;4360:2;4353:22;4106:275;;-1:-1:-1;4106:275:31:o;4386:186::-;4434:4;4467:18;4459:6;4456:30;4453:56;;;4489:18;;:::i;:::-;-1:-1:-1;4555:2:31;4534:15;-1:-1:-1;;4530:29:31;4561:4;4526:40;;4386:186::o;4577:671::-;4645:6;4698:2;4686:9;4677:7;4673:23;4669:32;4666:52;;;4714:1;4711;4704:12;4666:52;4754:9;4741:23;4787:18;4779:6;4776:30;4773:50;;;4819:1;4816;4809:12;4773:50;4842:22;;4895:4;4887:13;;4883:27;-1:-1:-1;4873:55:31;;4924:1;4921;4914:12;4873:55;4960:2;4947:16;4985:48;5001:31;5029:2;5001:31;:::i;:::-;4985:48;:::i;:::-;5056:2;5049:5;5042:17;5096:7;5091:2;5086;5082;5078:11;5074:20;5071:33;5068:53;;;5117:1;5114;5107:12;5068:53;5172:2;5167;5163;5159:11;5154:2;5147:5;5143:14;5130:45;5216:1;5195:14;;;5211:2;5191:23;5184:34;;;;5199:5;4577:671;-1:-1:-1;;;;4577:671:31:o;5506:184::-;5576:6;5629:2;5617:9;5608:7;5604:23;5600:32;5597:52;;;5645:1;5642;5635:12;5597:52;-1:-1:-1;5668:16:31;;5506:184;-1:-1:-1;5506:184:31:o;5695:::-;-1:-1:-1;;;5744:1:31;5737:88;5844:4;5841:1;5834:15;5868:4;5865:1;5858:15;6789:250;6874:1;6884:113;6898:6;6895:1;6892:13;6884:113;;;6974:11;;;6968:18;6955:11;;;6948:39;6920:2;6913:10;6884:113;;;-1:-1:-1;;7031:1:31;7013:16;;7006:27;6789:250::o;7044:270::-;7085:3;7123:5;7117:12;7150:6;7145:3;7138:19;7166:76;7235:6;7228:4;7223:3;7219:14;7212:4;7205:5;7201:16;7166:76;:::i;:::-;7296:2;7275:15;-1:-1:-1;;7271:29:31;7262:39;;;;7303:4;7258:50;;7044:270;-1:-1:-1;;7044:270:31:o;7319:381::-;7528:10;7520:6;7516:23;7505:9;7498:42;7576:2;7571;7560:9;7556:18;7549:30;7479:4;7596:44;7636:2;7625:9;7621:18;7613:6;7596:44;:::i;:::-;7588:52;;7688:4;7680:6;7676:17;7671:2;7660:9;7656:18;7649:45;7319:381;;;;;;:::o;7705:175::-;7783:13;;7836:18;7825:30;;7815:41;;7805:69;;7870:1;7867;7860:12;7805:69;7705:175;;;:::o;7885:206::-;7954:6;8007:2;7995:9;7986:7;7982:23;7978:32;7975:52;;;8023:1;8020;8013:12;7975:52;8046:39;8075:9;8046:39;:::i;9067:217::-;9214:2;9203:9;9196:21;9177:4;9234:44;9274:2;9263:9;9259:18;9251:6;9234:44;:::i;9289:134::-;9366:13;;9388:29;9366:13;9388:29;:::i;9428:167::-;9506:13;;9559:10;9548:22;;9538:33;;9528:61;;9585:1;9582;9575:12;9600:136;9678:13;;9700:30;9678:13;9700:30;:::i;9741:441::-;9794:5;9847:3;9840:4;9832:6;9828:17;9824:27;9814:55;;9865:1;9862;9855:12;9814:55;9894:6;9888:13;9925:48;9941:31;9969:2;9941:31;:::i;9925:48::-;9998:2;9989:7;9982:19;10044:3;10037:4;10032:2;10024:6;10020:15;10016:26;10013:35;10010:55;;;10061:1;10058;10051:12;10010:55;10074:77;10148:2;10141:4;10132:7;10128:18;10121:4;10113:6;10109:17;10074:77;:::i;:::-;10169:7;9741:441;-1:-1:-1;;;;9741:441:31:o;10187:1291::-;10261:5;10314:3;10307:4;10299:6;10295:17;10291:27;10281:55;;10332:1;10329;10322:12;10281:55;10361:6;10355:13;10387:4;10410:18;10406:2;10403:26;10400:52;;;10432:18;;:::i;:::-;10472:36;10504:2;10499;10496:1;10492:10;10488:19;10472:36;:::i;:::-;10542:15;;;10628:1;10624:10;;;;10612:23;;10608:32;;;10573:12;;;;10652:15;;;10649:35;;;10680:1;10677;10670:12;10649:35;10716:2;10708:6;10704:15;10728:721;10744:6;10739:3;10736:15;10728:721;;;10822:4;10816:3;10811;10807:13;10803:24;10800:114;;;10868:1;10897:2;10893;10886:14;10800:114;10940:22;;:::i;:::-;10995:3;10989:10;10982:5;10975:25;11051:2;11046:3;11042:12;11036:19;11031:2;11024:5;11020:14;11013:43;11079:2;11124;11119:3;11115:12;11109:19;11141:31;11164:7;11141:31;:::i;:::-;11192:14;;;11185:31;11239:2;11275:12;;;11269:19;11301:31;11269:19;11301:31;:::i;:::-;11352:14;;;11345:31;11389:18;;11427:12;;;;10770:4;10761:14;10728:721;;;-1:-1:-1;11467:5:31;10187:1291;-1:-1:-1;;;;;;10187:1291:31:o;11483:164::-;11559:13;;11608;;11601:21;11591:32;;11581:60;;11637:1;11634;11627:12;11652:1784;11767:6;11775;11783;11836:2;11824:9;11815:7;11811:23;11807:32;11804:52;;;11852:1;11849;11842:12;11804:52;11885:9;11879:16;11914:18;11955:2;11947:6;11944:14;11941:34;;;11971:1;11968;11961:12;11941:34;11994:22;;;;12050:6;12032:16;;;12028:29;12025:49;;;12070:1;12067;12060:12;12025:49;12096:22;;:::i;:::-;12141:31;12169:2;12141:31;:::i;:::-;12134:5;12127:46;12205:41;12242:2;12238;12234:11;12205:41;:::i;:::-;12200:2;12193:5;12189:14;12182:65;12279:41;12316:2;12312;12308:11;12279:41;:::i;:::-;12274:2;12267:5;12263:14;12256:65;12353:41;12390:2;12386;12382:11;12353:41;:::i;:::-;12348:2;12341:5;12337:14;12330:65;12442:3;12438:2;12434:12;12428:19;12422:3;12415:5;12411:15;12404:44;12481:42;12518:3;12514:2;12510:12;12481:42;:::i;:::-;12475:3;12468:5;12464:15;12457:67;12557:41;12593:3;12589:2;12585:12;12557:41;:::i;:::-;12551:3;12544:5;12540:15;12533:66;12638:3;12634:2;12630:12;12624:19;12668:2;12658:8;12655:16;12652:36;;;12684:1;12681;12674:12;12652:36;12721:55;12768:7;12757:8;12753:2;12749:17;12721:55;:::i;:::-;12715:3;12708:5;12704:15;12697:80;;12796:3;12831:41;12868:2;12864;12860:11;12831:41;:::i;:::-;12815:14;;;12808:65;12892:3;12926:11;;;12920:18;12950:16;;;12947:36;;;12979:1;12976;12969:12;12947:36;13015:76;13083:7;13072:8;13068:2;13064:17;13015:76;:::i;:::-;12999:14;;;12992:100;;;;-1:-1:-1;13111:3:31;13152:11;;;13146:18;13130:14;;;13123:42;13003:5;-1:-1:-1;13208:46:31;13250:2;13235:18;;13208:46;:::i;:::-;13198:56;;13300:2;13289:9;13285:18;13279:25;13263:41;;13329:2;13319:8;13316:16;13313:36;;;13345:1;13342;13335:12;13313:36;;13368:62;13422:7;13411:8;13400:9;13396:24;13368:62;:::i;:::-;13358:72;;;11652:1784;;;;;:::o;14025:297::-;14143:12;;14190:4;14179:16;;;14173:23;;14143:12;14208:16;;14205:111;;;14302:1;14298:6;14288;14282:4;14278:17;14275:1;14271:25;14267:38;14260:5;14256:50;14247:59;;14205:111;;14025:297;;;:::o
Swarm Source
ipfs://4a7b7ebd47197665534a7f63b0546ff87ef7ce726b42918c22c10f66d24d758f
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.04
Net Worth in ETH
0.000012
Token Allocations
ETH
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $3,026.23 | 0.00001205 | $0.036466 |
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.