Address Contract Verified
Address
0x476908D9f75687684CE3DBF6990e722129cDbCc6
Balance
0 ETH
Nonce
2
Code Size
5933 bytes
Creator
0xC7A7a140...7dEd at tx 0xcd2b3cbe...c67f8d
Indexed Transactions
0
Contract Bytecode
5933 bytes
0x608060405234801561000f575f80fd5b5060043610610115575f3560e01c806370a08231116100ad578063b6b55f251161007d578063d505accf11610063578063d505accf14610289578063d6d2bb981461029c578063dd62ed3e146102d1575f80fd5b8063b6b55f251461026e578063b8bdd4b214610281575f80fd5b806370a08231146102155780637ecebe001461023457806395d89b4114610253578063a9059cbb1461025b575f80fd5b80632e1a7d4d116100e85780632e1a7d4d14610184578063313ce567146101995780633644e515146101d25780636f307dc3146101da575f80fd5b806306fdde0314610119578063095ea7b31461013757806318160ddd1461015a57806323b872dd14610171575b5f80fd5b6101216102fb565b60405161012e9190610f3f565b60405180910390f35b61014a610145366004610fd0565b610386565b604051901515815260200161012e565b61016360025481565b60405190815260200161012e565b61014a61017f366004610ff8565b6103ff565b610197610192366004611031565b61053f565b005b6101c07f000000000000000000000000000000000000000000000000000000000000000881565b60405160ff909116815260200161012e565b610163610663565b73853737186cb24d4152f979b9152f652b67f7e9b75b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161012e565b610163610223366004611048565b60036020525f908152604090205481565b610163610242366004611048565b60056020525f908152604090205481565b6101216106bd565b61014a610269366004610fd0565b6106ca565b61019761027c366004611031565b61074d565b610197610960565b610197610297366004611068565b610a7e565b6101f06102aa366004611048565b60066020525f908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6101636102df3660046110d5565b600460209081525f928352604080842090915290825290205481565b5f805461030790611106565b80601f016020809104026020016040519081016040528092919081815260200182805461033390611106565b801561037e5780601f106103555761010080835404028352916020019161037e565b820191905f5260205f20905b81548152906001019060200180831161036157829003601f168201915b505050505081565b335f81815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103ed9086815260200190565b60405180910390a35060015b92915050565b73ffffffffffffffffffffffffffffffffffffffff83165f9081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610491576104608382611184565b73ffffffffffffffffffffffffffffffffffffffff86165f9081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff85165f90815260036020526040812080548592906104c5908490611184565b909155505073ffffffffffffffffffffffffffffffffffffffff8085165f81815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061052c9087815260200190565b60405180910390a3506001949350505050565b335f9081526003602052604090205481111561058e576040517fbb0abd100000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b6105983382610d97565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081523360048201526024810182905273853737186cb24d4152f979b9152f652b67f7e9b79063a9059cbb906044016020604051808303815f875af1158015610606573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061062a9190611197565b5060405181815233907f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b659060200160405180910390a250565b5f7f0000000000000000000000000000000000000000000000000000000000000001461461069857610693610e2b565b905090565b507f8f257b1fbf4177c669c1248faac39bcbe54fb966b26a4c35862f0da859f4c5b790565b6001805461030790611106565b335f908152600360205260408120805483919083906106ea908490611184565b909155505073ffffffffffffffffffffffffffffffffffffffff83165f81815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103ed9086815260200190565b335f9081526006602052604090205473ffffffffffffffffffffffffffffffffffffffff16806107ab576040517fd58c4e1d000000000000000000000000000000000000000000000000000000008152336004820152602401610585565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152829073853737186cb24d4152f979b9152f652b67f7e9b7906370a08231906024016020604051808303815f875af115801561082a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084e91906111b6565b1015610888576040517f5bed6089000000000000000000000000000000000000000000000000000000008152336004820152602401610585565b6108923383610ec3565b6040517f8d3c100a0000000000000000000000000000000000000000000000000000000081526004810183905273853737186cb24d4152f979b9152f652b67f7e9b7602482015273ffffffffffffffffffffffffffffffffffffffff821690638d3c100a906044015f604051808303815f87803b158015610911575f80fd5b505af1158015610923573d5f803e3d5ffd5b50506040518481523392507fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c915060200160405180910390a25050565b335f9081526006602052604090205473ffffffffffffffffffffffffffffffffffffffff16156109be576040517f2ff21ac5000000000000000000000000000000000000000000000000000000008152336004820152602401610585565b306040516109cb90610f32565b73ffffffffffffffffffffffffffffffffffffffff9091168152602001604051809103905ff080158015610a01573d5f803e3d5ffd5b50335f8181526006602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9590951694909417909355915190917f2c601b1355d1a6cd1373df5a1e2460c77aedfbb5c16c66b47bb96b35462808e291a2565b42841015610ae8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f455850495245440000000000000000006044820152606401610585565b5f6001610af3610663565b73ffffffffffffffffffffffffffffffffffffffff8a81165f8181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201205f84529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610c41573d5f803e3d5ffd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610cbc57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610d22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e45520000000000000000000000000000000000006044820152606401610585565b73ffffffffffffffffffffffffffffffffffffffff9081165f9081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526003602052604081208054839290610dcb908490611184565b90915550506002805482900390556040518181525f9073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f5f604051610e5b91906111cd565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b8060025f828254610ed491906112a0565b909155505073ffffffffffffffffffffffffffffffffffffffff82165f818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610e1f565b610444806112b483390190565b5f6020808352835180828501525f5b81811015610f6a57858101830151858201604001528201610f4e565b505f6040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610fcb575f80fd5b919050565b5f8060408385031215610fe1575f80fd5b610fea83610fa8565b946020939093013593505050565b5f805f6060848603121561100a575f80fd5b61101384610fa8565b925061102160208501610fa8565b9150604084013590509250925092565b5f60208284031215611041575f80fd5b5035919050565b5f60208284031215611058575f80fd5b61106182610fa8565b9392505050565b5f805f805f805f60e0888a03121561107e575f80fd5b61108788610fa8565b965061109560208901610fa8565b95506040880135945060608801359350608088013560ff811681146110b8575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f80604083850312156110e6575f80fd5b6110ef83610fa8565b91506110fd60208401610fa8565b90509250929050565b600181811c9082168061111a57607f821691505b602082108103611151577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b818103818111156103f9576103f9611157565b5f602082840312156111a7575f80fd5b81518015158114611061575f80fd5b5f602082840312156111c6575f80fd5b5051919050565b5f80835481600182811c9150808316806111e857607f831692505b60208084108203611220577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015611234576001811461126757611292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0086168952841515850289019650611292565b5f8a8152602090205f5b8681101561128a5781548b820152908501908301611271565b505084890196505b509498975050505050505050565b808201808211156103f9576103f961115756fe608060405234801561000f575f80fd5b5060405161044438038061044483398101604081905261002e9161007c565b5f80546001600160a01b0319166001600160a01b03831690811782556040518392907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350506100a9565b5f6020828403121561008c575f80fd5b81516001600160a01b03811681146100a2575f80fd5b9392505050565b61038e806100b65f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c80638d3c100a146100435780638da5cb5b14610058578063f2fde38b146100a0575b5f80fd5b6100566100513660046102e9565b6100b3565b005b5f546100779073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100566100ae366004610317565b6101d6565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b5f546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018490529082169063a9059cbb906044016020604051808303815f875af11580156101ad573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101d19190610339565b505050565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610256576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640161012f565b5f80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b73ffffffffffffffffffffffffffffffffffffffff811681146102e6575f80fd5b50565b5f80604083850312156102fa575f80fd5b82359150602083013561030c816102c5565b809150509250929050565b5f60208284031215610327575f80fd5b8135610332816102c5565b9392505050565b5f60208284031215610349575f80fd5b81518015158114610332575f80fdfea2646970667358221220efd0711d95e99aca70a12e338b96d7d89f0e1e5dbacc9b2d39c9e4136a860c2364736f6c63430008140033a2646970667358221220cd5f16044e74935ca930ef2942e63cdb7ddf8e11eb503358a2b0efa1464a158864736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: Yes (1000000 runs)
DropBox.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {Owned} from "solmate/auth/Owned.sol";
import {IBitcoin} from "../interfaces/IBitcoin.sol";
contract DropBox is Owned {
constructor(address owner_) Owned(owner_) {}
function collect(uint256 value, IBitcoin underlying) public onlyOwner {
underlying.transfer(owner, value);
}
}
WrappedBitcoin.sol 89 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {ERC20} from "solmate/tokens/ERC20.sol";
import {Owned} from "solmate/auth/Owned.sol";
import {IBitcoin} from "../interfaces/IBitcoin.sol";
import {DropBox} from "./DropBox.sol";
contract WrappedBitcoin is ERC20 {
// =============================================================
// ERRORS
// =============================================================
error DropBoxNotCreated(address owner);
error DropBoxAlreadyExists(address owner);
error DropBoxInsufficientBalance(address owner);
error OwnerInsufficientBalance(address owner);
// =============================================================
// EVENTS
// =============================================================
event DropBoxCreated(address indexed owner);
event Deposit(address indexed from, uint256 amount);
event Withdrawal(address indexed to, uint256 amount);
// =============================================================
// CONSTANTS
// =============================================================
/// @dev The address of the underlying token.
address private constant _UNDERLYING = address(0x853737186cb24D4152f979B9152F652b67F7e9b7);
// =============================================================
// STORAGE
// =============================================================
/// @notice The mapping of drop boxes.
mapping(address => address) public dropBoxes;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor() ERC20("Wrapped Bitcoin", "WBTC", 8) {}
// =============================================================
// FUNCTIONS
// =============================================================
/// @notice Creates a drop box for the caller.
function createDropBox() public {
if (dropBoxes[msg.sender] != address(0)) revert DropBoxAlreadyExists(msg.sender);
dropBoxes[msg.sender] = address(new DropBox(address(this)));
emit DropBoxCreated(msg.sender);
}
/// @notice Deposits tokens into the wrapper.
/// @param amount The amount of tokens to deposit.
function deposit(uint256 amount) public {
address dropBox = dropBoxes[msg.sender];
if (dropBox == address(0)) revert DropBoxNotCreated(msg.sender);
if (IBitcoin(_UNDERLYING).balanceOf(dropBox) < amount) revert DropBoxInsufficientBalance(msg.sender);
_mint(msg.sender, amount);
DropBox(dropBox).collect(amount, IBitcoin(_UNDERLYING));
emit Deposit(msg.sender, amount);
}
/// @notice Withdraws tokens from the wrapper.
/// @param amount The amount of tokens to withdraw.
function withdraw(uint256 amount) public {
if (balanceOf[msg.sender] < amount) revert OwnerInsufficientBalance(msg.sender);
_burn(msg.sender, amount);
IBitcoin(_UNDERLYING).transfer(msg.sender, amount);
emit Withdrawal(msg.sender, amount);
}
/// @notice Returns the underlying token.
function underlying() public pure returns (address) {
return _UNDERLYING;
}
}
IBitcoin.sol 8 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
interface IBitcoin {
function balanceOf(address owner) external returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function decimals() external returns (uint8);
}
Owned.sol 44 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Simple single owner authorization mixin.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)
abstract contract Owned {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event OwnershipTransferred(address indexed user, address indexed newOwner);
/*//////////////////////////////////////////////////////////////
OWNERSHIP STORAGE
//////////////////////////////////////////////////////////////*/
address public owner;
modifier onlyOwner() virtual {
require(msg.sender == owner, "UNAUTHORIZED");
_;
}
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(address _owner) {
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
/*//////////////////////////////////////////////////////////////
OWNERSHIP LOGIC
//////////////////////////////////////////////////////////////*/
function transferOwnership(address newOwner) public virtual onlyOwner {
owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
}
}
ERC20.sol 206 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*//////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*//////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*//////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*//////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*//////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
),
v,
r,
s
);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}
Read Contract
DOMAIN_SEPARATOR 0x3644e515 → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
dropBoxes 0xd6d2bb98 → address
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
underlying 0x6f307dc3 → address
Write Contract 7 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
createDropBox 0xb8bdd4b2
No parameters
deposit 0xb6b55f25
uint256 amount
permit 0xd505accf
address owner
address spender
uint256 value
uint256 deadline
uint8 v
bytes32 r
bytes32 s
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
withdraw 0x2e1a7d4d
uint256 amount
Recent Transactions
No transactions found for this address