/
yielded_token_info.go
51 lines (44 loc) · 1.65 KB
/
yielded_token_info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"strings"
)
// YieldedTokenInfo is the token excluding native token which can be yielded by locking other tokens including LPT and
// token issued
type YieldedTokenInfo struct {
RemainingAmount sdk.SysCoin `json:"remaining_amount"`
StartBlockHeightToYield int64 `json:"start_block_height_to_yield"`
AmountYieldedPerBlock sdk.Dec `json:"amount_yielded_per_block"`
}
// NewYieldedTokenInfo creates a new instance of YieldedTokenInfo
func NewYieldedTokenInfo(
remainingAmount sdk.SysCoin, startBlockHeightToYield int64, amountYieldedPerBlock sdk.Dec,
) YieldedTokenInfo {
return YieldedTokenInfo{
RemainingAmount: remainingAmount,
StartBlockHeightToYield: startBlockHeightToYield,
AmountYieldedPerBlock: amountYieldedPerBlock,
}
}
// String returns a human readable string representation of a YieldedTokenInfo
func (yti YieldedTokenInfo) String() string {
return fmt.Sprintf(`YieldedTokenInfo:
RemainingAmount: %s
Start Block Height To Yield: %d
AmountYieldedPerBlock: %s`,
yti.RemainingAmount, yti.StartBlockHeightToYield, yti.AmountYieldedPerBlock)
}
// YieldedTokenInfos is a collection of YieldedTokenInfo
type YieldedTokenInfos []YieldedTokenInfo
// NewYieldedTokenInfo creates a new instance of YieldedTokenInfo
func NewYieldedTokenInfos(yieldedTokenInfos ...YieldedTokenInfo) YieldedTokenInfos {
return yieldedTokenInfos
}
// String returns a human readable string representation of YieldedTokenInfos
func (ytis YieldedTokenInfos) String() (out string) {
for _, yti := range ytis {
out += yti.String() + "\n"
}
return strings.TrimSpace(out)
}