Gno.land
| 1 | package launchpad |
| 2 | |
| 3 | import ( |
| 4 | ufmt "gno.land/p/nt/ufmt/v0" |
| 5 | ) |
| 6 | |
| 7 | // assertIsDepositOwner asserts that the caller is the owner of the deposit. |
| 8 | // Panics if the caller is not the owner of the deposit. |
| 9 | func (lp *launchpadV1) assertIsDepositOwner(depositID string, caller address) { |
| 10 | deposit, err := lp.getDeposit(depositID) |
| 11 | if err != nil { |
| 12 | panic(err.Error()) |
| 13 | } |
| 14 | |
| 15 | if !deposit.IsDepositor(caller) { |
| 16 | panic(makeErrorWithDetails(errInvalidOwner, ufmt.Sprintf("(%s)", caller.String())).Error()) |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // assertIsValidAmount panics if the amount is zero. |
| 21 | func assertIsValidAmount(amount int64) { |
| 22 | if amount < minimumDepositAmount { |
| 23 | panic(makeErrorWithDetails( |
| 24 | errInvalidAmount, |
| 25 | ufmt.Sprintf("amount(%d) should greater than minimum deposit amount(%d)", amount, minimumDepositAmount), |
| 26 | )) |
| 27 | } |
| 28 | |
| 29 | if (amount % minimumDepositAmount) != 0 { |
| 30 | panic(makeErrorWithDetails( |
| 31 | errInvalidAmount, |
| 32 | ufmt.Sprintf("amount(%d) must be a multiple of 1_000_000", amount), |
| 33 | )) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // assertHasProject asserts that the caller is the owner of at least one project. |
| 38 | // Panics if the caller is not the owner of any project. |
| 39 | func (lp *launchpadV1) assertHasProject(caller address) { |
| 40 | if !lp.store.GetProjectRecipients().Has(caller.String()) { |
| 41 | panic(makeErrorWithDetails( |
| 42 | errInvalidOwner, |
| 43 | ufmt.Sprintf("caller %s is not the owner of any project", caller.String()), |
| 44 | )) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | func assertNotImplementYet() { |
| 49 | panic("NotImplementYet") |
| 50 | } |
| Function | Parameters |
|---|---|
| NewLaunchpadV1 | (launchpadStore interface {GetDepositCounter func() *gno.land/r/gnoswap/launchpad.Counter; GetDeposits func() *gno.land/p/nt/bptree/v0.BPTree; GetProjectRecipients func() *gno.land/p/nt/bptree/v0.BPTree; GetProjectTierRewardManagers func() *gno.land/p/nt/bptree/v0.BPTree; GetProjects func() *gno.land/p/nt/bptree/v0.BPTree; GetTotalGNSStakedAmount func() int64; HasDepositCounterStoreKey func() bool; HasDepositsKey func() bool; HasProjectRecipientsKey func() bool; HasProjectTierRewardManagersKey func() bool; HasProjectsKey func() bool; HasTotalGNSStakedAmountKey func() bool; NextDepositID func() string; SetDepositCounter func(int, .uverse.realm, *gno.land/r/gnoswap/launchpad.Counter) .uverse.error; SetDeposits func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetProjectRecipients func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetProjectTierRewardManagers func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetProjects func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetTotalGNSStakedAmount func(int, .uverse.realm, int64) .uverse.error}) |
N/A
| Function | Caller | Age |
|---|
None