-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial approach * shortened * validation * callback tests * adding validation * params test * claim tests * minor fixes * gofumpt * lint * removing unused interface * resolving comments * resolving comments * resolving comments * additional test cases * prooftypeposition and denom validation * validation * validation * gofumpt * resolving comments * lint * validation tests * separate directory for claims logic * updating comment * lint * lint * lint * lint * fixing imports * fixing imports * lint * fix conflict with externalised multierror mod --------- Co-authored-by: Alex Johnson <[email protected]> Co-authored-by: Ajaz Ahmed Ansari <[email protected]> Co-authored-by: Joe Bowman <[email protected]>
- Loading branch information
1 parent
2a6fb85
commit 9baf8c3
Showing
117 changed files
with
12,921 additions
and
349 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package types | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
const ( | ||
// ModuleName defines the module name. | ||
ModuleName = "liquidity" | ||
|
||
// StoreKey defines the primary module store key. | ||
StoreKey = ModuleName | ||
) | ||
|
||
var PoolKeyPrefix = []byte{0xab} | ||
|
||
// GetPoolKey returns the store key to retrieve pool object from the pool id. | ||
func GetPoolKey(poolID uint64) []byte { | ||
return append(PoolKeyPrefix, sdk.Uint64ToBigEndian(poolID)...) | ||
} |
3,722 changes: 3,722 additions & 0 deletions
3,722
third-party-chains/crescent-types/liquidity/types/liquidity.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
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,32 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
func (pool Pool) GetReserveAddress() sdk.AccAddress { | ||
addr, err := sdk.AccAddressFromBech32(pool.ReserveAddress) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return addr | ||
} | ||
|
||
// Validate validates Pool for genesis. | ||
func (pool Pool) Validate() error { | ||
if pool.Id == 0 { | ||
return fmt.Errorf("pool id must not be 0") | ||
} | ||
if pool.PairId == 0 { | ||
return fmt.Errorf("pair id must not be 0") | ||
} | ||
if _, err := sdk.AccAddressFromBech32(pool.ReserveAddress); err != nil { | ||
return fmt.Errorf("invalid reserve address %s: %w", pool.ReserveAddress, err) | ||
} | ||
if err := sdk.ValidateDenom(pool.PoolCoinDenom); err != nil { | ||
return fmt.Errorf("invalid pool coin denom: %w", err) | ||
} | ||
return nil | ||
} |
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,20 @@ | ||
package types | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/address" | ||
) | ||
|
||
const ( | ||
// ModuleName defines the module name. | ||
ModuleName = "lpfarm" | ||
|
||
// StoreKey defines the primary module store key. | ||
StoreKey = ModuleName | ||
) | ||
|
||
var PositionKeyPrefix = []byte{0xd5} | ||
|
||
func GetPositionKey(farmerAddr sdk.AccAddress, denom string) []byte { | ||
return append(append(PositionKeyPrefix, address.MustLengthPrefix(farmerAddr)...), denom...) | ||
} |
Oops, something went wrong.