Itheum / data-dex

DApp with suite of web3 tools to trade personal data on MultiversX
https://datadex.itheum.io
GNU General Public License v3.0
463 stars 6 forks source link

Delist needs update #463

Closed bucurdavid closed 1 year ago

bucurdavid commented 1 year ago

https://devnet-explorer.multiversx.com/transactions/ef320cd1d52f3182c8e6552ae4326172970e87fb44cea7b4361d31c174b0972f

New argument in cancel_offer ->send_funds_back.

#[endpoint(cancelOffer)]
fn cancel_offer(&self, offer_id: u64, quantity: BigUint, send_funds_back: bool);

If send funds back is true => normal flow If send funds back is false => -- if the offer_id already in the withdrawn offers => decrease quantity (and delete listed offer if new quantity is 0) and increase withdrawn offer quantity -- if the offer_id is not already in the withdrawn offers => put it there with only a part of the quantity.

A new tab needed to be added for cancelled offers with a withdraw button: The view:

#[view(viewCancelledOffers)]
fn view_cancelled_offers(&self, address: &ManagedAddress) -> ManagedVec<OfferOut<Self::Api>>;

The withdraw call:

Warning Can be called only by the offer owner

#[endpoint(withdrawCancelledOffer)]
fn withdraw_from_cancelled_offer(&self, offer_id: u64);
damienen commented 1 year ago

As this is an extreme edge case, we will for now solve this by always sending the send_funds_back_to_user value as TRUE

damienen commented 1 year ago

Solved. Closing.