Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 81 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Sync Merkle Root | 24542075 | 5 days ago | IN | 0 ETH | 0.00004758 | ||||
| Sync Merkle Root | 24542072 | 5 days ago | IN | 0 ETH | 0.00005249 | ||||
| Sync Merkle Root | 24542069 | 5 days ago | IN | 0 ETH | 0.00004811 | ||||
| Sync Merkle Root | 24542016 | 5 days ago | IN | 0 ETH | 0.00005624 | ||||
| Sync Merkle Root | 24542007 | 5 days ago | IN | 0 ETH | 0.00005076 | ||||
| Sync Merkle Root | 24542000 | 5 days ago | IN | 0 ETH | 0.00005307 | ||||
| Sync Merkle Root | 24541998 | 5 days ago | IN | 0 ETH | 0.00005446 | ||||
| Sync Merkle Root | 24541997 | 5 days ago | IN | 0 ETH | 0.00005475 | ||||
| Settle And Relea... | 24541993 | 5 days ago | IN | 0 ETH | 0.00004506 | ||||
| Sync Merkle Root | 24541928 | 5 days ago | IN | 0 ETH | 0.00002863 | ||||
| Sync Merkle Root | 24541922 | 5 days ago | IN | 0 ETH | 0.00003216 | ||||
| Sync Merkle Root | 24541920 | 5 days ago | IN | 0 ETH | 0.00003632 | ||||
| Sync Merkle Root | 24541916 | 5 days ago | IN | 0 ETH | 0.00003477 | ||||
| Sync Merkle Root | 24541903 | 5 days ago | IN | 0 ETH | 0.00003839 | ||||
| Sync Merkle Root | 24541891 | 5 days ago | IN | 0 ETH | 0.00004073 | ||||
| Sync Merkle Root | 24541888 | 5 days ago | IN | 0 ETH | 0.00004166 | ||||
| Sync Merkle Root | 24541851 | 5 days ago | IN | 0 ETH | 0.00005592 | ||||
| Sync Merkle Root | 24536999 | 5 days ago | IN | 0 ETH | 0.00001409 | ||||
| Sync Merkle Root | 24536992 | 5 days ago | IN | 0 ETH | 0.00001413 | ||||
| Sync Merkle Root | 24536991 | 5 days ago | IN | 0 ETH | 0.00001425 | ||||
| Sync Merkle Root | 24536989 | 5 days ago | IN | 0 ETH | 0.00001306 | ||||
| Sync Merkle Root | 24536985 | 5 days ago | IN | 0 ETH | 0.00001397 | ||||
| Sync Merkle Root | 24536982 | 5 days ago | IN | 0 ETH | 0.00001391 | ||||
| Sync Merkle Root | 24536954 | 5 days ago | IN | 0 ETH | 0.00000837 | ||||
| Sync Merkle Root | 24536948 | 5 days ago | IN | 0 ETH | 0.00000844 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 24536926 | 5 days ago | 0.00012808 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ShadowSettlement
Compiler Version
v0.8.29+commit.ab55807c
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* @title ShadowSettlement
* @notice Privacy-preserving cross-chain settlement contract (EVM side)
* @dev Bidirectional — acts as SOURCE (commitment storage) and DESTINATION (token release)
*
* ARCHITECTURE:
* - Source side: Relayer batches commitments into Merkle tree for anonymity set
* - Destination side: NEAR 1Click bridges tokens TO this contract via standard
* ERC20 transfer, then relayer verifies delivery and calls settleAndRelease
* - Cross-chain sync: Stores remote chain Merkle roots for auditability
* - Per-user view keys for private tracking (derived from wallet signature)
*
* TOKEN FLOW (when this chain is DESTINATION):
* 1. User initiates swap on source chain → commitment stored in source Merkle tree
* 2. User sends tokens to NEAR 1Click via unique depositAddress
* 3. NEAR 1Click swaps + bridges → tokens arrive at THIS contract via standard ERC20 transfer
* 4. Relayer polls NEAR status API → gets destinationChainTxHashes
* 5. Relayer verifies Transfer event on-chain (correct amount to this contract)
* 6. Relayer calls settleAndRelease(nullifier, recipient, token, amount)
* → Contract verifies nullifier, transfers ERC20 to user
* 7. Relayer calls markSettled(commitment, nullifier) on SOURCE chain contract
*
* TRUST MODEL:
* - Relayer trusted to verify NEAR delivery before releasing (centralized MVP)
* - Relayer cannot double-spend (nullifier prevents)
* - Relayer cannot release more than contract balance (safeTransfer reverts)
* - Owner can pause in emergencies and manage relayers
*
* PRIVACY:
* - View keys are NEVER exposed on-chain or in events
* - NEAR intent IDs stored internally, not publicly queryable
* - Commitment tree position not leaked in events
* - Batch fill level not leaked in events
* - settleAndRelease reveals recipient but NOT linked to source commitment
* (same model as Tornado Cash withdrawals)
*
* COMMITMENT FORMULA (enforced client-side):
* Frontend MUST generate commitments as:
* commitment = keccak256(abi.encodePacked(secret, nullifier, amount, token, destChain))
*
* Including amount, token, and destChain prevents:
* - Cross-swap attacks (same secret can't be reused for different amounts/chains)
* - Commitment reuse across different swap parameters
* - This is the industry standard (Tornado Cash, Aztec, etc.)
*
* Note: Contract does NOT validate the commitment formula (it's a hash).
* Security comes from frontend generating correctly + Merkle proof verification.
*/
contract ShadowSettlement is ReentrancyGuard, Ownable, Pausable {
using SafeERC20 for IERC20;
// ===== STRUCTS =====
/// @dev Internal struct — never returned to external callers with viewKey
struct Intent {
bytes32 commitment;
bytes32 nearIntentsId;
bytes32 viewKey;
uint64 submittedAt;
bool settled;
}
/// @notice Public-safe intent data (no viewKey, no nearIntentsId)
struct IntentPublic {
bytes32 commitment;
uint64 submittedAt;
bool settled;
}
/// @notice Full intent data returned to view key holder
struct IntentDetail {
bytes32 commitment;
bytes32 nearIntentsId;
uint64 submittedAt;
bool settled;
}
/// @notice Remote chain Merkle root snapshot
struct RemoteRootSnapshot {
bytes32 root;
uint256 leafCount;
uint64 syncedAt;
bool verified;
}
// ===== STATE VARIABLES =====
// --- Source side (commitment storage) ---
/// @dev Internal — use getIntent() which strips sensitive fields
mapping(bytes32 => Intent) internal intents;
mapping(bytes32 => bool) public usedNullifiers;
/// @dev Internal — only queryable by providing the correct view key
mapping(bytes32 => bytes32[]) internal viewKeyToCommitments;
uint256 public constant TREE_HEIGHT = 20;
uint256 public nextLeafIndex;
mapping(uint256 => bytes32) internal filledSubtrees;
bytes32 public currentRoot;
bytes32[TREE_HEIGHT] internal zeros;
/// @dev Internal — tree position is privacy-sensitive
mapping(bytes32 => uint256) internal commitmentToIndex;
/// @dev Mapping-based batch avoids gas bomb on delete
mapping(uint256 => bytes32) internal batchCommitments;
mapping(uint256 => bytes32) internal batchNearIntentsIds;
mapping(uint256 => bytes32) internal batchViewKeys;
uint256 public batchCount;
uint64 public batchFirstSubmissionTime;
// --- Cross-chain sync ---
/// @notice Remote chain identifier → root snapshot history
/// @dev chainId examples: "starknet-mainnet", "starknet-sepolia"
mapping(string => RemoteRootSnapshot[]) public remoteRootHistory;
/// @notice Quick lookup: chainId → latest root index
mapping(string => uint256) public latestRemoteRootIndex;
/// @notice Trusted root verifiers (can mark roots as verified)
mapping(address => bool) public rootVerifiers;
// --- Destination side (token release) ---
/// @notice Whitelisted tokens for settlement
mapping(address => bool) public whitelistedTokens;
// --- Config ---
uint256 public batchSize;
uint256 public batchTimeout;
mapping(address => bool) public authorizedRelayers;
// ===== CONSTANTS =====
uint256 public constant MIN_BATCH_SIZE = 1;
uint256 public constant MAX_BATCH_SIZE = 100;
uint256 public constant DEFAULT_BATCH_SIZE = 10;
uint256 public constant DEFAULT_TIMEOUT = 30;
/// @notice Sentinel address representing native ETH (industry standard)
address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// ===== EVENTS =====
// --- Source side events ---
/// @notice Emits only commitment hash — no tree position, no batch info
event CommitmentAdded(bytes32 indexed commitment);
event BatchProcessed(
uint256 indexed batchId,
uint256 commitmentsCount,
ProcessReason reason
);
event MerkleRootUpdated(bytes32 indexed newRoot);
/// @notice Source-side: commitment marked settled after dest-side release
event IntentMarkedSettled(
bytes32 indexed nullifierHash,
bytes32 indexed commitment,
uint64 timestamp
);
// --- Cross-chain sync events ---
event RemoteRootSynced(
string indexed chainId,
bytes32 indexed root,
uint256 leafCount,
uint256 snapshotIndex
);
event RemoteRootVerified(
string indexed chainId,
uint256 indexed snapshotIndex,
address verifier
);
// --- Destination side events ---
/// @notice Emitted when tokens are released to user
/// @dev recipient is visible but NOT linked to source commitment on-chain
event IntentSettled(
bytes32 indexed intentId,
bytes32 indexed nullifierHash,
address token,
uint256 amount,
uint64 timestamp
);
// --- Admin events ---
event BatchConfigUpdated(uint256 newBatchSize, uint256 newTimeout);
event RelayerStatusChanged(address indexed relayer, bool authorized);
event RootVerifierStatusChanged(address indexed verifier, bool authorized);
event TokenWhitelistUpdated(address indexed token, bool whitelisted);
// ===== ENUMS =====
enum ProcessReason {
BATCH_FULL,
TIMEOUT_REACHED
}
// ===== ERRORS =====
error Unauthorized();
error InvalidBatchSize();
error InvalidTimeout();
error CommitmentExists();
error CommitmentNotFound();
error NullifierUsed();
error BatchEmpty();
error InvalidCommitment();
error TreeFull();
error TimeoutNotReached();
error TokenNotWhitelisted();
error InvalidAmount();
error InvalidRecipient();
error InvalidChainId();
error InvalidRoot();
error RootAlreadyVerified();
error SnapshotNotFound();
error TokenWhitelistUnchanged();
error TransferFailed();
// ===== MODIFIERS =====
modifier onlyRelayer() {
if (!authorizedRelayers[msg.sender]) revert Unauthorized();
_;
}
modifier onlyRootVerifier() {
if (!rootVerifiers[msg.sender]) revert Unauthorized();
_;
}
// ===== CONSTRUCTOR =====
constructor(address _owner, address _initialRelayer) Ownable(_owner) {
authorizedRelayers[_initialRelayer] = true;
rootVerifiers[_initialRelayer] = true;
batchSize = DEFAULT_BATCH_SIZE;
batchTimeout = DEFAULT_TIMEOUT;
zeros[0] = bytes32(0);
for (uint256 i = 1; i < TREE_HEIGHT; i++) {
zeros[i] = _hashPair(zeros[i - 1], zeros[i - 1]);
}
}
/// @notice Accept native ETH — NEAR bridge delivers ETH directly to this contract
receive() external payable {}
/// @notice Reject unknown calls with calldata
fallback() external {
revert("Unknown function");
}
// ==============================================================
// SOURCE SIDE FUNCTIONS
// (when this chain is where the user starts)
// ==============================================================
/**
* @notice Add commitment to pending batch
* @dev Called by relayer when user submits intent via API.
* Commitment is opaque bytes32 generated client-side:
* commitment = Poseidon(secret, nullifier, amount, destChain)
*
* @param commitment Privacy commitment (opaque bytes32 from client)
* @param nearIntentsId NEAR Intents tracking ID (internal, not publicly exposed)
* @param viewKey Optional per-user view key (bytes32(0) to skip)
*/
function addToPendingBatch(
bytes32 commitment,
bytes32 nearIntentsId,
bytes32 viewKey
) external onlyRelayer whenNotPaused {
if (commitment == bytes32(0)) revert InvalidCommitment();
if (intents[commitment].commitment != bytes32(0))
revert CommitmentExists();
if (nextLeafIndex >= (uint256(1) << TREE_HEIGHT)) revert TreeFull();
uint256 count = batchCount;
if (count == 0) {
batchFirstSubmissionTime = uint64(block.timestamp);
}
batchCommitments[count] = commitment;
batchNearIntentsIds[count] = nearIntentsId;
batchViewKeys[count] = viewKey;
batchCount = count + 1;
emit CommitmentAdded(commitment);
if (count + 1 >= batchSize) {
_processBatch(ProcessReason.BATCH_FULL);
}
}
/**
* @notice Process batch if timeout reached
* @dev Anyone can call — ensures liveness even if relayer is slow.
* Processes even single-item batches (liveness > privacy).
*/
function processBatchIfTimeout() external whenNotPaused {
if (batchCount == 0) revert BatchEmpty();
uint256 timeSinceFirst = block.timestamp - batchFirstSubmissionTime;
if (timeSinceFirst < batchTimeout) revert TimeoutNotReached();
_processBatch(ProcessReason.TIMEOUT_REACHED);
}
/**
* @notice Internal batch processing
* @dev Registers all pending commitments in Merkle tree.
* View key mapping is written here
* to ensure Intent struct exists before viewKey queries work.
*/
function _processBatch(ProcessReason reason) internal {
uint256 count = batchCount;
if (count == 0) revert BatchEmpty();
for (uint256 i = 0; i < count; i++) {
bytes32 commitment = batchCommitments[i];
bytes32 nearIntentsId = batchNearIntentsIds[i];
bytes32 viewKey = batchViewKeys[i];
intents[commitment] = Intent({
commitment: commitment,
nearIntentsId: nearIntentsId,
viewKey: viewKey,
submittedAt: uint64(block.timestamp),
settled: false
});
_insertCommitment(commitment);
if (viewKey != bytes32(0)) {
viewKeyToCommitments[viewKey].push(commitment);
}
}
emit BatchProcessed(nextLeafIndex, count, reason);
emit MerkleRootUpdated(currentRoot);
batchCount = 0;
}
/**
* @notice Mark a source-side commitment as settled
* @dev Called by relayer AFTER tokens were released on the destination chain.
* This updates the source-side intent status so view key queries
* reflect the completed settlement. Runs on the chain where the
* commitment was originally stored (source chain).
*
* Flow: settleAndRelease (dest) → relayer confirms → markSettled (source)
*
* @param commitment Intent commitment (must exist in this contract's tree)
* @param nullifierHash Hash of nullifier (prevents double-marking)
*/
function markSettled(
bytes32 commitment,
bytes32 nullifierHash
) external onlyRelayer whenNotPaused {
Intent storage intent = intents[commitment];
if (intent.commitment == bytes32(0)) revert CommitmentNotFound();
if (usedNullifiers[nullifierHash]) revert NullifierUsed();
intent.settled = true;
usedNullifiers[nullifierHash] = true;
emit IntentMarkedSettled(
nullifierHash,
commitment,
uint64(block.timestamp)
);
}
// ==============================================================
// CROSS-CHAIN SYNC FUNCTIONS
// ==============================================================
/**
* @notice Sync Merkle root from remote chain (e.g., StarkNet)
* @dev Called by relayer to store remote chain state for auditability.
* Enables cross-verification that commitments exist on both chains.
*
* @param chainId Remote chain identifier (e.g., "starknet-mainnet")
* @param root Merkle root from remote chain
* @param leafCount Number of commitments in remote tree at time of sync
*/
function syncMerkleRoot(
string calldata chainId,
bytes32 root,
uint256 leafCount
) external onlyRelayer whenNotPaused {
if (bytes(chainId).length == 0) revert InvalidChainId();
if (root == bytes32(0)) revert InvalidRoot();
if (leafCount == 0) revert InvalidAmount();
RemoteRootSnapshot memory snapshot = RemoteRootSnapshot({
root: root,
leafCount: leafCount,
syncedAt: uint64(block.timestamp),
verified: false
});
remoteRootHistory[chainId].push(snapshot);
uint256 newIndex = remoteRootHistory[chainId].length - 1;
latestRemoteRootIndex[chainId] = newIndex;
emit RemoteRootSynced(chainId, root, leafCount, newIndex);
}
/**
* @notice Mark a synced root as verified
* @dev Called by trusted verifier (could be oracle, bridge, or multi-sig).
* Once verified, root is considered authoritative.
*
* @param chainId Remote chain identifier
* @param snapshotIndex Index in remoteRootHistory array
*/
function verifyRemoteRoot(
string calldata chainId,
uint256 snapshotIndex
) external onlyRootVerifier whenNotPaused {
RemoteRootSnapshot[] storage snapshots = remoteRootHistory[chainId];
if (snapshotIndex >= snapshots.length) revert SnapshotNotFound();
RemoteRootSnapshot storage snapshot = snapshots[snapshotIndex];
if (snapshot.verified) revert RootAlreadyVerified();
snapshot.verified = true;
emit RemoteRootVerified(chainId, snapshotIndex, msg.sender);
}
// ==============================================================
// DESTINATION SIDE FUNCTIONS
// (when this chain is where the user receives)
// ==============================================================
/**
* @notice Release tokens to user after NEAR bridge delivery is verified
* @dev Called by relayer after confirming token arrival via:
* 1. Poll NEAR status API → get destinationChainTxHashes
* 2. Verify Transfer event on-chain (amount + recipient = this contract)
* 3. Call this function to release tokens to user
*
* No on-chain deposit tracking — tokens arrive via standard ERC20
* transfer from NEAR 1Click bridge infrastructure. Relayer verifies
* the exact amount off-chain before calling.
*
* PRIVACY:
* - recipient address visible on-chain in this call
* - NOT linked to any source-chain commitment on-chain
* - Link exists only in relayer's off-chain DB
* - Same model as Tornado Cash withdrawals
*
* @param nullifierHash Hash of nullifier (prevents double-settlement)
* @param recipient User's destination address on this chain
* @param token ERC20 token to release
* @param amount Amount to release (verified by relayer against NEAR status)
*/
function settleAndRelease(
bytes32 intentId,
bytes32 nullifierHash,
address recipient,
address token,
uint256 amount
) external onlyRelayer nonReentrant whenNotPaused {
if (usedNullifiers[nullifierHash]) revert NullifierUsed();
if (recipient == address(0)) revert InvalidRecipient();
if (!whitelistedTokens[token]) revert TokenNotWhitelisted();
if (amount == 0) revert InvalidAmount();
usedNullifiers[nullifierHash] = true;
if (token == ETH) {
(bool ok, ) = payable(recipient).call{value: amount}("");
if (!ok) revert TransferFailed();
} else {
IERC20(token).safeTransfer(recipient, amount);
}
emit IntentSettled(
intentId,
nullifierHash,
token,
amount,
uint64(block.timestamp)
);
}
// ===== MERKLE TREE FUNCTIONS =====
/**
* @notice Insert commitment into incremental Merkle tree
* @dev Relayer replicates this logic off-chain for proof generation.
* Uses sorted hashing to prevent sibling-position leaks.
*/
function _insertCommitment(bytes32 commitment) internal {
uint256 index = nextLeafIndex;
commitmentToIndex[commitment] = index;
nextLeafIndex++;
bytes32 currentHash = commitment;
bytes32 left;
bytes32 right;
for (uint256 height = 0; height < TREE_HEIGHT; height++) {
if (index & 1 == 0) {
left = currentHash;
right = zeros[height];
filledSubtrees[height] = currentHash;
} else {
left = filledSubtrees[height];
right = currentHash;
}
currentHash = _hashPair(left, right);
index >>= 1;
}
currentRoot = currentHash;
}
function getMerkleRoot() external view returns (bytes32) {
return currentRoot;
}
/**
* @notice Hash pair of nodes with deterministic ordering
* @dev Sorted to prevent sibling-position information leaks
*/
function _hashPair(bytes32 a, bytes32 b) internal pure returns (bytes32) {
return
a < b
? keccak256(abi.encodePacked(a, b))
: keccak256(abi.encodePacked(b, a));
}
// ===== VIEW KEY FUNCTIONS =====
/**
* @notice Get intents for a view key with pagination (full details)
* @dev View key IS the auth — if you have it, you see everything.
* Returns empty array if view key has no intents (prevents existence probing).
* Compliance responsibility lies with the user via their view key.
*
* @param viewKey Per-user view key (derived from wallet signature client-side)
* @param offset Start index (0-based)
* @param limit Max results to return (0 = all from offset)
* @return userIntents Array of intent details for the requested page
* @return total Total number of intents for this view key
*/
function getIntentsByViewKey(
bytes32 viewKey,
uint256 offset,
uint256 limit
) external view returns (IntentDetail[] memory userIntents, uint256 total) {
bytes32[] storage commitments = viewKeyToCommitments[viewKey];
total = commitments.length;
if (total == 0 || offset >= total) {
userIntents = new IntentDetail[](0);
return (userIntents, total);
}
uint256 remaining = total - offset;
uint256 count = (limit == 0 || limit > remaining) ? remaining : limit;
userIntents = new IntentDetail[](count);
for (uint256 i = 0; i < count; i++) {
Intent storage intent = intents[commitments[offset + i]];
userIntents[i] = IntentDetail({
commitment: intent.commitment,
nearIntentsId: intent.nearIntentsId,
submittedAt: intent.submittedAt,
settled: intent.settled
});
}
return (userIntents, total);
}
// ===== PUBLIC VIEW FUNCTIONS =====
function getIntent(
bytes32 commitment
) external view returns (IntentPublic memory info) {
Intent storage intent = intents[commitment];
if (intent.commitment == bytes32(0)) revert CommitmentNotFound();
info = IntentPublic({
commitment: intent.commitment,
submittedAt: intent.submittedAt,
settled: intent.settled
});
}
function commitmentExists(
bytes32 commitment
) external view returns (bool exists) {
return intents[commitment].commitment != bytes32(0);
}
function isNullifierUsed(bytes32 nullifier) external view returns (bool) {
return usedNullifiers[nullifier];
}
function getPendingBatchInfo()
external
view
returns (
uint256 count,
uint64 firstSubmissionTime,
uint256 timeRemaining
)
{
count = batchCount;
firstSubmissionTime = batchFirstSubmissionTime;
if (count > 0) {
uint256 elapsed = block.timestamp - firstSubmissionTime;
timeRemaining = elapsed >= batchTimeout
? 0
: batchTimeout - elapsed;
}
}
function isRelayerAuthorized(address relayer) external view returns (bool) {
return authorizedRelayers[relayer];
}
function isRootVerifier(address verifier) external view returns (bool) {
return rootVerifiers[verifier];
}
function getLatestRemoteRoot(
string calldata chainId
) external view returns (RemoteRootSnapshot memory snapshot) {
RemoteRootSnapshot[] storage snapshots = remoteRootHistory[chainId];
if (snapshots.length == 0) revert SnapshotNotFound();
return snapshots[latestRemoteRootIndex[chainId]];
}
function getLatestVerifiedRemoteRoot(
string calldata chainId
) external view returns (RemoteRootSnapshot memory snapshot, uint256 index) {
RemoteRootSnapshot[] storage snapshots = remoteRootHistory[chainId];
if (snapshots.length == 0) revert SnapshotNotFound();
for (uint256 i = snapshots.length; i > 0; i--) {
if (snapshots[i - 1].verified) {
return (snapshots[i - 1], i - 1);
}
}
revert SnapshotNotFound();
}
function getRemoteRootSnapshot(
string calldata chainId,
uint256 snapshotIndex
) external view returns (RemoteRootSnapshot memory snapshot) {
RemoteRootSnapshot[] storage snapshots = remoteRootHistory[chainId];
if (snapshotIndex >= snapshots.length) revert SnapshotNotFound();
return snapshots[snapshotIndex];
}
function getRemoteRootCount(
string calldata chainId
) external view returns (uint256 count) {
return remoteRootHistory[chainId].length;
}
// ===== ADMIN FUNCTIONS =====
function updateBatchConfig(
uint256 newBatchSize,
uint256 newTimeout
) external onlyOwner {
if (newBatchSize < MIN_BATCH_SIZE || newBatchSize > MAX_BATCH_SIZE) {
revert InvalidBatchSize();
}
if (newTimeout == 0) revert InvalidTimeout();
batchSize = newBatchSize;
batchTimeout = newTimeout;
emit BatchConfigUpdated(newBatchSize, newTimeout);
}
function setRelayerStatus(
address relayer,
bool authorized
) external onlyOwner {
authorizedRelayers[relayer] = authorized;
emit RelayerStatusChanged(relayer, authorized);
}
function setRootVerifierStatus(
address verifier,
bool authorized
) external onlyOwner {
rootVerifiers[verifier] = authorized;
emit RootVerifierStatusChanged(verifier, authorized);
}
/**
* @notice Whitelist or delist a token for settlement
* @param token ERC20 token address
* @param whitelisted True to whitelist, false to delist
*/
function setTokenWhitelist(
address token,
bool whitelisted
) external onlyOwner {
if (whitelistedTokens[token] == whitelisted) revert TokenWhitelistUnchanged();
whitelistedTokens[token] = whitelisted;
emit TokenWhitelistUpdated(token, whitelisted);
}
/**
* @notice Emergency rescue stuck tokens
* @dev Only callable by owner. For recovering tokens from failed NEAR
* bridge transfers or tokens sent to contract by mistake.
*
* @param token ERC20 token address
* @param to Recipient address
* @param amount Amount to rescue
*/
function rescueTokens(
address token,
address to,
uint256 amount
) external onlyOwner {
if (token == ETH) {
(bool ok, ) = payable(to).call{value: amount}("");
if (!ok) revert TransferFailed();
} else {
IERC20(token).safeTransfer(to, amount);
}
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*
* IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced
* by the {ReentrancyGuardTransient} variant in v6.0.
*
* @custom:stateless
*/
abstract contract ReentrancyGuard {
using StorageSlot for bytes32;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
/**
* @dev A `view` only version of {nonReentrant}. Use to block view functions
* from being called, preventing reading from inconsistent contract state.
*
* CAUTION: This is a "view" modifier and does not change the reentrancy
* status. Use it only on view functions. For payable or non-payable functions,
* use the standard {nonReentrant} modifier instead.
*/
modifier nonReentrantView() {
_nonReentrantBeforeView();
_;
}
function _nonReentrantBeforeView() private view {
if (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
_nonReentrantBeforeView();
// Any calls to nonReentrant after this point will fail
_reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;
}
function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {
return REENTRANCY_GUARD_STORAGE;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
if (!_safeTransfer(token, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
if (!_safeTransferFrom(token, from, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _safeTransfer(token, to, value, false);
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _safeTransferFrom(token, from, to, value, false);
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
if (!_safeApprove(token, spender, value, false)) {
if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));
if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity `token.transfer(to, value)` call, 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 to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.transfer.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(to, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
/**
* @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, 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 from The sender of the tokens
* @param to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value,
bool bubble
) private returns (bool success) {
bytes4 selector = IERC20.transferFrom.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(from, shr(96, not(0))))
mstore(0x24, and(to, shr(96, not(0))))
mstore(0x44, value)
success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
mstore(0x60, 0)
}
}
/**
* @dev Imitates a Solidity `token.approve(spender, value)` call, 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 spender The spender of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.approve.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(spender, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"@openzeppelin/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_initialRelayer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BatchEmpty","type":"error"},{"inputs":[],"name":"CommitmentExists","type":"error"},{"inputs":[],"name":"CommitmentNotFound","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidBatchSize","type":"error"},{"inputs":[],"name":"InvalidChainId","type":"error"},{"inputs":[],"name":"InvalidCommitment","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidRoot","type":"error"},{"inputs":[],"name":"InvalidTimeout","type":"error"},{"inputs":[],"name":"NullifierUsed","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"RootAlreadyVerified","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SnapshotNotFound","type":"error"},{"inputs":[],"name":"TimeoutNotReached","type":"error"},{"inputs":[],"name":"TokenNotWhitelisted","type":"error"},{"inputs":[],"name":"TokenWhitelistUnchanged","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TreeFull","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newBatchSize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTimeout","type":"uint256"}],"name":"BatchConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"commitmentsCount","type":"uint256"},{"indexed":false,"internalType":"enum ShadowSettlement.ProcessReason","name":"reason","type":"uint8"}],"name":"BatchProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"commitment","type":"bytes32"}],"name":"CommitmentAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"nullifierHash","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"commitment","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"IntentMarkedSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"intentId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"nullifierHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"IntentSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"MerkleRootUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"bool","name":"authorized","type":"bool"}],"name":"RelayerStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"chainId","type":"string"},{"indexed":true,"internalType":"bytes32","name":"root","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"leafCount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"snapshotIndex","type":"uint256"}],"name":"RemoteRootSynced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"chainId","type":"string"},{"indexed":true,"internalType":"uint256","name":"snapshotIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"verifier","type":"address"}],"name":"RemoteRootVerified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"verifier","type":"address"},{"indexed":false,"internalType":"bool","name":"authorized","type":"bool"}],"name":"RootVerifierStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"TokenWhitelistUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"DEFAULT_BATCH_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_TIMEOUT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BATCH_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_BATCH_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREE_HEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"commitment","type":"bytes32"},{"internalType":"bytes32","name":"nearIntentsId","type":"bytes32"},{"internalType":"bytes32","name":"viewKey","type":"bytes32"}],"name":"addToPendingBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorizedRelayers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batchCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batchFirstSubmissionTime","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batchTimeout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"commitment","type":"bytes32"}],"name":"commitmentExists","outputs":[{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"commitment","type":"bytes32"}],"name":"getIntent","outputs":[{"components":[{"internalType":"bytes32","name":"commitment","type":"bytes32"},{"internalType":"uint64","name":"submittedAt","type":"uint64"},{"internalType":"bool","name":"settled","type":"bool"}],"internalType":"struct ShadowSettlement.IntentPublic","name":"info","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"viewKey","type":"bytes32"},{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getIntentsByViewKey","outputs":[{"components":[{"internalType":"bytes32","name":"commitment","type":"bytes32"},{"internalType":"bytes32","name":"nearIntentsId","type":"bytes32"},{"internalType":"uint64","name":"submittedAt","type":"uint64"},{"internalType":"bool","name":"settled","type":"bool"}],"internalType":"struct ShadowSettlement.IntentDetail[]","name":"userIntents","type":"tuple[]"},{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"chainId","type":"string"}],"name":"getLatestRemoteRoot","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint256","name":"leafCount","type":"uint256"},{"internalType":"uint64","name":"syncedAt","type":"uint64"},{"internalType":"bool","name":"verified","type":"bool"}],"internalType":"struct ShadowSettlement.RemoteRootSnapshot","name":"snapshot","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"chainId","type":"string"}],"name":"getLatestVerifiedRemoteRoot","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint256","name":"leafCount","type":"uint256"},{"internalType":"uint64","name":"syncedAt","type":"uint64"},{"internalType":"bool","name":"verified","type":"bool"}],"internalType":"struct ShadowSettlement.RemoteRootSnapshot","name":"snapshot","type":"tuple"},{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingBatchInfo","outputs":[{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint64","name":"firstSubmissionTime","type":"uint64"},{"internalType":"uint256","name":"timeRemaining","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"chainId","type":"string"}],"name":"getRemoteRootCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"chainId","type":"string"},{"internalType":"uint256","name":"snapshotIndex","type":"uint256"}],"name":"getRemoteRootSnapshot","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint256","name":"leafCount","type":"uint256"},{"internalType":"uint64","name":"syncedAt","type":"uint64"},{"internalType":"bool","name":"verified","type":"bool"}],"internalType":"struct ShadowSettlement.RemoteRootSnapshot","name":"snapshot","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"nullifier","type":"bytes32"}],"name":"isNullifierUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"isRelayerAuthorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"verifier","type":"address"}],"name":"isRootVerifier","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"latestRemoteRootIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"commitment","type":"bytes32"},{"internalType":"bytes32","name":"nullifierHash","type":"bytes32"}],"name":"markSettled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextLeafIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"processBatchIfTimeout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"remoteRootHistory","outputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint256","name":"leafCount","type":"uint256"},{"internalType":"uint64","name":"syncedAt","type":"uint64"},{"internalType":"bool","name":"verified","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rootVerifiers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"setRelayerStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"verifier","type":"address"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"setRootVerifierStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"setTokenWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"intentId","type":"bytes32"},{"internalType":"bytes32","name":"nullifierHash","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"settleAndRelease","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"chainId","type":"string"},{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint256","name":"leafCount","type":"uint256"}],"name":"syncMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newBatchSize","type":"uint256"},{"internalType":"uint256","name":"newTimeout","type":"uint256"}],"name":"updateBatchConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"usedNullifiers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"chainId","type":"string"},{"internalType":"uint256","name":"snapshotIndex","type":"uint256"}],"name":"verifyRemoteRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801561001057600080fd5b506040516128f73803806128f783398101604081905261002f91610224565b8160017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556001600160a01b03811661008257604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61008b8161014c565b506001600160a01b03811660009081526027602090815260408083208054600160ff19918216811790925560239093529083208054909216179055600a602555601e602655600781015560015b60148110156101445761012760076100f160018461026d565b6014811061010157610101610257565b0154600761011060018561026d565b6014811061012057610120610257565b015461019c565b6007826014811061013a5761013a610257565b01556001016100d8565b50505061028e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008183106101d4576040805160208101849052908101849052606001604051602081830303815290604052805190602001206101ff565b6040805160208101859052908101839052606001604051602081830303815290604052805190602001205b90505b92915050565b80516001600160a01b038116811461021f57600080fd5b919050565b6000806040838503121561023757600080fd5b61024083610208565b915061024e60208401610208565b90509250929050565b634e487b7160e01b600052603260045260246000fd5b8181038181111561020257634e487b7160e01b600052601160045260246000fd5b61265a8061029d6000396000f3fe60806040526004361061028c5760003560e01c80637a3e04521161015a578063c2aca049116100c1578063daf9c2101161007a578063daf9c210146108f4578063f13c46aa14610924578063f2fde38b14610971578063f4daaba114610991578063fa12a725146109a7578063fdab463d146109e057610293565b8063c2aca04914610816578063c9bcc97e1461084f578063cea9d26f1461086f578063cfdbf2541461088f578063d18e97ca146108a4578063d8e565ab146108c457610293565b80638da5cb5b116101135780638da5cb5b1461071a5780639add92e4146107385780639e0335801461074d578063a19f840514610785578063aeaa2803146107a5578063b02e5893146107c557610293565b80637a3e04521461064157806380dd2be8146106615780638322fff2146106765780638456cb59146106b657806386015834146106cb57806386307865146106eb57610293565b806345b25ddf116101fe57806355b47f70116101b757806355b47f701461058a5780635c975abb146105aa57806364a7e2e6146105c9578063715018a61461060157806375158dfa1461061657806377c793801461062b57610293565b806345b25ddf1461048657806346c7fe88146104a657806349590657146104d35780634e1278d8146104e857806353b1845914610508578063544d0be11461056a57610293565b806322dc7b4c1161025057806322dc7b4c1461039657806329e295c5146103c6578063319ae7c0146103f65780633d2133961461042e5780633f4ba83a1461045c578063436fd9681461047157610293565b806301f4b1a2146102e057806306f13056146103025780630be4f4221461032b578063145bb61d14610341578063206137aa1461035657610293565b3661029357005b34801561029f57600080fd5b5060405162461bcd60e51b815260206004820152601060248201526f2ab735b737bbb710333ab731ba34b7b760811b60448201526064015b60405180910390fd5b3480156102ec57600080fd5b506103006102fb366004612123565b6109f6565b005b34801561030e57600080fd5b50610318601f5481565b6040519081526020015b60405180910390f35b34801561033757600080fd5b5061031860045481565b34801561034d57600080fd5b50610300610c37565b34801561036257600080fd5b50610386610371366004612171565b60026020526000908152604090205460ff1681565b6040519015158152602001610322565b3480156103a257600080fd5b506103866103b1366004612171565b60009081526002602052604090205460ff1690565b3480156103d257600080fd5b506103866103e136600461218a565b60276020526000908152604090205460ff1681565b34801561040257600080fd5b50610318610411366004612248565b805160208183018101805160228252928201919093012091525481565b34801561043a57600080fd5b5061044e610449366004612284565b610cad565b6040516103229291906122b0565b34801561046857600080fd5b50610300610e91565b34801561047d57600080fd5b50610318601481565b34801561049257600080fd5b506103006104a1366004612284565b610ea3565b3480156104b257600080fd5b506104c66104c136600461236f565b610ff7565b60405161032291906123ba565b3480156104df57600080fd5b50600654610318565b3480156104f457600080fd5b506103006105033660046123f0565b6110d4565b34801561051457600080fd5b50610528610523366004612440565b6112c5565b604080518351815260208085015190820152838201516001600160401b031691810191909152606092830151151592810192909252608082015260a001610322565b34801561057657600080fd5b50610300610585366004612481565b611432565b34801561059657600080fd5b506103006105a5366004612481565b61153a565b3480156105b657600080fd5b50600054600160a01b900460ff16610386565b3480156105d557600080fd5b506105de6115d7565b604080519384526001600160401b03909216602084015290820152606001610322565b34801561060d57600080fd5b5061030061162e565b34801561062257600080fd5b50610318600a81565b34801561063757600080fd5b5061031860265481565b34801561064d57600080fd5b5061031861065c366004612440565b611640565b34801561066d57600080fd5b50610318600181565b34801561068257600080fd5b5061069e73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6040516001600160a01b039091168152602001610322565b3480156106c257600080fd5b5061030061166d565b3480156106d757600080fd5b506103006106e63660046124a3565b61167d565b3480156106f757600080fd5b50610386610706366004612171565b600090815260016020526040902054151590565b34801561072657600080fd5b506000546001600160a01b031661069e565b34801561074457600080fd5b50610318601e81565b34801561075957600080fd5b5060205461076d906001600160401b031681565b6040516001600160401b039091168152602001610322565b34801561079157600080fd5b506103006107a03660046124a3565b6116e5565b3480156107b157600080fd5b506103006107c036600461236f565b611745565b3480156107d157600080fd5b506107e56107e03660046124df565b61187f565b604051610322949392919093845260208401929092526001600160401b031660408301521515606082015260800190565b34801561082257600080fd5b5061038661083136600461218a565b6001600160a01b031660009081526023602052604090205460ff1690565b34801561085b57600080fd5b5061030061086a3660046124a3565b6118e5565b34801561087b57600080fd5b5061030061088a366004612523565b611986565b34801561089b57600080fd5b50610318606481565b3480156108b057600080fd5b506104c66108bf366004612440565b611a40565b3480156108d057600080fd5b506103866108df36600461218a565b60236020526000908152604090205460ff1681565b34801561090057600080fd5b5061038661090f36600461218a565b60246020526000908152604090205460ff1681565b34801561093057600080fd5b5061094461093f366004612171565b611b3d565b60408051825181526020808401516001600160401b03169082015291810151151590820152606001610322565b34801561097d57600080fd5b5061030061098c36600461218a565b611bc0565b34801561099d57600080fd5b5061031860255481565b3480156109b357600080fd5b506103866109c236600461218a565b6001600160a01b031660009081526027602052604090205460ff1690565b3480156109ec57600080fd5b5061031860065481565b3360009081526027602052604090205460ff16610a25576040516282b42960e81b815260040160405180910390fd5b610a2d611bfb565b610a35611c29565b60008481526002602052604090205460ff1615610a6557604051639281498560e01b815260040160405180910390fd5b6001600160a01b038316610a8c57604051634e46966960e11b815260040160405180910390fd5b6001600160a01b03821660009081526024602052604090205460ff16610ac5576040516307c241ad60e51b815260040160405180910390fd5b80600003610ae65760405163162908e360e11b815260040160405180910390fd5b6000848152600260205260409020805460ff1916600117905573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610b9e576000836001600160a01b03168260405160006040518083038185875af1925050503d8060008114610b71576040519150601f19603f3d011682016040523d82523d6000602084013e610b76565b606091505b5050905080610b98576040516312171d8360e31b815260040160405180910390fd5b50610bb2565b610bb26001600160a01b0383168483611c54565b604080516001600160a01b038416815260208101839052426001600160401b0316818301529051859187917f04f4c78f35ce4f8bbfc5f02957a55c529e2e012fd0a83570b5b5bdbcbe4ef7849181900360600190a3610c3060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b5050505050565b610c3f611c29565b601f54600003610c625760405163143a603360e21b815260040160405180910390fd5b602054600090610c7b906001600160401b031642612576565b9050602654811015610ca0576040516326c015ab60e21b815260040160405180910390fd5b610caa6001611c89565b50565b60008381526003602052604090208054606091811580610ccd5750818510155b15610d25576040805160008082526020820190925290610d1c565b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610ce85790505b50925050610e89565b6000610d318684612576565b90506000851580610d4157508186115b610d4b5785610d4d565b815b9050806001600160401b03811115610d6757610d676121a5565b604051908082528060200260200182016040528015610db957816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610d855790505b50945060005b81811015610e8457600060018186610dd7858d612589565b81548110610de757610de761259c565b906000526020600020015481526020019081526020016000209050604051806080016040528082600001548152602001826001015481526020018260030160009054906101000a90046001600160401b03166001600160401b031681526020018260030160089054906101000a900460ff161515815250878381518110610e7057610e7061259c565b602090810291909101015250600101610dbf565b505050505b935093915050565b610e99611e0c565b610ea1611e39565b565b3360009081526027602052604090205460ff16610ed2576040516282b42960e81b815260040160405180910390fd5b610eda611c29565b82610ef857604051636033c4fd60e11b815260040160405180910390fd5b60008381526001602052604090205415610f255760405163473af27b60e11b815260040160405180910390fd5b6004546210000011610f4a57604051631691e59f60e31b815260040160405180910390fd5b601f546000819003610f73576020805467ffffffffffffffff1916426001600160401b03161790555b6000818152601c60209081526040808320879055601d8252808320869055601e9091529020829055610fa6816001612589565b601f5560405184907f0d1db5120c8b03afe943ddedc46e44af2a9b5f1dfe728e572a85559bba88a5fb90600090a2602554610fe2826001612589565b10610ff157610ff16000611c89565b50505050565b60408051608081018252600080825260208201819052918101829052606081019190915260006021858560405161102f9291906125b2565b9081526040519081900360200190208054909150831061106257604051632402054b60e11b815260040160405180910390fd5b8083815481106110745761107461259c565b600091825260209182902060408051608081018252600393909302909101805483526001810154938301939093526002909201546001600160401b03811692820192909252600160401b90910460ff161515606082015295945050505050565b3360009081526027602052604090205460ff16611103576040516282b42960e81b815260040160405180910390fd5b61110b611c29565b600083900361112d57604051633d23e4d160e11b815260040160405180910390fd5b8161114b5760405163504570e360e01b815260040160405180910390fd5b8060000361116c5760405163162908e360e11b815260040160405180910390fd5b60408051608081018252838152602081018390526001600160401b034216818301526000606082015290516021906111a790879087906125b2565b908152604080519182900360209081018320805460018181018355600092835283832087516003909302019182559286015181840155928501516002909301805460608701511515600160401b0268ffffffffffffffffff199091166001600160401b039095169490941793909317909255909160219061122b90899089906125b2565b908152604051908190036020019020546112459190612576565b9050806022878760405161125a9291906125b2565b90815260200160405180910390208190555083868660405161127d9291906125b2565b6040805191829003822086835260208301859052917fe203bcc373d6be8e7a49a5adc465d3dd60a680c4ea8f52fefb3beb54e4e5e037910160405180910390a3505050505050565b604080516080810182526000808252602082018190529181018290526060810191909152600080602185856040516112fe9291906125b2565b908152604051908190036020019020805490915060000361133257604051632402054b60e11b815260040160405180910390fd5b80545b80156114115781611347600183612576565b815481106113575761135761259c565b906000526020600020906003020160020160089054906101000a900460ff16156113ff5781611387600183612576565b815481106113975761139761259c565b90600052602060002090600302016001826113b29190612576565b6040805160808101825283548152600184015460208201526002909301546001600160401b03811691840191909152600160401b900460ff1615156060830152909450925061142b915050565b80611409816125c2565b915050611335565b50604051632402054b60e11b815260040160405180910390fd5b9250929050565b3360009081526027602052604090205460ff16611461576040516282b42960e81b815260040160405180910390fd5b611469611c29565b6000828152600160205260409020805461149657604051635b34156960e11b815260040160405180910390fd5b60008281526002602052604090205460ff16156114c657604051639281498560e01b815260040160405180910390fd5b60038101805460ff60401b1916600160401b179055600082815260026020908152604091829020805460ff191660011790559051426001600160401b03168152849184917ffdf184f93dd40d75a93612c5fac9db7cf9181c3a58577bb09490db38b3189085910160405180910390a3505050565b611542611e0c565b60018210806115515750606482115b1561156f57604051637862e95960e01b815260040160405180910390fd5b8060000361159057604051631ffb86f160e21b815260040160405180910390fd5b6025829055602681905560408051838152602081018390527fec48ddde9219ab8a490f9d4fc2725b298f0bf3042d31cd4c4f70e4da3e24e366910160405180910390a15050565b601f546020546001600160401b0316600082156116295760006116036001600160401b03841642612576565b9050602654811015611622578060265461161d9190612576565b611625565b60005b9150505b909192565b611636611e0c565b610ea16000611e8e565b6000602183836040516116549291906125b2565b9081526040519081900360200190205490505b92915050565b611675611e0c565b610ea1611ede565b611685611e0c565b6001600160a01b038216600081815260276020908152604091829020805460ff191685151590811790915591519182527f1eee43db36ef00705c8e30d4dd7caaa5f0464ff3de7e4a5c0baf344e7a723b3791015b60405180910390a25050565b6116ed611e0c565b6001600160a01b038216600081815260236020908152604091829020805460ff191685151590811790915591519182527fe26b26b58e827de1f8887c53fd338f8f8be03dea9ca0af90621e89f7872f8bb191016116d9565b3360009081526023602052604090205460ff16611774576040516282b42960e81b815260040160405180910390fd5b61177c611c29565b6000602184846040516117909291906125b2565b908152604051908190036020019020805490915082106117c357604051632402054b60e11b815260040160405180910390fd5b60008183815481106117d7576117d761259c565b906000526020600020906003020190508060020160089054906101000a900460ff1615611817576040516399cac5f760e01b815260040160405180910390fd5b60028101805460ff60401b1916600160401b179055604051839061183e90879087906125b2565b604051908190038120338252907f3d4973200108d88ff4a88096eae145dc4712d635eb486ffda71178cda36b14be9060200160405180910390a35050505050565b815160208184018101805160218252928201918501919091209190528054829081106118aa57600080fd5b60009182526020909120600390910201805460018201546002909201549093509091506001600160401b03811690600160401b900460ff1684565b6118ed611e0c565b6001600160a01b03821660009081526024602052604090205481151560ff90911615150361192e5760405163446a0fb360e11b815260040160405180910390fd5b6001600160a01b038216600081815260246020908152604091829020805460ff191685151590811790915591519182527f67821d5384bb02aab1ba91a477f89c9966cd30f475b02618bdc58712bca5127591016116d9565b61198e611e0c565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601611a27576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611a00576040519150601f19603f3d011682016040523d82523d6000602084013e611a05565b606091505b5050905080610ff1576040516312171d8360e31b815260040160405180910390fd5b611a3b6001600160a01b0384168383611c54565b505050565b604080516080810182526000808252602082018190529181018290526060810191909152600060218484604051611a789291906125b2565b9081526040519081900360200190208054909150600003611aac57604051632402054b60e11b815260040160405180910390fd5b8060228585604051611abf9291906125b2565b90815260200160405180910390205481548110611ade57611ade61259c565b600091825260209182902060408051608081018252600393909302909101805483526001810154938301939093526002909201546001600160401b03811692820192909252600160401b90910460ff1615156060820152949350505050565b604080516060810182526000808252602082018190529181019190915260008281526001602052604090208054611b8757604051635b34156960e11b815260040160405180910390fd5b60408051606081018252825481526003909201546001600160401b0381166020840152600160401b900460ff1615159082015292915050565b611bc8611e0c565b6001600160a01b038116611bf257604051631e4fbdf760e01b8152600060048201526024016102d7565b610caa81611e8e565b611c03611f21565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b600054600160a01b900460ff1615610ea15760405163d93c066560e01b815260040160405180910390fd5b611c618383836001611f63565b611a3b57604051635274afe760e01b81526001600160a01b03841660048201526024016102d7565b601f546000819003611cae5760405163143a603360e21b815260040160405180910390fd5b60005b81811015611d9a576000818152601c6020908152604080832054601d835281842054601e845282852054835160a0810185528381528086018381528186018381526001600160401b0342811660608501908152608085018b8152888c5260019a8b905298909a20935184559151978301979097559551600282015595516003909601805494511515600160401b0268ffffffffffffffffff199095169690951695909517929092179092559091611d6783611fc9565b8015611d8f576000818152600360209081526040822080546001810182559083529120018390555b505050600101611cb1565b506004547fa50194d053e2537ed157599ad0741ddc46e7343a4f6e3b954b6c4d11b47e2cb38284604051611dcf9291906125d9565b60405180910390a26006546040517f90004c04698bc3322499a575ed3752dd4abf33e0a7294c06a787a0fe01bea94190600090a250506000601f55565b6000546001600160a01b03163314610ea15760405163118cdaa760e01b81523360048201526024016102d7565b611e41612073565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611ee6611c29565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e713390565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0054600203610ea157604051633ee5aeb560e01b815260040160405180910390fd5b60405163a9059cbb60e01b60008181526001600160a01b038616600452602485905291602083604481808b5af192506001600051148316611fbd578383151615611fb0573d6000823e3d81fd5b6000873b113d1516831692505b60405250949350505050565b600480546000838152601b6020526040812082905590918291611feb8361260b565b90915550829050600080805b6014811015612069578460011660000361203b57839250600781601481106120215761202161259c565b015460008281526005602052604090208590559150612050565b60008181526005602052604090205492508391505b61205a838361209d565b600195861c9590945001611ff7565b5050506006555050565b600054600160a01b900460ff16610ea157604051638dfc202b60e01b815260040160405180910390fd5b60008183106120d557604080516020810184905290810184905260600160405160208183030381529060405280519060200120612100565b6040805160208101859052908101839052606001604051602081830303815290604052805190602001205b9392505050565b80356001600160a01b038116811461211e57600080fd5b919050565b600080600080600060a0868803121561213b57600080fd5b853594506020860135935061215260408701612107565b925061216060608701612107565b949793965091946080013592915050565b60006020828403121561218357600080fd5b5035919050565b60006020828403121561219c57600080fd5b61210082612107565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126121cc57600080fd5b81356001600160401b038111156121e5576121e56121a5565b604051601f8201601f19908116603f011681016001600160401b0381118282101715612213576122136121a5565b60405281815283820160200185101561222b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561225a57600080fd5b81356001600160401b0381111561227057600080fd5b61227c848285016121bb565b949350505050565b60008060006060848603121561229957600080fd5b505081359360208301359350604090920135919050565b6040808252835190820181905260009060208501906060840190835b8181101561231b57835180518452602081015160208501526001600160401b036040820151166040850152606081015115156060850152506080830192506020840193506001810190506122cc565b5050602093909301939093525092915050565b60008083601f84011261234057600080fd5b5081356001600160401b0381111561235757600080fd5b60208301915083602082850101111561142b57600080fd5b60008060006040848603121561238457600080fd5b83356001600160401b0381111561239a57600080fd5b6123a68682870161232e565b909790965060209590950135949350505050565b81518152602080830151908201526040808301516001600160401b03169082015260608083015115159082015260808101611667565b6000806000806060858703121561240657600080fd5b84356001600160401b0381111561241c57600080fd5b6124288782880161232e565b90989097506020870135966040013595509350505050565b6000806020838503121561245357600080fd5b82356001600160401b0381111561246957600080fd5b6124758582860161232e565b90969095509350505050565b6000806040838503121561249457600080fd5b50508035926020909101359150565b600080604083850312156124b657600080fd5b6124bf83612107565b9150602083013580151581146124d457600080fd5b809150509250929050565b600080604083850312156124f257600080fd5b82356001600160401b0381111561250857600080fd5b612514858286016121bb565b95602094909401359450505050565b60008060006060848603121561253857600080fd5b61254184612107565b925061254f60208501612107565b929592945050506040919091013590565b634e487b7160e01b600052601160045260246000fd5b8181038181111561166757611667612560565b8082018082111561166757611667612560565b634e487b7160e01b600052603260045260246000fd5b8183823760009101908152919050565b6000816125d1576125d1612560565b506000190190565b82815260408101600283106125fe57634e487b7160e01b600052602160045260246000fd5b8260208301529392505050565b60006001820161261d5761261d612560565b506001019056fea2646970667358221220c5badd1dd21a7733003c5c93ee2025f5be447b8ba13e91e8b43779bacc14573f64736f6c634300081d0033000000000000000000000000f23a4a721d59ca979cb354bae567a59ed7ec04c5000000000000000000000000f23a4a721d59ca979cb354bae567a59ed7ec04c5
Deployed Bytecode
0x60806040526004361061028c5760003560e01c80637a3e04521161015a578063c2aca049116100c1578063daf9c2101161007a578063daf9c210146108f4578063f13c46aa14610924578063f2fde38b14610971578063f4daaba114610991578063fa12a725146109a7578063fdab463d146109e057610293565b8063c2aca04914610816578063c9bcc97e1461084f578063cea9d26f1461086f578063cfdbf2541461088f578063d18e97ca146108a4578063d8e565ab146108c457610293565b80638da5cb5b116101135780638da5cb5b1461071a5780639add92e4146107385780639e0335801461074d578063a19f840514610785578063aeaa2803146107a5578063b02e5893146107c557610293565b80637a3e04521461064157806380dd2be8146106615780638322fff2146106765780638456cb59146106b657806386015834146106cb57806386307865146106eb57610293565b806345b25ddf116101fe57806355b47f70116101b757806355b47f701461058a5780635c975abb146105aa57806364a7e2e6146105c9578063715018a61461060157806375158dfa1461061657806377c793801461062b57610293565b806345b25ddf1461048657806346c7fe88146104a657806349590657146104d35780634e1278d8146104e857806353b1845914610508578063544d0be11461056a57610293565b806322dc7b4c1161025057806322dc7b4c1461039657806329e295c5146103c6578063319ae7c0146103f65780633d2133961461042e5780633f4ba83a1461045c578063436fd9681461047157610293565b806301f4b1a2146102e057806306f13056146103025780630be4f4221461032b578063145bb61d14610341578063206137aa1461035657610293565b3661029357005b34801561029f57600080fd5b5060405162461bcd60e51b815260206004820152601060248201526f2ab735b737bbb710333ab731ba34b7b760811b60448201526064015b60405180910390fd5b3480156102ec57600080fd5b506103006102fb366004612123565b6109f6565b005b34801561030e57600080fd5b50610318601f5481565b6040519081526020015b60405180910390f35b34801561033757600080fd5b5061031860045481565b34801561034d57600080fd5b50610300610c37565b34801561036257600080fd5b50610386610371366004612171565b60026020526000908152604090205460ff1681565b6040519015158152602001610322565b3480156103a257600080fd5b506103866103b1366004612171565b60009081526002602052604090205460ff1690565b3480156103d257600080fd5b506103866103e136600461218a565b60276020526000908152604090205460ff1681565b34801561040257600080fd5b50610318610411366004612248565b805160208183018101805160228252928201919093012091525481565b34801561043a57600080fd5b5061044e610449366004612284565b610cad565b6040516103229291906122b0565b34801561046857600080fd5b50610300610e91565b34801561047d57600080fd5b50610318601481565b34801561049257600080fd5b506103006104a1366004612284565b610ea3565b3480156104b257600080fd5b506104c66104c136600461236f565b610ff7565b60405161032291906123ba565b3480156104df57600080fd5b50600654610318565b3480156104f457600080fd5b506103006105033660046123f0565b6110d4565b34801561051457600080fd5b50610528610523366004612440565b6112c5565b604080518351815260208085015190820152838201516001600160401b031691810191909152606092830151151592810192909252608082015260a001610322565b34801561057657600080fd5b50610300610585366004612481565b611432565b34801561059657600080fd5b506103006105a5366004612481565b61153a565b3480156105b657600080fd5b50600054600160a01b900460ff16610386565b3480156105d557600080fd5b506105de6115d7565b604080519384526001600160401b03909216602084015290820152606001610322565b34801561060d57600080fd5b5061030061162e565b34801561062257600080fd5b50610318600a81565b34801561063757600080fd5b5061031860265481565b34801561064d57600080fd5b5061031861065c366004612440565b611640565b34801561066d57600080fd5b50610318600181565b34801561068257600080fd5b5061069e73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6040516001600160a01b039091168152602001610322565b3480156106c257600080fd5b5061030061166d565b3480156106d757600080fd5b506103006106e63660046124a3565b61167d565b3480156106f757600080fd5b50610386610706366004612171565b600090815260016020526040902054151590565b34801561072657600080fd5b506000546001600160a01b031661069e565b34801561074457600080fd5b50610318601e81565b34801561075957600080fd5b5060205461076d906001600160401b031681565b6040516001600160401b039091168152602001610322565b34801561079157600080fd5b506103006107a03660046124a3565b6116e5565b3480156107b157600080fd5b506103006107c036600461236f565b611745565b3480156107d157600080fd5b506107e56107e03660046124df565b61187f565b604051610322949392919093845260208401929092526001600160401b031660408301521515606082015260800190565b34801561082257600080fd5b5061038661083136600461218a565b6001600160a01b031660009081526023602052604090205460ff1690565b34801561085b57600080fd5b5061030061086a3660046124a3565b6118e5565b34801561087b57600080fd5b5061030061088a366004612523565b611986565b34801561089b57600080fd5b50610318606481565b3480156108b057600080fd5b506104c66108bf366004612440565b611a40565b3480156108d057600080fd5b506103866108df36600461218a565b60236020526000908152604090205460ff1681565b34801561090057600080fd5b5061038661090f36600461218a565b60246020526000908152604090205460ff1681565b34801561093057600080fd5b5061094461093f366004612171565b611b3d565b60408051825181526020808401516001600160401b03169082015291810151151590820152606001610322565b34801561097d57600080fd5b5061030061098c36600461218a565b611bc0565b34801561099d57600080fd5b5061031860255481565b3480156109b357600080fd5b506103866109c236600461218a565b6001600160a01b031660009081526027602052604090205460ff1690565b3480156109ec57600080fd5b5061031860065481565b3360009081526027602052604090205460ff16610a25576040516282b42960e81b815260040160405180910390fd5b610a2d611bfb565b610a35611c29565b60008481526002602052604090205460ff1615610a6557604051639281498560e01b815260040160405180910390fd5b6001600160a01b038316610a8c57604051634e46966960e11b815260040160405180910390fd5b6001600160a01b03821660009081526024602052604090205460ff16610ac5576040516307c241ad60e51b815260040160405180910390fd5b80600003610ae65760405163162908e360e11b815260040160405180910390fd5b6000848152600260205260409020805460ff1916600117905573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610b9e576000836001600160a01b03168260405160006040518083038185875af1925050503d8060008114610b71576040519150601f19603f3d011682016040523d82523d6000602084013e610b76565b606091505b5050905080610b98576040516312171d8360e31b815260040160405180910390fd5b50610bb2565b610bb26001600160a01b0383168483611c54565b604080516001600160a01b038416815260208101839052426001600160401b0316818301529051859187917f04f4c78f35ce4f8bbfc5f02957a55c529e2e012fd0a83570b5b5bdbcbe4ef7849181900360600190a3610c3060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b5050505050565b610c3f611c29565b601f54600003610c625760405163143a603360e21b815260040160405180910390fd5b602054600090610c7b906001600160401b031642612576565b9050602654811015610ca0576040516326c015ab60e21b815260040160405180910390fd5b610caa6001611c89565b50565b60008381526003602052604090208054606091811580610ccd5750818510155b15610d25576040805160008082526020820190925290610d1c565b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610ce85790505b50925050610e89565b6000610d318684612576565b90506000851580610d4157508186115b610d4b5785610d4d565b815b9050806001600160401b03811115610d6757610d676121a5565b604051908082528060200260200182016040528015610db957816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610d855790505b50945060005b81811015610e8457600060018186610dd7858d612589565b81548110610de757610de761259c565b906000526020600020015481526020019081526020016000209050604051806080016040528082600001548152602001826001015481526020018260030160009054906101000a90046001600160401b03166001600160401b031681526020018260030160089054906101000a900460ff161515815250878381518110610e7057610e7061259c565b602090810291909101015250600101610dbf565b505050505b935093915050565b610e99611e0c565b610ea1611e39565b565b3360009081526027602052604090205460ff16610ed2576040516282b42960e81b815260040160405180910390fd5b610eda611c29565b82610ef857604051636033c4fd60e11b815260040160405180910390fd5b60008381526001602052604090205415610f255760405163473af27b60e11b815260040160405180910390fd5b6004546210000011610f4a57604051631691e59f60e31b815260040160405180910390fd5b601f546000819003610f73576020805467ffffffffffffffff1916426001600160401b03161790555b6000818152601c60209081526040808320879055601d8252808320869055601e9091529020829055610fa6816001612589565b601f5560405184907f0d1db5120c8b03afe943ddedc46e44af2a9b5f1dfe728e572a85559bba88a5fb90600090a2602554610fe2826001612589565b10610ff157610ff16000611c89565b50505050565b60408051608081018252600080825260208201819052918101829052606081019190915260006021858560405161102f9291906125b2565b9081526040519081900360200190208054909150831061106257604051632402054b60e11b815260040160405180910390fd5b8083815481106110745761107461259c565b600091825260209182902060408051608081018252600393909302909101805483526001810154938301939093526002909201546001600160401b03811692820192909252600160401b90910460ff161515606082015295945050505050565b3360009081526027602052604090205460ff16611103576040516282b42960e81b815260040160405180910390fd5b61110b611c29565b600083900361112d57604051633d23e4d160e11b815260040160405180910390fd5b8161114b5760405163504570e360e01b815260040160405180910390fd5b8060000361116c5760405163162908e360e11b815260040160405180910390fd5b60408051608081018252838152602081018390526001600160401b034216818301526000606082015290516021906111a790879087906125b2565b908152604080519182900360209081018320805460018181018355600092835283832087516003909302019182559286015181840155928501516002909301805460608701511515600160401b0268ffffffffffffffffff199091166001600160401b039095169490941793909317909255909160219061122b90899089906125b2565b908152604051908190036020019020546112459190612576565b9050806022878760405161125a9291906125b2565b90815260200160405180910390208190555083868660405161127d9291906125b2565b6040805191829003822086835260208301859052917fe203bcc373d6be8e7a49a5adc465d3dd60a680c4ea8f52fefb3beb54e4e5e037910160405180910390a3505050505050565b604080516080810182526000808252602082018190529181018290526060810191909152600080602185856040516112fe9291906125b2565b908152604051908190036020019020805490915060000361133257604051632402054b60e11b815260040160405180910390fd5b80545b80156114115781611347600183612576565b815481106113575761135761259c565b906000526020600020906003020160020160089054906101000a900460ff16156113ff5781611387600183612576565b815481106113975761139761259c565b90600052602060002090600302016001826113b29190612576565b6040805160808101825283548152600184015460208201526002909301546001600160401b03811691840191909152600160401b900460ff1615156060830152909450925061142b915050565b80611409816125c2565b915050611335565b50604051632402054b60e11b815260040160405180910390fd5b9250929050565b3360009081526027602052604090205460ff16611461576040516282b42960e81b815260040160405180910390fd5b611469611c29565b6000828152600160205260409020805461149657604051635b34156960e11b815260040160405180910390fd5b60008281526002602052604090205460ff16156114c657604051639281498560e01b815260040160405180910390fd5b60038101805460ff60401b1916600160401b179055600082815260026020908152604091829020805460ff191660011790559051426001600160401b03168152849184917ffdf184f93dd40d75a93612c5fac9db7cf9181c3a58577bb09490db38b3189085910160405180910390a3505050565b611542611e0c565b60018210806115515750606482115b1561156f57604051637862e95960e01b815260040160405180910390fd5b8060000361159057604051631ffb86f160e21b815260040160405180910390fd5b6025829055602681905560408051838152602081018390527fec48ddde9219ab8a490f9d4fc2725b298f0bf3042d31cd4c4f70e4da3e24e366910160405180910390a15050565b601f546020546001600160401b0316600082156116295760006116036001600160401b03841642612576565b9050602654811015611622578060265461161d9190612576565b611625565b60005b9150505b909192565b611636611e0c565b610ea16000611e8e565b6000602183836040516116549291906125b2565b9081526040519081900360200190205490505b92915050565b611675611e0c565b610ea1611ede565b611685611e0c565b6001600160a01b038216600081815260276020908152604091829020805460ff191685151590811790915591519182527f1eee43db36ef00705c8e30d4dd7caaa5f0464ff3de7e4a5c0baf344e7a723b3791015b60405180910390a25050565b6116ed611e0c565b6001600160a01b038216600081815260236020908152604091829020805460ff191685151590811790915591519182527fe26b26b58e827de1f8887c53fd338f8f8be03dea9ca0af90621e89f7872f8bb191016116d9565b3360009081526023602052604090205460ff16611774576040516282b42960e81b815260040160405180910390fd5b61177c611c29565b6000602184846040516117909291906125b2565b908152604051908190036020019020805490915082106117c357604051632402054b60e11b815260040160405180910390fd5b60008183815481106117d7576117d761259c565b906000526020600020906003020190508060020160089054906101000a900460ff1615611817576040516399cac5f760e01b815260040160405180910390fd5b60028101805460ff60401b1916600160401b179055604051839061183e90879087906125b2565b604051908190038120338252907f3d4973200108d88ff4a88096eae145dc4712d635eb486ffda71178cda36b14be9060200160405180910390a35050505050565b815160208184018101805160218252928201918501919091209190528054829081106118aa57600080fd5b60009182526020909120600390910201805460018201546002909201549093509091506001600160401b03811690600160401b900460ff1684565b6118ed611e0c565b6001600160a01b03821660009081526024602052604090205481151560ff90911615150361192e5760405163446a0fb360e11b815260040160405180910390fd5b6001600160a01b038216600081815260246020908152604091829020805460ff191685151590811790915591519182527f67821d5384bb02aab1ba91a477f89c9966cd30f475b02618bdc58712bca5127591016116d9565b61198e611e0c565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601611a27576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611a00576040519150601f19603f3d011682016040523d82523d6000602084013e611a05565b606091505b5050905080610ff1576040516312171d8360e31b815260040160405180910390fd5b611a3b6001600160a01b0384168383611c54565b505050565b604080516080810182526000808252602082018190529181018290526060810191909152600060218484604051611a789291906125b2565b9081526040519081900360200190208054909150600003611aac57604051632402054b60e11b815260040160405180910390fd5b8060228585604051611abf9291906125b2565b90815260200160405180910390205481548110611ade57611ade61259c565b600091825260209182902060408051608081018252600393909302909101805483526001810154938301939093526002909201546001600160401b03811692820192909252600160401b90910460ff1615156060820152949350505050565b604080516060810182526000808252602082018190529181019190915260008281526001602052604090208054611b8757604051635b34156960e11b815260040160405180910390fd5b60408051606081018252825481526003909201546001600160401b0381166020840152600160401b900460ff1615159082015292915050565b611bc8611e0c565b6001600160a01b038116611bf257604051631e4fbdf760e01b8152600060048201526024016102d7565b610caa81611e8e565b611c03611f21565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b600054600160a01b900460ff1615610ea15760405163d93c066560e01b815260040160405180910390fd5b611c618383836001611f63565b611a3b57604051635274afe760e01b81526001600160a01b03841660048201526024016102d7565b601f546000819003611cae5760405163143a603360e21b815260040160405180910390fd5b60005b81811015611d9a576000818152601c6020908152604080832054601d835281842054601e845282852054835160a0810185528381528086018381528186018381526001600160401b0342811660608501908152608085018b8152888c5260019a8b905298909a20935184559151978301979097559551600282015595516003909601805494511515600160401b0268ffffffffffffffffff199095169690951695909517929092179092559091611d6783611fc9565b8015611d8f576000818152600360209081526040822080546001810182559083529120018390555b505050600101611cb1565b506004547fa50194d053e2537ed157599ad0741ddc46e7343a4f6e3b954b6c4d11b47e2cb38284604051611dcf9291906125d9565b60405180910390a26006546040517f90004c04698bc3322499a575ed3752dd4abf33e0a7294c06a787a0fe01bea94190600090a250506000601f55565b6000546001600160a01b03163314610ea15760405163118cdaa760e01b81523360048201526024016102d7565b611e41612073565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611ee6611c29565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e713390565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0054600203610ea157604051633ee5aeb560e01b815260040160405180910390fd5b60405163a9059cbb60e01b60008181526001600160a01b038616600452602485905291602083604481808b5af192506001600051148316611fbd578383151615611fb0573d6000823e3d81fd5b6000873b113d1516831692505b60405250949350505050565b600480546000838152601b6020526040812082905590918291611feb8361260b565b90915550829050600080805b6014811015612069578460011660000361203b57839250600781601481106120215761202161259c565b015460008281526005602052604090208590559150612050565b60008181526005602052604090205492508391505b61205a838361209d565b600195861c9590945001611ff7565b5050506006555050565b600054600160a01b900460ff16610ea157604051638dfc202b60e01b815260040160405180910390fd5b60008183106120d557604080516020810184905290810184905260600160405160208183030381529060405280519060200120612100565b6040805160208101859052908101839052606001604051602081830303815290604052805190602001205b9392505050565b80356001600160a01b038116811461211e57600080fd5b919050565b600080600080600060a0868803121561213b57600080fd5b853594506020860135935061215260408701612107565b925061216060608701612107565b949793965091946080013592915050565b60006020828403121561218357600080fd5b5035919050565b60006020828403121561219c57600080fd5b61210082612107565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126121cc57600080fd5b81356001600160401b038111156121e5576121e56121a5565b604051601f8201601f19908116603f011681016001600160401b0381118282101715612213576122136121a5565b60405281815283820160200185101561222b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561225a57600080fd5b81356001600160401b0381111561227057600080fd5b61227c848285016121bb565b949350505050565b60008060006060848603121561229957600080fd5b505081359360208301359350604090920135919050565b6040808252835190820181905260009060208501906060840190835b8181101561231b57835180518452602081015160208501526001600160401b036040820151166040850152606081015115156060850152506080830192506020840193506001810190506122cc565b5050602093909301939093525092915050565b60008083601f84011261234057600080fd5b5081356001600160401b0381111561235757600080fd5b60208301915083602082850101111561142b57600080fd5b60008060006040848603121561238457600080fd5b83356001600160401b0381111561239a57600080fd5b6123a68682870161232e565b909790965060209590950135949350505050565b81518152602080830151908201526040808301516001600160401b03169082015260608083015115159082015260808101611667565b6000806000806060858703121561240657600080fd5b84356001600160401b0381111561241c57600080fd5b6124288782880161232e565b90989097506020870135966040013595509350505050565b6000806020838503121561245357600080fd5b82356001600160401b0381111561246957600080fd5b6124758582860161232e565b90969095509350505050565b6000806040838503121561249457600080fd5b50508035926020909101359150565b600080604083850312156124b657600080fd5b6124bf83612107565b9150602083013580151581146124d457600080fd5b809150509250929050565b600080604083850312156124f257600080fd5b82356001600160401b0381111561250857600080fd5b612514858286016121bb565b95602094909401359450505050565b60008060006060848603121561253857600080fd5b61254184612107565b925061254f60208501612107565b929592945050506040919091013590565b634e487b7160e01b600052601160045260246000fd5b8181038181111561166757611667612560565b8082018082111561166757611667612560565b634e487b7160e01b600052603260045260246000fd5b8183823760009101908152919050565b6000816125d1576125d1612560565b506000190190565b82815260408101600283106125fe57634e487b7160e01b600052602160045260246000fd5b8260208301529392505050565b60006001820161261d5761261d612560565b506001019056fea2646970667358221220c5badd1dd21a7733003c5c93ee2025f5be447b8ba13e91e8b43779bacc14573f64736f6c634300081d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f23a4a721d59ca979cb354bae567a59ed7ec04c5000000000000000000000000f23a4a721d59ca979cb354bae567a59ed7ec04c5
-----Decoded View---------------
Arg [0] : _owner (address): 0xF23a4a721d59CA979cB354bae567A59eD7EC04c5
Arg [1] : _initialRelayer (address): 0xF23a4a721d59CA979cB354bae567A59eD7EC04c5
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000f23a4a721d59ca979cb354bae567a59ed7ec04c5
Arg [1] : 000000000000000000000000f23a4a721d59ca979cb354bae567a59ed7ec04c5
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.33
Net Worth in ETH
0.000165
Token Allocations
BSC-USD
100.00%
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| BSC | 100.00% | $1 | 0.3256 | $0.3256 |
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.