You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi 0xTranqui, I was working on extending your zora starter kit to support my Barter based zora offers market place. I found a bug in code when going through it.
When setOfferAmount is called by the user with a particular offer price we're sending the offer price as it is as msg.value to the OffersV1 contract.
Say I made an initial offer of 0.1 ETH for a NFT. Now say I want to increase my offer to 0.2 ETH. The current SetOfferAmount component will send the whole 0.2 ETH again. As a result I would have paid the OffersV1 contract 0.3 ETH but according to my offer stored in OffersV1 storage I have only paid 0.2 ETH. Only 0.2 ETH would be refunded in the case where I cancel the offer.
To fix this I have first read the offer from OffersV1 storage to get the previous amount and then computed the difference with current amount and only sent the difference to OffersV1.
In case current amount is less than prev amount we send 0 ETH. Letting OffersV1 take care of the refunds. In case of crypto currencies other ETH we send 0 ETH too.
I made the fix and created a pull request here: #3
The text was updated successfully, but these errors were encountered:
Hi 0xTranqui, I was working on extending your zora starter kit to support my Barter based zora offers market place. I found a bug in code when going through it.
When setOfferAmount is called by the user with a particular offer price we're sending the offer price as it is as msg.value to the OffersV1 contract.
`
const offerPrice = setOffer.amount ? ethers.utils.parseEther(setOffer.amount) : ""
`
Say I made an initial offer of 0.1 ETH for a NFT. Now say I want to increase my offer to 0.2 ETH. The current SetOfferAmount component will send the whole 0.2 ETH again. As a result I would have paid the OffersV1 contract 0.3 ETH but according to my offer stored in OffersV1 storage I have only paid 0.2 ETH. Only 0.2 ETH would be refunded in the case where I cancel the offer.
To fix this I have first read the offer from OffersV1 storage to get the previous amount and then computed the difference with current amount and only sent the difference to OffersV1.
In case current amount is less than prev amount we send 0 ETH. Letting OffersV1 take care of the refunds. In case of crypto currencies other ETH we send 0 ETH too.
I made the fix and created a pull request here: #3
The text was updated successfully, but these errors were encountered: