-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINFT_sale.sol
65 lines (52 loc) · 2.11 KB
/
INFT_sale.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
/**
* importing IERC721 as we use ERC721 in the main contract of bidding
*/
interface Ibidding {
/*
* Emmitted when the owner of the NFT is listed and changed.
*/
event nft_logs(address nft,uint tokenId,address owner,uint price);
/*
* Returns a unique keccak value by taking nft address and tokenid from the user for listing the NFT
*/
function getKeccak(address _nft , uint _tokenId) external pure returns(bytes32) ;
/*
* Require a unique tokenID instead of repeated
* Token is registered in the contract for further usage
* nft address cannot be a zero address
* NFT cannot a sold one
*/
function nft_list (address _nft, uint _price, uint _tokenId) external ;
/*
* Winner address cannot be zero address
* Total contribution of the nft should be greter than nft price
* Winner could claim the NFT after winning the game from the contract which can be done when the token 'owner' approves the contract.
* Emits a {nft_logs} event.
*/
function claim_reward(address winnerAddress, address _nft, uint _tokenId) external ;
/*
* NFT address cannot be a zero address
* NFT cannot a sold one
* Buyer cannot be zero address
* Amount sent by the buyer should be equal to the price of NFT
* Buying the NFT directly with the mentioned price which can be done when the token 'owner' approves the contract
* Emits a {nft_logs} event.
*/
function buy(address _nft, uint _tokenId) external payable ;
/*
* NFT address cannot be a zero address
* NFT cannot a sold one
* Bidder cannot be zero address
* Staring the game by sending 51% of the amount of the NFT
* Emits a {nft_logs} event.
*/
function start(address _nft, uint _tokenId) payable external;
/*
* Only admin should withdraw the funds
* Admin can withdraw the funds from the contract which is 2% in each bidding transaction
*/
function admin_withdraw() external ;
}