FuelLabs / sway-applications

Swaypplications
https://sway-applications.vercel.app/
Apache License 2.0
1.58k stars 547 forks source link

Dutch auction program #69

Open Braqzen opened 2 years ago

Braqzen commented 2 years ago

A Dutch auction is a type of auction where securities are priced via bids rather than the seller setting the price. In this scenario, the seller sets a maximum price, which is lowered over time until all of the securities have been bid on.

Citation

simonr0204 commented 2 years ago

A nice mechanism to integrate into Dutch auctions is to first release the "lot" to the bidder, and hand over execution to a provided call. Then you only ask for payment at the end of the execution. It basically amounts to flashloaning the full amount to the bidder, which means anybody can participate in discovering the fair market price, even if they are capital constrained. c.f. Makerdao Liq 2.0 auctions : https://docs.makerdao.com/smart-contract-modules/dog-and-clipper-detailed-documentation#flash-lending-of-collateral

SwayStar123 commented 2 years ago

A nice mechanism to integrate into Dutch auctions is to first release the "lot" to the bidder, and hand over execution to a provided call. Then you only ask for payment at the end of the execution. It basically amounts to flashloaning the full amount to the bidder, which means anybody can participate in discovering the fair market price, even if they are capital constrained. c.f. Makerdao Liq 2.0 auctions : https://docs.makerdao.com/smart-contract-modules/dog-and-clipper-detailed-documentation#flash-lending-of-collateral

How would I delay asking for payment? Right now im just using msg_amount() to verify payment

simonr0204 commented 2 years ago

I'm not sure how it would work in Fuel. In ethereum you can just check the contract balance after execution of the external call and check it has been credited with enough to pay, but there's no equivalent for that in Fuel.

Anyway, we can add this feature later if there's a way to do it.

simonr0204 commented 1 year ago

The mechanism described above should be possible soon when arbitrary calls become possible (see #22 )