Address Contract Verified
Address
0x0111a12140C0Bb6A1E544d08f0D22e4580368cE5
Balance
0 ETH
Nonce
1
Code Size
6882 bytes
Creator
0xB7886fDC...Ca80 at tx 0x298481c8...7770f1
Indexed Transactions
0
Contract Bytecode
6882 bytes
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80639c0ced83116100a25780639e07f0db116100715780639e07f0db14610261578063b46324471461027d578063be027e8b1461029b578063e30c3978146102b9578063f698da25146102d757610116565b80639c0ced83146101fd5780639d1d6b8a1461021b5780639d54c79d146102255780639d76ea581461024357610116565b806338a5e016116100e957806338a5e016146101915780635024f4891461019b5780637298bdf7146101b75780638da5cb5b146101c15780639a8a0592146101df57610116565b8063080fec241461011b578063141a8dd81461013757806316b926461461015557806338184dc314610173575b600080fd5b610135600480360381019061013091906111a1565b6102f5565b005b61013f6104cb565b60405161014c91906111dd565b60405180910390f35b61015d6104ef565b60405161016a9190611211565b60405180910390f35b61017b6104f5565b6040516101889190611211565b60405180910390f35b6101996104fb565b005b6101b560048036038101906101b091906111a1565b61057d565b005b6101bf6106c5565b005b6101c96108be565b6040516101d691906111dd565b60405180910390f35b6101e76108e2565b6040516101f49190611211565b60405180910390f35b610205610906565b60405161021291906111dd565b60405180910390f35b61022361092c565b005b61022d610b1c565b60405161023a91906111dd565b60405180910390f35b61024b610b40565b604051610258919061128b565b60405180910390f35b61027b6004803603810190610276919061136d565b610b64565b005b610285610ece565b6040516102929190611457565b60405180910390f35b6102a3610ee1565b6040516102b09190611457565b60405180910390f35b6102c1610ef4565b6040516102ce91906111dd565b60405180910390f35b6102df610f1a565b6040516102ec9190611481565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037a9061151f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e99061158b565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610480576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104779061161d565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055504260038190555050565b7f0000000000000000000000004c2949f6589c12662aa27ba5e0b0f84b351b28fc81565b60035481565b60045481565b7f00000000000000000000000060158131416f5e53d55d73a11be2e203cb26abcc73ffffffffffffffffffffffffffffffffffffffff166379ba50976040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561056357600080fd5b505af1158015610577573d6000803e3d6000fd5b50505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461060b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106029061151f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361067a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106719061158b565b60405180910390fd5b4260048190555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610753576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074a9061151f565b60405180910390fd5b6202a300600454610764919061166c565b4210156107a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079d90611712565b60405180910390fd5b7f00000000000000000000000060158131416f5e53d55d73a11be2e203cb26abcc73ffffffffffffffffffffffffffffffffffffffff1663f2fde38b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b815260040161082191906111dd565b600060405180830381600087803b15801561083b57600080fd5b505af115801561084f573d6000803e3d6000fd5b5050505060011515600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fcbe2aa772079086290469c944126fdc8e1438a556b92ebdb5044506435217f0460405160405180910390a3565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f00000000000000000000000000000000000000000000000000000000009a725781565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b3906117a4565b60405180910390fd5b6202a3006003546109cd919061166c565b421015610a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0690611712565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001151560008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fcbe2aa772079086290469c944126fdc8e1438a556b92ebdb5044506435217f0460405160405180910390a3565b7f000000000000000000000000935711c2f34078a833c9465ef2fc77194b97de5e81565b7f00000000000000000000000060158131416f5e53d55d73a11be2e203cb26abcc81565b85600015156006600083815260200190815260200160002060009054906101000a900460ff16151514610b9657600080fd5b60001515600060149054906101000a900460ff16151514610bec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be390611836565b60405180910390fd5b6001600060146101000a81548160ff02191690831515021790555060007f3c1316138cd3c347ee70454f6b80926b84604f3f07629dbed9845a8c06cc9ea3888b8b604051602001610c409493929190611856565b604051602081830303815290604052805190602001209050610cc886868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505088837f0000000000000000000000004c2949f6589c12662aa27ba5e0b0f84b351b28fc610f3e565b610d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cfe906118e7565b60405180910390fd5b610d7784848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505088837f000000000000000000000000935711c2f34078a833c9465ef2fc77194b97de5e610f3e565b610db6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dad90611953565b60405180910390fd5b6001600660008a815260200190815260200160002060006101000a81548160ff0219169083151502179055507f00000000000000000000000060158131416f5e53d55d73a11be2e203cb26abcc73ffffffffffffffffffffffffffffffffffffffff166340c10f198b8b6040518363ffffffff1660e01b8152600401610e3d929190611973565b600060405180830381600087803b158015610e5757600080fd5b505af1158015610e6b573d6000803e3d6000fd5b505050507f48b87fc02925b37a6aefac60c14fa9d8e9988d7dfadf262d4bd845872ca407308a8a604051610ea0929190611973565b60405180910390a160008060146101000a81548160ff02191690831515021790555050505050505050505050565b600560019054906101000a900460ff1681565b600560009054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f55774bbb6c4d74b787b556ec05076d3469f8c87e3b33c81a887a01c4406c6c9281565b6000807f55774bbb6c4d74b787b556ec05076d3469f8c87e3b33c81a887a01c4406c6c9284604051602001610f74929190611a14565b604051602081830303815290604052805190602001209050808514610f9857600080fd5b610fa28587610fdb565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614915050949350505050565b600080600080610fea8561100d565b8093508194508295505050506110028684848461103f565b935050505092915050565b6000806000604184511461102057600080fd5b6020840151915060408401519050606084015160001a92509193909250565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08260001c11156110755760009050611131565b601b8460ff161415801561108d5750601c8460ff1614155b1561109b5760009050611131565b6000600186868686604051600081526020016040526040516110c09493929190611a67565b6020604051602081039080840390855afa1580156110e2573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361112c576000915050611131565b809150505b949350505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061116e82611143565b9050919050565b61117e81611163565b811461118957600080fd5b50565b60008135905061119b81611175565b92915050565b6000602082840312156111b7576111b6611139565b5b60006111c58482850161118c565b91505092915050565b6111d781611163565b82525050565b60006020820190506111f260008301846111ce565b92915050565b6000819050919050565b61120b816111f8565b82525050565b60006020820190506112266000830184611202565b92915050565b6000819050919050565b600061125161124c61124784611143565b61122c565b611143565b9050919050565b600061126382611236565b9050919050565b600061127582611258565b9050919050565b6112858161126a565b82525050565b60006020820190506112a0600083018461127c565b92915050565b6112af816111f8565b81146112ba57600080fd5b50565b6000813590506112cc816112a6565b92915050565b6000819050919050565b6112e5816112d2565b81146112f057600080fd5b50565b600081359050611302816112dc565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261132d5761132c611308565b5b8235905067ffffffffffffffff81111561134a5761134961130d565b5b60208301915083600182028301111561136657611365611312565b5b9250929050565b60008060008060008060008060c0898b03121561138d5761138c611139565b5b600061139b8b828c0161118c565b98505060206113ac8b828c016112bd565b97505060406113bd8b828c016112f3565b96505060606113ce8b828c016112f3565b955050608089013567ffffffffffffffff8111156113ef576113ee61113e565b5b6113fb8b828c01611317565b945094505060a089013567ffffffffffffffff81111561141e5761141d61113e565b5b61142a8b828c01611317565b92509250509295985092959890939650565b60008115159050919050565b6114518161143c565b82525050565b600060208201905061146c6000830184611448565b92915050565b61147b816112d2565b82525050565b60006020820190506114966000830184611472565b92915050565b600082825260208201905092915050565b7f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60008201527f6e00000000000000000000000000000000000000000000000000000000000000602082015250565b600061150960218361149c565b9150611514826114ad565b604082019050919050565b60006020820190508181036000830152611538816114fc565b9050919050565b7f4e6577206f776e65722063616e6e6f74206265207a65726f2061646472657373600082015250565b600061157560208361149c565b91506115808261153f565b602082019050919050565b600060208201905081810360008301526115a481611568565b9050919050565b7f4e6577206f776e657220697320616c7265616479207468652063757272656e7460008201527f206f776e65720000000000000000000000000000000000000000000000000000602082015250565b600061160760268361149c565b9150611612826115ab565b604082019050919050565b60006020820190508181036000830152611636816115fa565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611677826111f8565b9150611682836111f8565b925082820190508082111561169a5761169961163d565b5b92915050565b7f4d757374207761697420343820686f75727320746f20636f6e6669726d20747260008201527f616e736665722e00000000000000000000000000000000000000000000000000602082015250565b60006116fc60278361149c565b9150611707826116a0565b604082019050919050565b6000602082019050818103600083015261172b816116ef565b9050919050565b7f4f6e6c792070656e64696e67206f776e65722063616e2066696e616c697a652060008201527f6f776e657273686970207472616e736665720000000000000000000000000000602082015250565b600061178e60328361149c565b915061179982611732565b604082019050919050565b600060208201905081810360008301526117bd81611781565b9050919050565b7f52652d656e7472616e6379206775617264207472696767657265643a2062726960008201527f6467696e6720616c726561647920696e2070726f677265737300000000000000602082015250565b600061182060398361149c565b915061182b826117c4565b604082019050919050565b6000602082019050818103600083015261184f81611813565b9050919050565b600060808201905061186b6000830187611472565b6118786020830186611472565b61188560408301856111ce565b6118926060830184611202565b95945050505050565b7f496e76616c6964207369676e61747572652066726f6d20617070726f76657200600082015250565b60006118d1601f8361149c565b91506118dc8261189b565b602082019050919050565b60006020820190508181036000830152611900816118c4565b9050919050565b7f496e76616c6964207369676e61747572652066726f6d206e6f74617279000000600082015250565b600061193d601d8361149c565b915061194882611907565b602082019050919050565b6000602082019050818103600083015261196c81611930565b9050919050565b600060408201905061198860008301856111ce565b6119956020830184611202565b9392505050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b60006119dd60028361199c565b91506119e8826119a7565b600282019050919050565b6000819050919050565b611a0e611a09826112d2565b6119f3565b82525050565b6000611a1f826119d0565b9150611a2b82856119fd565b602082019150611a3b82846119fd565b6020820191508190509392505050565b600060ff82169050919050565b611a6181611a4b565b82525050565b6000608082019050611a7c6000830187611472565b611a896020830186611a58565b611a966040830185611472565b611aa36060830184611472565b9594505050505056fea26469706673582212207d3511c409a0fbdd34c23b02d830b41f44dd0362028dd1c55a667861951f203e64736f6c63430008120033
Verified Source Code Full Match
Compiler: v0.8.18+commit.87f61d96
EVM: paris
Optimization: No
BridgeMinterTimeLock.sol 183 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
interface ERC20 {
function transferOwnership(address _newOwner) external;
function acceptOwnership() external;
function totalSupply() external view returns (uint);
function mint(address to, uint256 value) external;
}
contract BridgeMinterTimeLock {
// Declare the immutable variables at the contract level
address public immutable approver;
address public immutable notary;
ERC20 public immutable tokenAddress;
uint256 public immutable chainId;
bytes32 public immutable domainSeparator;
address public owner;
bool private bridging;
address public pendingOwner;
address public erc20PendingOwner;
uint public ownershipTransferInitiatedAt;
uint public erc20OwnershipTransferInitiatedAt;
uint constant TRANSFER_DELAY = 48 hours;
bool public notaryApprove;
bool public approverApprove;
mapping(bytes32 => bool) private nonces;
event Bridged(address receiver, uint256 amount);
event TransferOwnership(address indexed owner, bool indexed confirmed);
constructor(
address _owner,
address _approver,
address _notary,
address _tokenContractAddress,
uint256 _chainId
) {
require(_owner != address(0), "Invalid owner");
require(_approver != address(0), "Invalid approver");
require(_notary != address(0), "Invalid notary");
require(_tokenContractAddress != address(0), "Invalid token contract address");
owner = _owner;
approver = _approver;
notary = _notary;
tokenAddress = ERC20(_tokenContractAddress);
chainId = _chainId;
domainSeparator = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId)"),
keccak256("Neptune Bridge"),
keccak256("0.0.1"),
_chainId
)
);
}
// Function to initiate ownership transfer
function initiateTransferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0), "New owner cannot be zero address");
require(_newOwner != owner, "New owner is already the current owner");
pendingOwner = _newOwner;
ownershipTransferInitiatedAt = block.timestamp;
}
// Function to finalize ownership transfer after 48 hours
function finalizeTransferOwnership() public {
require(msg.sender == pendingOwner, "Only pending owner can finalize ownership transfer");
require(block.timestamp >= ownershipTransferInitiatedAt + TRANSFER_DELAY, "Must wait 48 hours to confirm transfer.");
owner = pendingOwner;
pendingOwner = address(0);
emit TransferOwnership(owner, true); // Emit an event to log the ownership transfer
}
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this function");
_;
}
// Function to initiate token ownership transfer
function initiateTransferTokenOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0), "New owner cannot be zero address");
erc20OwnershipTransferInitiatedAt = block.timestamp;
erc20PendingOwner = _newOwner;
}
// Function to finalize token ownership transfer after 48 hours
function completeTransferTokenOwnership() public onlyOwner {
require(block.timestamp >= erc20OwnershipTransferInitiatedAt + TRANSFER_DELAY, "Must wait 48 hours to confirm transfer.");
tokenAddress.transferOwnership(erc20PendingOwner);
emit TransferOwnership(erc20PendingOwner, true); // Emit an event to log the token ownership transfer
}
function acceptTokenOwnership() public {
tokenAddress.acceptOwnership();
}
modifier checkNonce(bytes32 nonce) {
require(nonces[nonce]==false); // dev: already processed
_;
}
function bridge(address sender, uint256 bridgedAmount, bytes32 nonce, bytes32 messageHash, bytes calldata approvedMessage, bytes calldata notarizedMessage)
external checkNonce(nonce) {
require(bridging == false, "Re-entrancy guard triggered: bridging already in progress"); // Re-entrancy guard
bridging = true;
bytes32 hashToVerify = keccak256(
abi.encode(keccak256("SignedMessage(bytes32 key,address sender,uint256 amount)"), nonce, sender, bridgedAmount)
);
require(checkEncoding(approvedMessage, messageHash, hashToVerify, approver), "Invalid signature from approver"); // Check approver's signature
require(checkEncoding(notarizedMessage, messageHash, hashToVerify, notary), "Invalid signature from notary"); // Check notary's signature
nonces[nonce]=true;
ERC20(tokenAddress).mint(sender, bridgedAmount);
emit Bridged(sender, bridgedAmount);
bridging = false;
}
function checkEncoding(bytes memory signedMessage,bytes32 messageHash, bytes32 hashToVerify, address signer)
internal view returns(bool){
bytes32 domainSeparatorHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, hashToVerify));
require(messageHash == domainSeparatorHash); //dev: values do not match
return signer == recoverSigner(messageHash, signedMessage);
}
function splitSignature(bytes memory sig)
internal pure returns (uint8 v, bytes32 r, bytes32 s){
require(sig.length == 65); // dev: signature invalid
assembly {
// first 32 bytes, after the length prefix.
r := mload(add(sig, 32))
// second 32 bytes.
s := mload(add(sig, 64))
// final byte (first byte of the next 32 bytes).
v := byte(0, mload(add(sig, 96)))
}
return (v, r, s);
}
function recoverSigner(bytes32 message, bytes memory sig)
internal pure returns (address){
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = splitSignature(sig);
return tryRecover(message, v, r, s);
}
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
internal
pure
returns (address) {
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return address(0);
} else if (v != 27 && v != 28) {
return address(0);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return address(0);
}
return signer;
}
}
Read Contract
approver 0x141a8dd8 → address
approverApprove 0xb4632447 → bool
chainId 0x9a8a0592 → uint256
domainSeparator 0xf698da25 → bytes32
erc20OwnershipTransferInitiatedAt 0x38184dc3 → uint256
erc20PendingOwner 0x9c0ced83 → address
notary 0x9d54c79d → address
notaryApprove 0xbe027e8b → bool
owner 0x8da5cb5b → address
ownershipTransferInitiatedAt 0x16b92646 → uint256
pendingOwner 0xe30c3978 → address
tokenAddress 0x9d76ea58 → address
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
acceptTokenOwnership 0x38a5e016
No parameters
bridge 0x9e07f0db
address sender
uint256 bridgedAmount
bytes32 nonce
bytes32 messageHash
bytes approvedMessage
bytes notarizedMessage
completeTransferTokenOwnership 0x7298bdf7
No parameters
finalizeTransferOwnership 0x9d1d6b8a
No parameters
initiateTransferOwnership 0x080fec24
address _newOwner
initiateTransferTokenOwnership 0x5024f489
address _newOwner
Recent Transactions
No transactions found for this address