mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35:18 +00:00
ae181604ff
* Add basic earn types and interfaces * Add VaultStrategy type * Update params with allowedVaults, deposit/withdraw msgs * Fill in Deposit method, add keeper methods * Add testutil, params, codec * Add withdraw * emit vault events * Implement vault viewer methods * Update doc comments, strategies * Add earn cli query/tx commands * Add successfull balance withdraw tests * Add ukava vault to dev genesis * Add vault keeper method doc comments * Update stablecoin strategy to only accept usdx * Vault state tests * VaultTotalSupplied tests * msg server test
43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
package keeper
|
|
|
|
import sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
// StableCoinStrategy defines the stablecoin strategy:
|
|
// 1. Supply USDX to Lend
|
|
type StableCoinStrategy Keeper
|
|
|
|
var _ Strategy = (*StableCoinStrategy)(nil)
|
|
|
|
func (s *StableCoinStrategy) GetName() string {
|
|
return "USDX"
|
|
}
|
|
|
|
func (s *StableCoinStrategy) GetDescription() string {
|
|
return "Supplies the USDX to Lend"
|
|
}
|
|
|
|
func (s *StableCoinStrategy) GetSupportedDenoms() []string {
|
|
return []string{"usdx"}
|
|
}
|
|
|
|
func (s *StableCoinStrategy) GetEstimatedTotalAssets(denom string) (sdk.Coin, error) {
|
|
// 1. Get amount of USDX in Lend
|
|
|
|
return sdk.Coin{}, nil
|
|
}
|
|
|
|
func (s *StableCoinStrategy) Deposit(amount sdk.Coin) error {
|
|
return nil
|
|
}
|
|
|
|
func (s *StableCoinStrategy) Withdraw(amount sdk.Coin) error {
|
|
return nil
|
|
}
|
|
|
|
// LiquidateAll liquidates all assets in the strategy, this should be called
|
|
// only in case of emergency or when all assets should be moved to a new
|
|
// strategy.
|
|
func (s *StableCoinStrategy) LiquidateAll() (amount sdk.Coin, err error) {
|
|
return sdk.Coin{}, nil
|
|
}
|