Address Contract Verified
Address
0x137D6160112dB87B3D504dDF64C375E565f5e9EF
Balance
0 ETH
Nonce
1
Code Size
1907 bytes
Creator
0x83F770C1...3366 at tx 0xd550024e...e7abb9
Indexed Transactions
0
Contract Bytecode
1907 bytes
0x6080604052600436106100dc575f3560e01c80638456cb591161007c578063b9a6003811610057578063b9a6003814610258578063bf81beac1461026d578063db2e21bc14610280578063f2fde38b14610294575f80fd5b80638456cb59146101f35780638da5cb5b14610207578063a6769ef81461022d575f80fd5b80635c975abb116100b75780635c975abb146101915780635f81a57c146101b3578063715018a6146101c8578063771aceef146101dc575f80fd5b80633f4ba83a146100e75780634e43603a146100fd57806359d7191414610158575f80fd5b366100e357005b5f80fd5b3480156100f2575f80fd5b506100fb6102b3565b005b348015610108575f80fd5b5061013e6101173660046106d4565b6001600160a01b03165f908152600560209081526040808320546006909252909120549091565b604080519283526020830191909152015b60405180910390f35b348015610163575f80fd5b506101836101723660046106d4565b60066020525f908152604090205481565b60405190815260200161014f565b34801561019c575f80fd5b5060025460ff16604051901515815260200161014f565b3480156101be575f80fd5b5061018360035481565b3480156101d3575f80fd5b506100fb6102c5565b3480156101e7575f80fd5b5060035460045461013e565b3480156101fe575f80fd5b506100fb6102d6565b348015610212575f80fd5b505f546040516001600160a01b03909116815260200161014f565b348015610238575f80fd5b506101836102473660046106d4565b60056020525f908152604090205481565b348015610263575f80fd5b5061018360045481565b6100fb61027b366004610701565b6102e6565b34801561028b575f80fd5b506100fb61048d565b34801561029f575f80fd5b506100fb6102ae3660046106d4565b61051a565b6102bb610559565b6102c3610585565b565b6102cd610559565b6102c35f6105d7565b6102de610559565b6102c3610626565b6102ee610663565b6102f661068d565b345f036103165760405163162908e360e11b815260040160405180910390fd5b6040515f90339034908381818185875af1925050503d805f8114610355576040519150601f19603f3d011682016040523d82523d5f602084013e61035a565b606091505b505090508061037c576040516312171d8360e31b815260040160405180910390fd5b3460035f82825461038d9190610718565b92505081905550600160045f8282546103a69190610718565b9091555050335f90815260056020526040812080543492906103c9908490610718565b9091555050335f9081526006602052604081208054600192906103ed908490610718565b909155505060408051348152426020820152839133917f76543904528179ee2444e3a1dca9aab81404195d13ac1855ecd3a3c2fc7fe686910160405180910390a3335f81815260056020908152604091829020546003548351348152928301919091528183015290517fbe136f55822a8400613c511fe3a4ab8aeaa1df9c6d834afd7d8531039e327b099181900360600190a25061048a60018055565b50565b610495610559565b475f6104a85f546001600160a01b031690565b6001600160a01b0316826040515f6040518083038185875af1925050503d805f81146104ef576040519150601f19603f3d011682016040523d82523d5f602084013e6104f4565b606091505b5050905080610516576040516312171d8360e31b815260040160405180910390fd5b5050565b610522610559565b6001600160a01b03811661055057604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61048a816105d7565b5f546001600160a01b031633146102c35760405163118cdaa760e01b8152336004820152602401610547565b61058d6106b1565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61062e61068d565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586105ba3390565b60026001540361068657604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b60025460ff16156102c35760405163d93c066560e01b815260040160405180910390fd5b60025460ff166102c357604051638dfc202b60e01b815260040160405180910390fd5b5f602082840312156106e4575f80fd5b81356001600160a01b03811681146106fa575f80fd5b9392505050565b5f60208284031215610711575f80fd5b5035919050565b8082018082111561073757634e487b7160e01b5f52601160045260245ffd5b9291505056fea26469706673582212205cf12a46a1938d6c2dc46db2163b3f82e23bdd483c53f0d856b0ac62d512a80664736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: Yes (200 runs)
BridgeRouterETH.sol 92 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
contract BridgeRouterETH is Ownable, ReentrancyGuard, Pausable {
uint256 public totalVolume;
uint256 public totalTransactions;
mapping(address => uint256) public userVolume;
mapping(address => uint256) public userTransactions;
event BridgeInitiated(
address indexed user,
uint256 indexed destinationChainId,
uint256 amount,
uint256 timestamp
);
event VolumeRecorded(
address indexed user,
uint256 amount,
uint256 totalUserVolume,
uint256 totalProtocolVolume
);
error InvalidAmount();
error TransferFailed();
constructor() Ownable(msg.sender) {}
function initiateBridge(
uint256 destinationChainId
) external payable nonReentrant whenNotPaused {
if (msg.value == 0) revert InvalidAmount();
(bool success, ) = payable(msg.sender).call{value: msg.value}("");
if (!success) revert TransferFailed();
totalVolume += msg.value;
totalTransactions += 1;
userVolume[msg.sender] += msg.value;
userTransactions[msg.sender] += 1;
emit BridgeInitiated(
msg.sender,
destinationChainId,
msg.value,
block.timestamp
);
emit VolumeRecorded(
msg.sender,
msg.value,
userVolume[msg.sender],
totalVolume
);
}
function getUserStats(address user) external view returns (
uint256 volume,
uint256 transactions
) {
return (userVolume[user], userTransactions[user]);
}
function getProtocolStats() external view returns (
uint256 volume,
uint256 transactions
) {
return (totalVolume, totalTransactions);
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function emergencyWithdraw() external onlyOwner {
uint256 balance = address(this).balance;
(bool success, ) = payable(owner()).call{value: balance}("");
if (!success) revert TransferFailed();
}
receive() external payable {}
}
Pausable.sol 112 lines
// 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());
}
}
ReentrancyGuard.sol 87 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
Ownable.sol 100 lines
// 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);
}
}
Context.sol 28 lines
// 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;
}
}
Read Contract
getProtocolStats 0x771aceef → uint256, uint256
getUserStats 0x4e43603a → uint256, uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
totalTransactions 0xb9a60038 → uint256
totalVolume 0x5f81a57c → uint256
userTransactions 0x59d71914 → uint256
userVolume 0xa6769ef8 → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
emergencyWithdraw 0xdb2e21bc
No parameters
initiateBridge 0xbf81beac
uint256 destinationChainId
pause 0x8456cb59
No parameters
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
Recent Transactions
No transactions found for this address