Address Contract Verified
Address
0xcd26390ae2b06FA00AF6B683d0C74fa986d90257
Balance
0 ETH
Nonce
1
Code Size
4661 bytes
Creator
0x0C0eC963...3203 at tx 0x099e1d05...49eaf6
Indexed Transactions
0 (1 on-chain, 1.5% indexed)
Contract Bytecode
4661 bytes
0x608060405260043610610053575f3560e01c806207df3014610057578063715018a6146100955780638da5cb5b146100ab5780639f37092a146100d5578063bcb143ef146100f1578063f2fde38b14610119575b5f5ffd5b348015610062575f5ffd5b5061007d60048036038101906100789190610ab8565b610141565b60405161008c93929190610b14565b60405180910390f35b3480156100a0575f5ffd5b506100a9610191565b005b3480156100b6575f5ffd5b506100bf6101a4565b6040516100cc9190610b49565b60405180910390f35b6100ef60048036038101906100ea9190610ab8565b6101cc565b005b3480156100fc575f5ffd5b5061011760048036038101906101129190610b62565b61051a565b005b348015610124575f5ffd5b5061013f600480360381019061013a9190610bc6565b610805565b005b6002602052815f5260405f20602052805f5260405f205f9150915050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154905083565b610199610889565b6101a25f610910565b565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6101d46109d3565b5f60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f2090505f816001015411610269576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161026090610c4b565b60405180910390fd5b80600101543410156102b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102a790610cb3565b60405180910390fd5b5f8160020154116102f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ed90610d1b565b60405180910390fd5b5f815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16826001015460405161034190610d66565b5f6040518083038185875af1925050503d805f811461037b576040519150601f19603f3d011682016040523d82523d5f602084013e610380565b606091505b50509050806103c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bb90610dea565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1663f242432a835f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff163386600160405180602001604052805f8152506040518663ffffffff1660e01b8152600401610436959493929190610eba565b5f604051808303815f87803b15801561044d575f5ffd5b505af115801561045f573d5f5f3e3d5ffd5b505050506001826002015f8282546104779190610f3f565b925050819055505f82600201540361050c5760025f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8481526020019081526020015f205f5f82015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182015f9055600282015f905550505b5050610516610a17565b5050565b6105226109d3565b5f8111610564576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055b90610fbc565b60405180910390fd5b5f82116105a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059d90611024565b60405180910390fd5b5f849050828173ffffffffffffffffffffffffffffffffffffffff1662fdd58e33876040518363ffffffff1660e01b81526004016105e5929190611042565b602060405180830381865afa158015610600573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610624919061107d565b1015610665576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065c906110f2565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663e985e9c533306040518363ffffffff1660e01b81526004016106a0929190611110565b602060405180830381865afa1580156106bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106df919061116c565b61071e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610715906111e1565b60405180910390fd5b60405180606001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018481525060025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8681526020019081526020015f205f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155905050506107ff610a17565b50505050565b61080d610889565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361087d575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016108749190610b49565b60405180910390fd5b61088681610910565b50565b610891610a20565b73ffffffffffffffffffffffffffffffffffffffff166108af6101a4565b73ffffffffffffffffffffffffffffffffffffffff161461090e576108d2610a20565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016109059190610b49565b60405180910390fd5b565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60025f5403610a0e576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025f81905550565b60015f81905550565b5f33905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a5482610a2b565b9050919050565b610a6481610a4a565b8114610a6e575f5ffd5b50565b5f81359050610a7f81610a5b565b92915050565b5f819050919050565b610a9781610a85565b8114610aa1575f5ffd5b50565b5f81359050610ab281610a8e565b92915050565b5f5f60408385031215610ace57610acd610a27565b5b5f610adb85828601610a71565b9250506020610aec85828601610aa4565b9150509250929050565b610aff81610a4a565b82525050565b610b0e81610a85565b82525050565b5f606082019050610b275f830186610af6565b610b346020830185610b05565b610b416040830184610b05565b949350505050565b5f602082019050610b5c5f830184610af6565b92915050565b5f5f5f5f60808587031215610b7a57610b79610a27565b5b5f610b8787828801610a71565b9450506020610b9887828801610aa4565b9350506040610ba987828801610aa4565b9250506060610bba87828801610aa4565b91505092959194509250565b5f60208284031215610bdb57610bda610a27565b5b5f610be884828501610a71565b91505092915050565b5f82825260208201905092915050565b7f436574206974656d206e276573742070617320656e2076656e746500000000005f82015250565b5f610c35601b83610bf1565b9150610c4082610c01565b602082019050919050565b5f6020820190508181035f830152610c6281610c29565b9050919050565b7f4d6f6e74616e7420656e766f79656520696e737566666973616e7400000000005f82015250565b5f610c9d601b83610bf1565b9150610ca882610c69565b602082019050919050565b5f6020820190508181035f830152610cca81610c91565b9050919050565b7f527570747572652064652073746f636b000000000000000000000000000000005f82015250565b5f610d05601083610bf1565b9150610d1082610cd1565b602082019050919050565b5f6020820190508181035f830152610d3281610cf9565b9050919050565b5f81905092915050565b50565b5f610d515f83610d39565b9150610d5c82610d43565b5f82019050919050565b5f610d7082610d46565b9150819050919050565b7f4563686563206475207472616e7366657274204554482061752076656e6465755f8201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b5f610dd4602183610bf1565b9150610ddf82610d7a565b604082019050919050565b5f6020820190508181035f830152610e0181610dc8565b9050919050565b5f819050919050565b5f819050919050565b5f610e34610e2f610e2a84610e08565b610e11565b610a85565b9050919050565b610e4481610e1a565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610e8c82610e4a565b610e968185610e54565b9350610ea6818560208601610e64565b610eaf81610e72565b840191505092915050565b5f60a082019050610ecd5f830188610af6565b610eda6020830187610af6565b610ee76040830186610b05565b610ef46060830185610e3b565b8181036080830152610f068184610e82565b90509695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610f4982610a85565b9150610f5483610a85565b9250828203905081811115610f6c57610f6b610f12565b5b92915050565b7f50726978203e20300000000000000000000000000000000000000000000000005f82015250565b5f610fa6600883610bf1565b9150610fb182610f72565b602082019050919050565b5f6020820190508181035f830152610fd381610f9a565b9050919050565b7f5175616e74697465203e203000000000000000000000000000000000000000005f82015250565b5f61100e600c83610bf1565b915061101982610fda565b602082019050919050565b5f6020820190508181035f83015261103b81611002565b9050919050565b5f6040820190506110555f830185610af6565b6110626020830184610b05565b9392505050565b5f8151905061107781610a8e565b92915050565b5f6020828403121561109257611091610a27565b5b5f61109f84828501611069565b91505092915050565b7f50617320617373657a2064652073746f636b00000000000000000000000000005f82015250565b5f6110dc601283610bf1565b91506110e7826110a8565b602082019050919050565b5f6020820190508181035f830152611109816110d0565b9050919050565b5f6040820190506111235f830185610af6565b6111306020830184610af6565b9392505050565b5f8115159050919050565b61114b81611137565b8114611155575f5ffd5b50565b5f8151905061116681611142565b92915050565b5f6020828403121561118157611180610a27565b5b5f61118e84828501611158565b91505092915050565b7f4d6172636865206e6f6e20617070726f757665000000000000000000000000005f82015250565b5f6111cb601383610bf1565b91506111d682611197565b602082019050919050565b5f6020820190508181035f8301526111f8816111bf565b905091905056fea264697066735822122051f8531610184cbbea5a7ad6e7d849874c14cf74f2bbcf96a73292dd4024f0df64736f6c634300081f0033
Verified Source Code Full Match
Compiler: v0.8.31+commit.fd3a2265
EVM: osaka
Optimization: No
TehonoMarketplaceV3.sol 48 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract TehonoMarketplaceV3 is ReentrancyGuard, Ownable {
struct Listing {
address seller;
uint256 price;
uint256 quantity;
}
mapping(address => mapping(uint256 => Listing)) public listings;
constructor() Ownable(msg.sender) {}
function listItem(address _nft, uint256 _tokenId, uint256 _quantity, uint256 _price) external nonReentrant {
require(_price > 0, "Prix > 0");
require(_quantity > 0, "Quantite > 0");
IERC1155 nft = IERC1155(_nft);
require(nft.balanceOf(msg.sender, _tokenId) >= _quantity, "Pas assez de stock");
require(nft.isApprovedForAll(msg.sender, address(this)), "Marche non approuve");
listings[_nft][_tokenId] = Listing(msg.sender, _price, _quantity);
}
function buyItem(address _nft, uint256 _tokenId) external payable nonReentrant {
Listing storage listing = listings[_nft][_tokenId];
require(listing.price > 0, "Cet item n'est pas en vente");
require(msg.value >= listing.price, "Montant envoyee insuffisant");
require(listing.quantity > 0, "Rupture de stock");
(bool success, ) = listing.seller.call{value: listing.price}("");
require(success, "Echec du transfert ETH au vendeur");
IERC1155(_nft).safeTransferFrom(listing.seller, msg.sender, _tokenId, 1, bytes(""));
listing.quantity -= 1;
if (listing.quantity == 0) {
delete listings[_nft][_tokenId];
}
}
}
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);
}
}
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;
}
}
IERC1155.sol 123 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/IERC1155.sol)
pragma solidity >=0.6.2;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[ERC].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}
IERC165.sol 25 lines
// 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);
}
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
listings 0x0007df30 → address, uint256, uint256
owner 0x8da5cb5b → address
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
buyItem 0x9f37092a
address _nft
uint256 _tokenId
listItem 0xbcb143ef
address _nft
uint256 _tokenId
uint256 _quantity
uint256 _price
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
This address has 1 on-chain transactions, but only 1.5% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →