-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f63c02
commit 7b10190
Showing
5 changed files
with
76 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { IDN404 } from "./Interface/IDN404.sol"; | ||
import { Context } from "@openzeppelin/contracts/utils/Context.sol"; | ||
|
||
|
||
error PriceNotMet(address nftAddress, uint256 price); | ||
error ItemNotForSale(address nftAddress); | ||
error NotListed(address nftAddres); | ||
error AlreadyListed(address nftAddress); | ||
error NoProceeds(); | ||
error NotOwner(); | ||
error NotApprovedForMarketplace(); | ||
error PriceMustBeAboveZero(); | ||
error NotApproved(); | ||
|
||
|
||
|
||
contract NFTMarketplace is Context { | ||
|
||
// state variables | ||
uint256 public counter; | ||
mapping(address => Listing) private s_listings; | ||
mapping(address => uint256) private s_proceeds; // s_proceeds => amount of ether earned by the seller | ||
|
||
|
||
|
||
struct Listing { | ||
uint256 price; | ||
address seller; | ||
} | ||
|
||
// some events | ||
event LogItemListed( | ||
address indexed seller, | ||
address indexed nftAddress, | ||
uint256 price | ||
); | ||
|
||
event LogItemCanceled( | ||
address indexed seller, | ||
address indexed nftAddress | ||
); | ||
|
||
event LogItemBought( | ||
address indexed buyer, | ||
address indexed nftAddress, | ||
uint256 price, | ||
int256 fraction | ||
); | ||
|
||
// funtion modifiers | ||
modifier isListed(address nftAddress) { | ||
Listing memory listing = s_listings(nftAddress); | ||
require(listing.price > 0, "Not listed"); | ||
_; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters