Skip to content

Commit

Permalink
Issue iiitl#3 stop direct payment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansh-Agrawal1817 committed Mar 15, 2024
1 parent 6326e58 commit 693c487
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions contracts/Contract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,16 @@ contract Contract {
receive() external payable {}


function bought(uint256 _nftID,uint256 _tokenID) public onlyBuyer(_nftID) {
require(msg.value == purchasePrice[_nftID]);
(bool success, ) = (seller).call{value: address(this).balance}("");
isListed[_nftID] = false;
IERC721(nftaddress).transferFrom(address(this), buyer[_nftID], _tokenID);
function bought(uint256 _nftID,uint256 _tokenID) public payable onlyBuyer(_nftID) { //make the function payable to accept ether
require(msg.value == purchasePrice[_nftID]);

// Transfer the funds to the contract
address payable contractAddress = payable(address(this));
contractAddress.transfer(msg.value);

(bool success, ) = (seller).call{value: address(this).balance}("");
isListed[_nftID] = false;
IERC721(nftaddress).transferFrom(address(this), buyer[_nftID], _tokenID); //transfer the nft to the buyer
}


Expand Down

0 comments on commit 693c487

Please sign in to comment.