mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-04 11:17:28 +00:00 
			
		
		
		
	- Upgrade cosmos-sdk to v0.44.5 from v0.39.2 - Add Legacy Tx Endpoint for backwards compatibility - Add IBC v1.2.3 Support Co-authored-by: DracoLi <draco@dracoli.com> Co-authored-by: drklee3 <derrick@dlee.dev> Co-authored-by: denalimarsh <denalimarsh@gmail.com> Co-authored-by: Draco Li <draco@kava.io> Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com> Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> Co-authored-by: Denali Marsh <denali@kava.io>
		
			
				
	
	
		
			75 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package rest
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/gorilla/mux"
 | 
						|
 | 
						|
	"github.com/cosmos/cosmos-sdk/client"
 | 
						|
	sdk "github.com/cosmos/cosmos-sdk/types"
 | 
						|
	"github.com/cosmos/cosmos-sdk/types/rest"
 | 
						|
)
 | 
						|
 | 
						|
// REST Variable names
 | 
						|
// nolint
 | 
						|
const (
 | 
						|
	RestOwner          = "owner"
 | 
						|
	RestCollateralType = "collateral-type"
 | 
						|
	RestID             = "id"
 | 
						|
	RestRatio          = "ratio"
 | 
						|
)
 | 
						|
 | 
						|
// RegisterRoutes - Central function to define routes that get registered by the main application
 | 
						|
func RegisterRoutes(cliCtx client.Context, r *mux.Router) {
 | 
						|
	registerQueryRoutes(cliCtx, r)
 | 
						|
	registerTxRoutes(cliCtx, r)
 | 
						|
}
 | 
						|
 | 
						|
// PostCdpReq defines the properties of cdp request's body.
 | 
						|
type PostCdpReq struct {
 | 
						|
	BaseReq        rest.BaseReq   `json:"base_req" yaml:"base_req"`
 | 
						|
	Sender         sdk.AccAddress `json:"sender" yaml:"sender"`
 | 
						|
	Collateral     sdk.Coin       `json:"collateral" yaml:"collateral"`
 | 
						|
	CollateralType string         `json:"collateral_type" yaml:"collateral_type"`
 | 
						|
	Principal      sdk.Coin       `json:"principal" yaml:"principal"`
 | 
						|
}
 | 
						|
 | 
						|
// PostDepositReq defines the properties of cdp request's body.
 | 
						|
type PostDepositReq struct {
 | 
						|
	BaseReq        rest.BaseReq   `json:"base_req" yaml:"base_req"`
 | 
						|
	Owner          sdk.AccAddress `json:"owner" yaml:"owner"`
 | 
						|
	Depositor      sdk.AccAddress `json:"depositor" yaml:"depositor"`
 | 
						|
	Collateral     sdk.Coin       `json:"collateral" yaml:"collateral"`
 | 
						|
	CollateralType string         `json:"collateral_type" yaml:"collateral_type"`
 | 
						|
}
 | 
						|
 | 
						|
// PostWithdrawalReq defines the properties of cdp request's body.
 | 
						|
type PostWithdrawalReq struct {
 | 
						|
	BaseReq        rest.BaseReq   `json:"base_req" yaml:"base_req"`
 | 
						|
	Owner          sdk.AccAddress `json:"owner" yaml:"owner"`
 | 
						|
	Depositor      sdk.AccAddress `json:"depositor" yaml:"depositor"`
 | 
						|
	Collateral     sdk.Coin       `json:"collateral" yaml:"collateral"`
 | 
						|
	CollateralType string         `json:"collateral_type" yaml:"collateral_type"`
 | 
						|
}
 | 
						|
 | 
						|
// PostDrawReq defines the properties of cdp request's body.
 | 
						|
type PostDrawReq struct {
 | 
						|
	BaseReq        rest.BaseReq   `json:"base_req" yaml:"base_req"`
 | 
						|
	Owner          sdk.AccAddress `json:"owner" yaml:"owner"`
 | 
						|
	CollateralType string         `json:"collateral_type" yaml:"collateral_type"`
 | 
						|
	Principal      sdk.Coin       `json:"principal" yaml:"principal"`
 | 
						|
}
 | 
						|
 | 
						|
// PostRepayReq defines the properties of cdp request's body.
 | 
						|
type PostRepayReq struct {
 | 
						|
	BaseReq        rest.BaseReq   `json:"base_req" yaml:"base_req"`
 | 
						|
	Owner          sdk.AccAddress `json:"owner" yaml:"owner"`
 | 
						|
	CollateralType string         `json:"collateral_type" yaml:"collateral_type"`
 | 
						|
	Payment        sdk.Coin       `json:"payment" yaml:"payment"`
 | 
						|
}
 | 
						|
 | 
						|
// PostLiquidateReq defines the properties of cdp liquidation request's body.
 | 
						|
type PostLiquidateReq struct {
 | 
						|
	BaseReq        rest.BaseReq   `json:"base_req" yaml:"base_req"`
 | 
						|
	Owner          sdk.AccAddress `json:"owner" yaml:"owner"`
 | 
						|
	CollateralType string         `json:"collateral_type" yaml:"collateral_type"`
 | 
						|
}
 |