0g-chain/proto/kava/earn/v1beta1/vault.proto
Derrick Lee b5e162a930
Update Earn vaults to use sdk.Dec shares (#1283)
* Change vault supply to shares

* Update deposit shares

* Use shares instead of supplied

* Update tests, fix share calculation

* Pass hard and savings keeper as pointer to earn keeper

* Update remaining failing test

* Add different share price test, fix comment for share price

* Add shares amount to events

* Additional share tests, use share to asset conversion for withdraw amount

* Update VaultTotalValue test

* Use sdk.Dec for vault shares instead of sdk.Int

* Add test for expensive 20:1 shares

* Update ConvertToShares comment for division, remove redundant test

* Add vault share tests
2022-09-12 09:23:26 -07:00

49 lines
1.6 KiB
Protocol Buffer

syntax = "proto3";
package kava.earn.v1beta1;
option go_package = "github.com/kava-labs/kava/x/earn/types";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
import "kava/earn/v1beta1/strategy.proto";
// AllowedVault is a vault that is allowed to be created. These can be
// modified via parameter governance.
message AllowedVault {
// Denom is the only supported denomination of the vault for deposits and withdrawals.
string denom = 1;
// VaultStrategy is the strategy used for this vault.
StrategyType vault_strategy = 2;
}
// VaultRecord is the state of a vault.
message VaultRecord {
// TotalShares is the total distributed number of shares in the vault.
VaultShare total_shares = 1 [(gogoproto.nullable) = false];
}
// VaultShareRecord defines the vault shares owned by a depositor.
message VaultShareRecord {
// Depositor represents the owner of the shares
bytes depositor = 1 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
];
// Shares represent the vault shares owned by the depositor.
repeated VaultShare shares = 2 [(gogoproto.castrepeated) = "VaultShares", (gogoproto.nullable) = false];
}
// VaultShare defines shares of a vault owned by a depositor.
message VaultShare {
option (gogoproto.goproto_stringer) = false;
string denom = 1;
string amount = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}