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

Some additional validation and UI fixes for Sablier Proposal builder #2352

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

mudrila
Copy link
Contributor

@mudrila mudrila commented Sep 16, 2024

  • Fixes decimal places for stream tranche duration on Sablier proposal builder.
  • Disable "Submit" button if there're any invalid streams
  • Minor UI fixes for Sablier proposal builder

Testing these changes:

  1. Navigate to "Sablier Proposal Builder", example: http://localhost:8888/proposals/new/sablier/metadata?dao=sep:0x7d0E8e93B5785CB4d5c76f65BB798B3d0a3e89Cb (replace with your DAO address
  2. Fill out title and description, proceed to next step
  3. Create 1 stream. Fill out token address and amount, input tranches.
  4. Try to put 0 as duration for first tranche - make sure "Create proposal" button disabled
  5. Now, put all the valid information, create proposal and make it pass. Verify on Sablier that stream was created with proper tranches durations and amounts

@mudrila mudrila added bug Something isn't working enhancement New feature or request labels Sep 16, 2024
@mudrila mudrila self-assigned this Sep 16, 2024
Copy link

netlify bot commented Sep 16, 2024

Deploy Preview for decent-interface-dev ready!

Name Link
🔨 Latest commit 247b9c3
🔍 Latest deploy log https://app.netlify.com/sites/decent-interface-dev/deploys/66eaf505cc333600093c0591
😎 Deploy Preview https://deploy-preview-2352.app.dev.decentdao.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@adamgall
Copy link
Member

@mudrila can you please describe how these changes address & fix the issues that Shutter is experiencing? How did you test these changes?

@@ -565,7 +570,9 @@ function StreamBuilder({
isRequired
value={tranche.duration.bigintValue}
placeholder={(SECONDS_IN_DAY * 365).toString()}
decimalPlaces={1}
decimalPlaces={0}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@decentdao/engineering This was causing problems with durations being multiplied by 10
Removing this results in creating stream with proper durations

if (!stream.recipientAddress || !stream.tokenAddress || !stream.totalAmount) {
return true;
}
const invalidTranches = stream.tranches.filter((tranche, index) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@decentdao/engineering Potentially - there's so much stuff to cover, but I'm not sure whether it's worth that given this feature is custom implementation specifically for Shutter. Potential things to validate against:

  • Checking for treasury balance and disabling the button(or showing warning?) if treasury balance is less than sum of tokens in multiple streams
  • Checking tranches amounts
  • Showing total duration of the stream
    On the other hand - well, once I thought that it's not reasonable - and here we are, with this PR 🤣
    Any thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

This validation looks like the appropriate level of validation to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

(nitpick) could these filters be .some?

@mudrila
Copy link
Contributor Author

mudrila commented Sep 18, 2024

@mudrila can you please describe how these changes address & fix the issues that Shutter is experiencing? How did you test these changes?

@adamgall I've added some comments for the code and testing steps - please review :)

Copy link
Member

@adamgall adamgall left a comment

Choose a reason for hiding this comment

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

Approving this, assuming the code has been manually tested (by you @mudrila), using the inputs that Shutter shared with you that they'll be using on Mainnet.

Copy link
Contributor

@Da-Colon Da-Colon left a comment

Choose a reason for hiding this comment

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

Nicpick but otherwise code looks good to me.

if (!stream.recipientAddress || !stream.tokenAddress || !stream.totalAmount) {
return true;
}
const invalidTranches = stream.tranches.filter((tranche, index) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

(nitpick) could these filters be .some?

Copy link
Contributor

@DarksightKellar DarksightKellar left a comment

Choose a reason for hiding this comment

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

LGTM

@adamgall adamgall merged commit 1938936 into develop Sep 20, 2024
7 checks passed
@adamgall adamgall deleted the fix/sablier-proposal-builder branch September 20, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants