Skip to content

split bonding curve purchase to optimize gas#1

Merged
Joeysantoro merged 1 commit intomasterfrom
Split-BC-Purchase-Save-Gas
Jan 7, 2021
Merged

split bonding curve purchase to optimize gas#1
Joeysantoro merged 1 commit intomasterfrom
Split-BC-Purchase-Save-Gas

Conversation

@Joeysantoro
Copy link
Contributor

Splits up the bonding curve purchase flow into "purchase" and "allocate". This saves the average purchaser from incurring the allocation gas costs and batches them.

Purchase gas before 300k

Purchase gas after 100k
Allocate gas after 230k

Allocation is incentivized over a time window that resets each period but it can be called any time.


function _incentivize() internal virtual {
if (isTimeEnded()) {
_initTimed();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resets the incentive time window. I can add a comment in code or rename the function to _resetTimed if that is helpful

bondingCurveOracle.init(bondingcurve.getAveragePrice(balance));

bondingcurve.purchase{value: balance}(genesisGroup, balance);
bondingcurve.allocate();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added so Genesis group launch also allocates the PCV

@Joeysantoro Joeysantoro merged commit 150e6ad into master Jan 7, 2021
@Joeysantoro Joeysantoro mentioned this pull request Feb 20, 2021
@xklob xklob deleted the Split-BC-Purchase-Save-Gas branch September 19, 2021 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments