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

Augmented Bond Curves #697

Open
wants to merge 56 commits into
base: development
Choose a base branch
from
Open

Augmented Bond Curves #697

wants to merge 56 commits into from

Conversation

JakeHartnell
Copy link
Member

@JakeHartnell JakeHartnell commented Apr 21, 2023

ABCs are cool! This will try and implement much of what is in this excellent blog post.

To do:

  • Add max supply option
  • Update curve
  • Update max supply
  • Close bonding curve (only sell)
  • MinMax contribution amounts for hatching
  • Fix token metadata so that it's set correctly
  • Test allowlist
  • Test close curve
  • Test update curve
  • Test update max supply
  • Factory contract for creating cw-abc DAOs
  • Curve type validation
  • Move related contracts to experimental folder

Bonus:

  • Move curves into a new cw-curves package
  • Add more curves (Taylor Series. S-Curve, Piecewise Linear)
  • Extend allowlist options (i.e. keep existing list, but add a query to check if an address is a member of a DAO)

@bmorphism
Copy link
Contributor

doing G-d's work, Ser! 👏

@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2023

Codecov Report

Patch coverage: 56.01% and project coverage change: -2.34 ⚠️

Comparison is base (0367c84) 93.97% compared to head (1ac6a88) 91.64%.

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #697      +/-   ##
===============================================
- Coverage        93.97%   91.64%   -2.34%     
===============================================
  Files               62       68       +6     
  Lines             5596     5962     +366     
===============================================
+ Hits              5259     5464     +205     
- Misses             337      498     +161     
Impacted Files Coverage Δ
contracts/external/cw-abc/src/queries.rs 31.42% <31.42%> (ø)
contracts/external/cw-abc/src/commands.rs 38.75% <38.75%> (ø)
contracts/external/cw-abc/src/abc.rs 47.14% <47.14%> (ø)
contracts/external/cw-abc/src/contract.rs 65.00% <65.00%> (ø)
contracts/external/cw-abc/src/curves.rs 100.00% <100.00%> (ø)
contracts/external/cw-abc/src/state.rs 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Attention: 519 lines in your changes are missing coverage. Please review.

Comparison is base (95e4f73) 96.25% compared to head (d10fff4) 94.85%.
Report is 1 commits behind head on development.

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #697      +/-   ##
===============================================
- Coverage        96.25%   94.85%   -1.40%     
===============================================
  Files              203      212       +9     
  Lines            50082    51289    +1207     
===============================================
+ Hits             48207    48651     +444     
- Misses            1875     2638     +763     
Files Coverage Δ
contracts/external/cw-abc/src/error.rs 100.00% <100.00%> (ø)
contracts/external/cw-abc/src/testing.rs 100.00% <100.00%> (ø)
contracts/external/cw-abc/src/curves.rs 99.53% <99.53%> (ø)
contracts/external/cw-abc/src/state.rs 90.90% <90.90%> (ø)
contracts/external/cw-abc/src/msg.rs 0.00% <0.00%> (ø)
contracts/external/cw-abc/src/abc.rs 31.77% <31.77%> (ø)
contracts/external/cw-abc/src/queries.rs 0.00% <0.00%> (ø)
contracts/external/cw-abc/src/contract.rs 23.46% <23.46%> (ø)
contracts/external/cw-abc/src/commands.rs 28.72% <28.72%> (ø)

... and 78 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JakeHartnell JakeHartnell changed the title WIP: Augmented Bond Curves Augmented Bond Curves Nov 9, 2023
Copy link

codecov bot commented Nov 12, 2023

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

Copy link

codecov bot commented Nov 20, 2023

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@JakeHartnell
Copy link
Member Author

For the cw-curves package it may be worth looking and the Wynd DAO implementation: https://github.com/wynddao/wynddao/blob/main/packages/utils/src/curve.rs

Probably some useful stuff in there. Would be nice to have a solid curves package.

JakeHartnell and others added 13 commits March 26, 2024 14:27
* CwAbcResult

* Hatch phase configuration and init msg refactor

* Initial instantiate test

* Implement separate phrases and phrase configs

* Remove vesting phase and update funding pool

* Separate commands and queries

* Update init msg with string configs

* Phase config query

* MinMax and config query

* Add some todos

* cw-ownable integration
* Separate hatcher allowlist

* Donation feature

* Initial sell exit tax

* Hatchers to amount

* Hatch phase exit tax

* TokenMsg methods

* Format

* Hatchers query

* Fix bug where float was not taken into account in supply

* Buy and sell refactoring

* Update hatch phase config

* Update phase config enum

* Add adairrr to authors

* Initial boot integration with custom msgs

* Initial testing infrastructure

* Abstract-OS to AbstractSDK
* update cw-orch dependency

* add getrandom dependency to .toml

---------

Co-authored-by: Jake Hartnell <Jake.Hartnell@gmail.com>
/// Update the hatch phase configuration
Hatch {
contribution_limits: Option<MinMax>,
// TODO what is the minimum used for?
Copy link
Contributor

@ismellike ismellike Apr 7, 2024

Choose a reason for hiding this comment

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

I think paired with an expiration, the minimum could be used to determine if the ABC Hatch phase was successful.

If expired and the minimum was not met, then the ABC goes into the Closed phase. If expired with the minimum met, then the ABC goes into the Open phase.

* Make hatcher_allowlist a map

Also cleans up state when going from Hatch -> Open
Various spell-checking fixes

* Allow existing tokens to be used with ABC's

I think it's important for an existing token to be supported by an ABC.
Token DAO's will be able to set up liquidity more easily by simply allowing mint & burn functionality after instantiating the ABC while holding ownership of it.

*Also adds a query for hatcher allowlist
*fixes spell checks I ran into
*moves TokenInfo from dao-voting-token-staked to dao-interface for use in cw-abc

* Complete funding pool logic

Renamed fees_recipient to funding_pool_forwarding for better naming
Made funding_pool_forwarding optional
Allow updating the funding_pool_forwarding by owner
Allow withdrawing from the funding pool by owner

* Implement a circuit breaker

Adds IS_PAUSED state that is checked in execute entry
Also fixes naming in commands

* Add query for initial supply at ABC creation

* Allow donation into the reserve pool

Also fixes donation state being lost after multiple donations

* Move cw-abc curves to its own package cw-curves

* Improve validation for max_supply

* Support DAO membership in hatcher allowlist

Could use a test here
Also fixes some warnings and flag for cw-std

* Clippy fix

* Only clone decimals from curve_state

also reorg buy command to be closer to sell command for readability

* QoL improvements

Derive copy on DecimalPlaces
Catch OverflowError directly in ContractError
Do not set initial supply as supply - will further remove allowing initial supplies

* Revert support for initial supply

* Fix clippy unnecessary clones

* Donate only into the funding pool

* Add a test for donate and withdraw from funding pool

* Add test for dao hatchers + update schemas

Also removes unused deps from cw-abc which now live in cw-curves

* Update Cargo.toml

* Buy & Sell Quotes

Let users know the curve state and returned amount after x payment

* Complete DAO hatchers w/ priority queue

Disallow selling in the hatch phase
Do not validate max_contribution against max_raise

* Fix priority queue ordering on ties

also clippy fixes

* Couple more clippy fixes
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.

6 participants