mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 16:55:21 +00:00
ceaed3f0e1
* proto types * proto generated types * liquidstaking top level files: module, genesis * liquidstaking types * liquidstaking keeper * liquidstaking client/cli * add liquidstaking to app, simapp * implement mint derivative * set up liquidstaking keeper test suite * test mint derivative * rename module to liquid * rename proto types, app.go to liquid * use sdk.Coin instead of shares * mint liquid tokens to delegator * burn derivative tokens to receive delegation * use conversion method instead of type cast * simplify delegation transfer logic * broaden delegation transfer tests * simplify transfer delegation method This removes a source of rounding errors * move derivative denom to keeper config * check for invalid coins in msg validation * block 0share transfers to avoid handling edge case * refactor MintDerivative to test calculations * simplify burn method so shares and tokens equal * convert TransferShares back to old design this makes handling vesting tokens easier * fix missed merge conflict * remove deprecated constants * tidy up msg.go * add msg tests * remove unused store key * fix msg event sender * remove unused params * tidy up documentation and errors * remove unused mocks * remove unused keepers from AppModule * tidy up msg return values keeper return values to be used in router msgs * reinstate unintentionally removed interface check * catch invalid input for MnitDerivative clear up test TODOs * clear up InitGenesis TODO * Update x/liquid/client/cli/tx.go Co-authored-by: Derrick Lee <derrick@dlee.dev> * Update x/liquid/client/cli/tx.go Co-authored-by: Derrick Lee <derrick@dlee.dev> * show error logs in devnet * unblock mod account so it can receive dist rewards * catch zero amout msgs early * minor cli fixes Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com> Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com> Co-authored-by: Derrick Lee <derrick@dlee.dev>
54 lines
2.1 KiB
Protocol Buffer
54 lines
2.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
package kava.liquid.v1beta1;
|
|
|
|
import "gogoproto/gogo.proto";
|
|
import "cosmos/base/v1beta1/coin.proto";
|
|
import "cosmos_proto/cosmos.proto";
|
|
|
|
option go_package = "github.com/kava-labs/kava/x/liquid/types";
|
|
|
|
// Msg defines the liquid Msg service.
|
|
service Msg {
|
|
|
|
// MintDerivative defines a method for converting a delegation into staking deriviatives.
|
|
rpc MintDerivative(MsgMintDerivative) returns (MsgMintDerivativeResponse);
|
|
|
|
// BurnDerivative defines a method for converting staking deriviatives into a delegation.
|
|
rpc BurnDerivative(MsgBurnDerivative) returns (MsgBurnDerivativeResponse);
|
|
}
|
|
|
|
// MsgMintDerivative defines the Msg/MintDerivative request type.
|
|
message MsgMintDerivative {
|
|
// sender is the owner of the delegation to be converted
|
|
string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
|
// validator is the validator of the delegation to be converted
|
|
string validator = 2;
|
|
// amount is the quantity of staked assets to be converted
|
|
cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
|
|
}
|
|
|
|
// MsgMintDerivativeResponse defines the Msg/MintDerivative response type.
|
|
message MsgMintDerivativeResponse {
|
|
// received is the amount of staking derivative minted and sent to the sender
|
|
cosmos.base.v1beta1.Coin received = 1 [(gogoproto.nullable) = false];
|
|
}
|
|
|
|
// MsgBurnDerivative defines the Msg/BurnDerivative request type.
|
|
message MsgBurnDerivative {
|
|
// sender is the owner of the derivatives to be converted
|
|
string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
|
// validator is the validator of the derivatives to be converted
|
|
string validator = 2;
|
|
// amount is the quantity of derivatives to be converted
|
|
cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
|
|
}
|
|
|
|
// MsgBurnDerivativeResponse defines the Msg/BurnDerivative response type.
|
|
message MsgBurnDerivativeResponse {
|
|
// received is the number of delegation shares sent to the sender
|
|
string received = 1 [
|
|
(cosmos_proto.scalar) = "cosmos.Dec",
|
|
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
} |