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

refactor: moving merkle lockup contracts to airdrops repo #5

Merged
merged 13 commits into from
Nov 21, 2024
Merged

Conversation

smol-ninja
Copy link
Member

@smol-ninja smol-ninja commented Nov 16, 2024

Changelog

  1. Closes Create a separate repo for Airdrops #4
  2. Closes Rename test dir to tests (plural) #3
  3. Closes Refactor asset terminology to tokens #2

Some notes

  1. Precompiles could not be used to deploy Lockup protocol due to linked libraries. The Lockup bytecode requires to replace libraries' placeholders with the actual addresses to which libraries are deployed through precompiles. However, replacing bytecode string is not possible without having access to vm inside Precompiles contract. The same can also not be achiveed by the bash script because the libraries can only be deployed when deployCore is called.

  2. Inspite of exposing utils in Lockup npm package, I decided to create a separate utils for airdrops. My rationale is that airdrops aims to be a separate protocol which partially depends on the Lockup contract. Hence, having its own utility contracts would allow us to add/update the code with minimum dependency over Lockup. Otherwise a change in here may require us to update it in Lockup first.

  3. The lockup dependency in this PR is unlock-amounts branch which should be changed to staging once the unlock-amount PR is merged.

  4. I have picked Schedule related changes from feat: add unlock amounts functionality lockup#1075.

  5. Given that v2.0.0 will be its first release as a separate repo, we can have main treated as staging for this repo (similar to how we did in Flow).

Tips on reviewing this PR

My recommendation would be to read the repo as if its a new code. This will help you catch any errors and redundant codes.

smol-ninja and others added 6 commits November 16, 2024 00:25
Co-authored-by: Andrei Vlad Birgaoanu <99738872+andreivladbrg@users.noreply.github.com>
test: add unlockAmounts assertions in claim
test: make START_AMOUNT non-zero in defaults
@smol-ninja
Copy link
Member Author

I think we should have invariants and fuzz tests for Airdrops repo in the future.

@PaulRBerg
Copy link
Member

  1. I don't understand what the issue is here? Did you want to write a script that deploys both Lockup and Airdrops?
  2. Makes sense
  3. OK
  4. OK
  5. Yes

@smol-ninja
Copy link
Member Author

  1. No issue. Instead of deploying Lockup using new SablierLockup, I was trying to use Lockup's precompiles in Base test to deploy lockups. The issue was that since precompiles rely on bytecode, the preset bytecode is no longer correct. A correct way to generate bytecode would be the following:
  • Generate libraries' bytecode.
  • Generate lockup's bytecode. This bytecode would have placeholders to be replaced by libraries' address.
  • Deploy libraries.
  • Replace placeholders with libraries's addresses
  • Use the updated bytecode to deploy Lockup contract

@PaulRBerg
Copy link
Member

I see.

The overhead for using the precompiles flow you described instead of new SablierLockup doesn't seem worth it to me.

Copy link
Member

@PaulRBerg PaulRBerg left a comment

Choose a reason for hiding this comment

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

Good work @smol-ninja. Feedback below.

I've pushed two commits:

  1. One to address the feedback below and other non-contentious changes.
  2. Another to rename "Sablier Fee" to just "Fee", and "Sablier Fee By User" to "Custom Fee"

LMK what you think

Copy link
Member

@andreivladbrg andreivladbrg left a comment

Choose a reason for hiding this comment

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

I saw @PaulRBerg left some comments.

Leaving these as well for now, but I have not reviewed the tests

chore: remove SVG references
chore: update ignore and config files
docs: extend BUSL license
docs: improve writing
docs: roll v1.3.0
refactor: alphabetical ordering
test: remove unused constants
refactor: rename "Sablier Fee By User" to "Custom Fee"
@smol-ninja
Copy link
Member Author

smol-ninja commented Nov 20, 2024

Thanks for the reviews. Everything looks good to me. LMK if its good to merge or if there are any more changes.

smol-ninja and others added 2 commits November 21, 2024 10:20
Co-authored-by: Paul Razvan Berg <prberg@proton.me>
@PaulRBerg
Copy link
Member

Great job.

@PaulRBerg PaulRBerg merged commit 3c4272b into main Nov 21, 2024
7 checks passed
@smol-ninja smol-ninja deleted the staging branch November 21, 2024 11:50
@smol-ninja smol-ninja mentioned this pull request Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants