-
Notifications
You must be signed in to change notification settings - Fork 341
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
feat(iro): scale the bonding curve #1247
Merged
mtsitrin
merged 89 commits into
main
from
mtsitrin/1218-featiro-scale-the-bonding-curve
Sep 27, 2024
Merged
Changes from 88 commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
e48ae3f
genereated proto files
mtsitrin b6ecec8
fixed proto
mtsitrin ec02a4d
scaffold
mtsitrin c5ee033
store keys
mtsitrin 70f179e
initial store getters
mtsitrin ffbb44a
implemented create plan
mtsitrin 4f45328
implemented trade methods and linear bonding curve
mtsitrin 59c6fed
implemented the cur
mtsitrin 48eb399
wired keeper, and started testing
mtsitrin ac7ff90
implemented bonding curve and create plan
mtsitrin 030f450
first UT pass
mtsitrin abfb8c5
bond curve fix and UT
mtsitrin 0ba4c5c
trade test
mtsitrin b9ebf1c
added curve params to the plan
mtsitrin d9a1818
using curve from plan
mtsitrin a6bf24f
Merge branch 'main' into feature/IRO
mtsitrin bca38d8
refactor genesistransfer. added transferEnabled hook
mtsitrin 33c09d6
UT compiles
mtsitrin 8b69ae8
genesis transfer UT
mtsitrin 0d18586
genesis test
mtsitrin eb7fcf1
implemented queries
mtsitrin 1033813
module account for plan
mtsitrin 2e1d0c3
fixed module account
mtsitrin 3e74625
fixed validation test
mtsitrin 3178c9f
liquidity bootstrap wip
mtsitrin f55fada
fixed claim. added buying allocation limit
mtsitrin d1c22d6
creating pool
mtsitrin 63e25d1
UT wip
mtsitrin 63adb6d
IRO creation fee
mtsitrin 35b464e
linter
mtsitrin 7dd34d5
minor change in api
mtsitrin 06b7341
Merge branch 'main' into feature/IRO
mtsitrin 41f71c9
renamed rollapp.sealed to rollapp.started
mtsitrin 0226e08
added validations for genesis transfer
mtsitrin 49917d0
sealing after IRO creation
mtsitrin f3c4760
handling pre_launch_time
mtsitrin bc7d3ad
Merge branch 'main' into feature/IRO
mtsitrin bc6dd6d
fixes post main merge
mtsitrin 2224ca1
implemented incentives
mtsitrin 49b24eb
implemented taker fee
mtsitrin d5e9c32
added incentives plan to the create plan tx
mtsitrin e65c30a
linter
mtsitrin 749aa3b
skipping failed test for now
mtsitrin c432cc3
removed pool creation fee
mtsitrin f453481
fixed go.mod
mtsitrin faf74de
Merge branch 'main' into feature/IRO
mtsitrin 4e15d9e
pr comments
mtsitrin da7f1a1
renames. fixed incentives params
mtsitrin a0190e2
cleanup
mtsitrin e02399c
added min params for incentives plan
mtsitrin 5ff0f86
enforce minimum plan duration
mtsitrin bc6cee8
added params validation
mtsitrin 70a02cb
cli - create plan
mtsitrin d2c793b
added cli
mtsitrin 5aa8f6a
renames
mtsitrin e5423d1
simplified code and added more rollapp denom validation
mtsitrin 88bcf46
refactored seal apis
mtsitrin 16f1d74
refactord genesistransfer
mtsitrin 63850d5
fixed taker fee
mtsitrin d5321d8
fixed taker fee to be chraged from the user
mtsitrin 902dac5
adde curve validations. fixed liquidity edge cases
mtsitrin 155d095
Merge branch 'main' into feature/IRO
mtsitrin 8c9c7ce
dry out some code
mtsitrin 2b24e32
fixed sequencer creation bug. added UT
mtsitrin 4a548cb
split params for minimal incentives values
mtsitrin c1c9e70
transfer genesis validated only when IRO exists. transfers enabled by…
mtsitrin 61accb0
renames and cleanup
mtsitrin 3a09f0d
Merge branch 'main' into feature/IRO
mtsitrin 9a259a1
goimports
mtsitrin 73da686
pr comments
mtsitrin 5c0fc8d
Merge branch 'main' into feature/IRO
mtsitrin 3fb6b06
Merge branch 'main' into feature/IRO
mtsitrin 11789f3
fixed cli
mtsitrin b0cb7b0
This reverts commit 11789f395c7fee633b7bea9b869a1d8e9d6efb5d.
mtsitrin f6a96ee
added cli UT
mtsitrin 2113bf6
linter
mtsitrin 94a4add
actually fixed
mtsitrin d7cf001
WIP
mtsitrin 3795ebb
scaling of x and y
mtsitrin 88eb464
updated UT
mtsitrin 844a99c
Merge branch 'main' into mtsitrin/1218-featiro-scale-the-bonding-curve
mtsitrin 77f9997
renames for clarity
mtsitrin e8bd6da
limit for the total allocation. fixed UT
mtsitrin c186522
edge case UT. WIP
mtsitrin fbeb74c
refactored spotPrice
mtsitrin bbb0be6
documentation
mtsitrin 806204c
added tests
mtsitrin 7e8942b
godoc
mtsitrin e400039
fixed comment
mtsitrin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package keeper_test | ||
|
||
import ( | ||
"time" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/dymensionxyz/dymension/v3/testutil/sample" | ||
"github.com/dymensionxyz/dymension/v3/x/iro/types" | ||
) | ||
|
||
func (s *KeeperTestSuite) TestClaim() { | ||
rollappId := s.CreateDefaultRollapp() | ||
k := s.App.IROKeeper | ||
curve := types.DefaultBondingCurve() | ||
incentives := types.DefaultIncentivePlanParams() | ||
rollappDenom := "dasdasdasdasdsa" | ||
|
||
startTime := time.Now() | ||
amt := sdk.NewInt(1_000_000).MulRaw(1e18) | ||
|
||
rollapp, _ := s.App.RollappKeeper.GetRollapp(s.Ctx, rollappId) | ||
planId, err := k.CreatePlan(s.Ctx, amt, startTime, startTime.Add(time.Hour), rollapp, curve, incentives) | ||
s.Require().NoError(err) | ||
planDenom := k.MustGetPlan(s.Ctx, planId).TotalAllocation.Denom | ||
balance := s.App.BankKeeper.GetBalance(s.Ctx, k.AK.GetModuleAddress(types.ModuleName), planDenom) | ||
s.Require().Equal(amt, balance.Amount) | ||
|
||
claimer := sample.Acc() | ||
// buy some tokens | ||
s.Ctx = s.Ctx.WithBlockTime(startTime.Add(time.Minute)) | ||
soldAmt := sdk.NewInt(1_000).MulRaw(1e18) | ||
s.BuySomeTokens(planId, claimer, soldAmt) | ||
|
||
// claim should fail as not settled | ||
err = k.Claim(s.Ctx, planId, claimer) | ||
s.Require().Error(err) | ||
|
||
// settle | ||
s.FundModuleAcc(types.ModuleName, sdk.NewCoins(sdk.NewCoin(rollappDenom, amt))) | ||
err = k.Settle(s.Ctx, rollappId, rollappDenom) | ||
s.Require().NoError(err) | ||
|
||
// claim should fail as no balance available (random address) | ||
err = k.Claim(s.Ctx, planId, sample.Acc()) | ||
s.Require().Error(err) | ||
|
||
// fund. claim should succeed | ||
err = k.Claim(s.Ctx, planId, claimer) | ||
s.Require().NoError(err) | ||
|
||
// assert claimed amt | ||
balance = s.App.BankKeeper.GetBalance(s.Ctx, k.AK.GetModuleAddress(types.ModuleName), planDenom) | ||
s.Require().True(balance.IsZero()) | ||
balance = s.App.BankKeeper.GetBalance(s.Ctx, claimer, rollappDenom) | ||
s.Require().Equal(soldAmt, balance.Amount) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's unused. just cleanup