Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NFTMarketplace.sol #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions contracts/NFTMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ contract NFTMarketplace {
uint offerId;
uint id;
address user;
uint price;
bool fulfilled;
bool cancelled;
uint price;
}

struct Seller {
Expand All @@ -29,9 +29,9 @@ contract NFTMarketplace {
uint offerId,
uint id,
address user,
uint price,
bool fulfilled,
bool cancelled
bool cancelled,
uint price
);

event OfferFilled(uint offerId, uint id, address newOwner);
Expand All @@ -47,8 +47,8 @@ contract NFTMarketplace {
require(nftCollection.ownerOf(_id) == msg.sender, "you do not own the nft you are trying to offer");
nftCollection.transferFrom(msg.sender, address(this), _id);
offerCount ++;
offers[offerCount] = _Offer(offerCount, _id, msg.sender, _price, false, false);
emit Offer(offerCount, _id, msg.sender, _price, false, false);
offers[offerCount] = _Offer(offerCount, _id, msg.sender, false, false, _price);
emit Offer(offerCount, _id, msg.sender, false, false, _price);

return (msg.sender);
}
Expand Down Expand Up @@ -94,9 +94,13 @@ contract NFTMarketplace {
address[] memory userAddress = new address[](count);
uint[] memory balances = new uint[](count);

for(uint i = 0; i < count; i++){
for(uint i; i < count;){
userAddress[i] = sellers[i].userAddress;
balances[i] = sellers[i].balance;

unchecked {
++i;
}
}
return (userAddress, balances);
}
Expand Down