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

Create UI to schedule Dutch auctions #967

Conversation

jessepinho
Copy link
Contributor

@jessepinho jessepinho commented Apr 19, 2024

Screen.Recording.2024-04-30.at.6.36.22.PM.mov
  • Create a form and state slice for creating Dutch auctions
  • Create a new <ActionDutchAuctionScheduleComponent /> to represent the action of scheduling a Dutch auction. It appears in both the transaction approval dialog and in the transaction view for a transaction containing a Dutch Auction Schedule action.
  • Create a new <Slider /> component that allows users to use a slider to choose a value from a numeric range.
  • Extract a <Swap /> component; it's now a router sibling of <DutchAuction />
  • Rename active to enabled in the Tab interface, so as to differentiate from when active means that a tab is selected.

Coming in future PRs

  • UI for ending auction(s)
  • UI for withdrawing from auctions
  • UI for viewing auctions

Closes #944
Closes #978

@jessepinho jessepinho force-pushed the jessepinho/auction-ui-web-944 branch from f7e5305 to 27014f8 Compare April 23, 2024 00:59
@jessepinho jessepinho changed the base branch from main to jessepinho/components-refactor-web-944 April 23, 2024 00:59
Base automatically changed from jessepinho/components-refactor-web-944 to main April 23, 2024 14:17
@jessepinho jessepinho force-pushed the jessepinho/auction-ui-web-944 branch 9 times, most recently from 41355d1 to 2e9012c Compare April 29, 2024 17:33
@jessepinho jessepinho force-pushed the jessepinho/auction-ui-web-944 branch from ab6c4d8 to 37508fb Compare April 30, 2024 23:11
@jessepinho jessepinho changed the base branch from main to jessepinho/auctions-wasm-planner-web-942 April 30, 2024 23:11
setMaxOutput: state.dutchAuction.setMaxOutput,
});

export const Price = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

* are even multiples of 10 minutes. So we'll set the step count to 120, so that
* the sub-auctions can divide evenly into the number of intervening blocks.
*/
export const STEP_COUNT = 120n;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewers, let me know what you think of this logic.

Per @hdevalence 's comment here, a step count of ~100 is a good target. Since we're starting at a duration of 10 minutes, which doesn't divide evenly into 100 blocks (since blocks are added roughly every 5 seconds), I hard-coded the step count at 120.

Henry also wrote:

Longer time should mean more sub-auctions and slower price declines.

Not sure I understand this — does the number of steps influence how the price declines? And if a longer time = more sub-auctions, what should our algorithm be for increasing step count as duration increases?

(In the meantime, though, I figured this is a mergeable first effort. Let me know if you think otherwise.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, but usually I'd go to the core repo and double check how it's done there. Doesn't look like we have an implementation on that side, so this is probably ok for now.

@jessepinho jessepinho changed the title WIP: auctions UI WIP: Create UI to schedule Dutch auctions May 1, 2024
@jessepinho jessepinho changed the title WIP: Create UI to schedule Dutch auctions Create UI to schedule Dutch auctions May 1, 2024
@jessepinho jessepinho marked this pull request as ready for review May 1, 2024 02:02
amount: state.dutchAuction.amount,
setAmount: state.dutchAuction.setAmount,
onSubmit: state.dutchAuction.onSubmit,
submitButtonDisabled: state.dutchAuction.txInProgress || !state.dutchAuction.amount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should block if min/max isn't chosen too right?

apps/minifront/src/state/dutch-auction/assemble-request.ts Outdated Show resolved Hide resolved
apps/minifront/src/state/dutch-auction/constants.ts Outdated Show resolved Hide resolved
* are even multiples of 10 minutes. So we'll set the step count to 120, so that
* the sub-auctions can divide evenly into the number of intervening blocks.
*/
export const STEP_COUNT = 120n;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, but usually I'd go to the core repo and double check how it's done there. Doesn't look like we have an implementation on that side, so this is probably ok for now.

@grod220
Copy link
Contributor

grod220 commented May 1, 2024

Also, is there a way we can get these changes in main and perhaps put it behind a flag or something? I worry that jessepinho/auctions-wasm-planner-web-942 will be increasingly hard to merge the longer it says separate.

@jessepinho
Copy link
Contributor Author

@grod220

Also, is there a way we can get these changes in main and perhaps put it behind a flag or something? I worry that jessepinho/auctions-wasm-planner-web-942 will be increasingly hard to merge the longer it says separate.

Yeah, I've hidden the tabs for now so that people don't actually use this until it's ready

@jessepinho jessepinho merged commit 872d918 into jessepinho/auctions-wasm-planner-web-942 May 1, 2024
6 checks passed
@jessepinho jessepinho deleted the jessepinho/auction-ui-web-944 branch May 1, 2024 21:12
jessepinho added a commit that referenced this pull request May 2, 2024
* Build out Dutch auction UI

* Add more docs to Slider

* Fix metadata

* Rename Prices -> Price

* Fix test name

* Create first tests for assembleRequest

* Add one more test

* Tweak Price layout

* Add auction to swap sublinks

* Remove tabs for now

* Convert to a Record to avoid having to assert presence

* Change min output

* Change to decimal

* Align to the right

* Handle exponent when processing amounts

* Add test coverage for constants
jessepinho added a commit that referenced this pull request May 2, 2024
* Account for Dutch auction schedules/ends in the WASM planner

* Remove useless conversion

* Use real nonce

* Create UI to schedule Dutch auctions (#967)

* Build out Dutch auction UI

* Add more docs to Slider

* Fix metadata

* Rename Prices -> Price

* Fix test name

* Create first tests for assembleRequest

* Add one more test

* Tweak Price layout

* Add auction to swap sublinks

* Remove tabs for now

* Convert to a Record to avoid having to assert presence

* Change min output

* Change to decimal

* Align to the right

* Handle exponent when processing amounts

* Add test coverage for constants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI for scheduling Dutch auctions
2 participants