/
earnings.go
32 lines (28 loc) · 896 Bytes
/
earnings.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
package types
import (
"fmt"
sdk "github.com/FiboChain/fbc/libs/cosmos-sdk/types"
)
// Earnings - structure for a earning query
type Earnings struct {
TargetBlockHeight int64 `json:"target_block_height"`
AmountLocked sdk.SysCoin `json:"amount_locked"`
AmountYielded sdk.SysCoins `json:"amount_yielded"`
}
// NewEarnings creates a new instance of Earnings
func NewEarnings(targetBlockHeight int64, amountLocked sdk.SysCoin, amountYielded sdk.SysCoins) Earnings {
return Earnings{
TargetBlockHeight: targetBlockHeight,
AmountLocked: amountLocked,
AmountYielded: amountYielded,
}
}
// String returns a human readable string representation of Earnings
func (e Earnings) String() string {
return fmt.Sprintf(`Earnings:
Target Block Height: %d,
Amount Locked: %s,
Amount Yielded: %s`,
e.TargetBlockHeight, e.AmountLocked, e.AmountYielded,
)
}