Address Contract Verified
Address
0x6d279F25Ea23F868579e3cFaE3224EDA512eca70
Balance
0 ETH
Nonce
1
Code Size
3757 bytes
Creator
0xfE3d319a...88Dc at tx 0x56a6356a...4d0973
Indexed Transactions
0
Contract Bytecode
3757 bytes
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063a3908e1b1161005b578063a3908e1b1461013f578063e3a8665a14610152578063f2fde38b1461015b578063f940e3851461016e57600080fd5b806366d49bab1461008d57806370a08231146100a2578063780249cd146100d55780638da5cb5b1461011a575b600080fd5b6100a061009b366004610cd4565b610181565b005b6100c26100b0366004610d16565b60036020526000908152604090205481565b6040519081526020015b60405180910390f35b6001546100f59073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100cc565b6000546100f590610100900473ffffffffffffffffffffffffffffffffffffffff1681565b6100a061014d366004610cd4565b610227565b6100c260025481565b6100a0610169366004610d16565b61063b565b6100a061017c366004610d31565b61071e565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1633146101f25760405162461bcd60e51b815260206004820152600c60248201527f756e617574686f72697a6564000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6002819055604051819033907f72b621e4312ff2098ba32e1e38a4cd07e1cc843ba7cb617973f2094f14c0dd4b90600090a350565b60005460ff161561027a5760405162461bcd60e51b815260206004820152600960248201527f7265656e7472616e74000000000000000000000000000000000000000000000060448201526064016101e9565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055806102f25760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e7400000000000000000000000000000000000060448201526064016101e9565b6001546040517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152829173ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103849190610d64565b10156103d25760405162461bcd60e51b815260206004820152601460248201527f696e73756666696369656e742062616c616e636500000000000000000000000060448201526064016101e9565b6001546040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152829173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90604401602060405180830381865afa158015610446573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046a9190610d64565b10156104b85760405162461bcd60e51b815260206004820152601660248201527f696e73756666696369656e7420616c6c6f77616e63650000000000000000000060448201526064016101e9565b600254600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190610d64565b111561059a5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420737570706c7900000000000000000000000000000000000060448201526064016101e9565b6001546105bf9073ffffffffffffffffffffffffffffffffffffffff163330846108f1565b33600090815260036020526040812080548392906105de908490610d7d565b9091555050604051819033907fa428517b481b65176e7c35a57b564d5cf943c8462468b8a0f025fa689173f90190600090a350600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1633146106a75760405162461bcd60e51b815260206004820152600c60248201527f756e617574686f72697a6564000000000000000000000000000000000000000060448201526064016101e9565b600080547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010073ffffffffffffffffffffffffffffffffffffffff8416908102919091178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600054610100900473ffffffffffffffffffffffffffffffffffffffff16331461078a5760405162461bcd60e51b815260206004820152600c60248201527f756e617574686f72697a6564000000000000000000000000000000000000000060448201526064016101e9565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156107f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081d9190610d64565b90506000811161086f5760405162461bcd60e51b815260206004820152601460248201527f696e73756666696369656e742062616c616e636500000000000000000000000060448201526064016101e9565b61089073ffffffffffffffffffffffffffffffffffffffff831684836109d3565b808373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb60405160405180910390a450505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526109cd9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610a2e565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610a299084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161094b565b505050565b6000610a90826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610b209092919063ffffffff16565b805190915015610a295780806020019051810190610aae9190610dbc565b610a295760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016101e9565b6060610b2f8484600085610b39565b90505b9392505050565b606082471015610bb15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016101e9565b73ffffffffffffffffffffffffffffffffffffffff85163b610c155760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101e9565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610c3e9190610e0a565b60006040518083038185875af1925050503d8060008114610c7b576040519150601f19603f3d011682016040523d82523d6000602084013e610c80565b606091505b5091509150610c90828286610c9b565b979650505050505050565b60608315610caa575081610b32565b825115610cba5782518084602001fd5b8160405162461bcd60e51b81526004016101e99190610e26565b600060208284031215610ce657600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610d1157600080fd5b919050565b600060208284031215610d2857600080fd5b610b3282610ced565b60008060408385031215610d4457600080fd5b610d4d83610ced565b9150610d5b60208401610ced565b90509250929050565b600060208284031215610d7657600080fd5b5051919050565b60008219821115610db7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b600060208284031215610dce57600080fd5b81518015158114610b3257600080fd5b60005b83811015610df9578181015183820152602001610de1565b838111156109cd5750506000910152565b60008251610e1c818460208701610dde565b9190910192915050565b6020815260008251806020840152610e45816040850160208701610dde565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212200e94f2fb870cb3894c59399a97b248a6bd8f36c37f9a921dc3c636e2ae564d5364736f6c634300080c0033
Verified Source Code Full Match
Compiler: v0.8.12+commit.f00d7308
EVM: london
Optimization: Yes (10000 runs)
Convert.sol 75 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "./interfaces/IERC20.sol";
import "./libraries/SafeERC20.sol";
contract Convert {
using SafeERC20 for IERC20;
bool private entered;
address public owner;
IERC20 public DC;
uint256 public snapshotSupply;
mapping (address => uint256) public balanceOf;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event Converted(address indexed sender, uint256 indexed value);
event Withdrawn(address indexed token, address indexed to, uint256 indexed value);
event TotalSupplyUpdated(address indexed sender, uint256 indexed totalSupply);
constructor(address token, uint256 supply) {
DC = IERC20(token);
snapshotSupply = supply;
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
modifier nonReentrant() {
require(!entered, "reentrant");
entered = true;
_;
entered = false;
}
modifier onlyOwner() {
require(msg.sender == owner, "unauthorized");
_;
}
function convert(uint256 amount) external nonReentrant {
require(amount > 0, "invalid amount");
require(DC.balanceOf(msg.sender) >= amount, "insufficient balance");
require(DC.allowance(msg.sender, address(this)) >= amount, "insufficient allowance");
require(DC.totalSupply() <= snapshotSupply, "invalid supply");
DC.safeTransferFrom(msg.sender, address(this), amount);
balanceOf[msg.sender] += amount;
emit Converted(msg.sender, amount);
}
function withdraw(address token, address to) external onlyOwner {
IERC20 erc20 = IERC20(token);
uint256 balance = erc20.balanceOf(address(this));
require(balance > 0, "insufficient balance");
erc20.safeTransfer(to, balance);
emit Withdrawn(token, to, balance);
}
function transferOwnership(address newOwner) external onlyOwner {
owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
}
function updateTotalSupply(uint256 totalSupply) external onlyOwner {
snapshotSupply = totalSupply;
emit TotalSupplyUpdated(msg.sender, totalSupply);
}
}
IERC20.sol 38 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function factory() external view returns (address);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function nonces(address account) external view returns (uint256);
function mint(address to, uint256 amount) external;
function burn(uint256 amount) external;
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
Address.sol 99 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
SafeERC20.sol 86 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "../interfaces/IERC20.sol";
import "./Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20 token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
Read Contract
DC 0x780249cd → address
balanceOf 0x70a08231 → uint256
owner 0x8da5cb5b → address
snapshotSupply 0xe3a8665a → uint256
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
convert 0xa3908e1b
uint256 amount
transferOwnership 0xf2fde38b
address newOwner
updateTotalSupply 0x66d49bab
uint256 totalSupply
withdraw 0xf940e385
address token
address to
Recent Transactions
No transactions found for this address