github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/farm/types/earnings.go (about) 1 package types 2 3 import ( 4 "fmt" 5 sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types" 6 ) 7 8 // Earnings - structure for a earning query 9 type Earnings struct { 10 TargetBlockHeight int64 `json:"target_block_height"` 11 AmountLocked sdk.SysCoin `json:"amount_locked"` 12 AmountYielded sdk.SysCoins `json:"amount_yielded"` 13 } 14 15 // NewEarnings creates a new instance of Earnings 16 func NewEarnings(targetBlockHeight int64, amountLocked sdk.SysCoin, amountYielded sdk.SysCoins) Earnings { 17 return Earnings{ 18 TargetBlockHeight: targetBlockHeight, 19 AmountLocked: amountLocked, 20 AmountYielded: amountYielded, 21 } 22 } 23 24 // String returns a human readable string representation of Earnings 25 func (e Earnings) String() string { 26 return fmt.Sprintf(`Earnings: 27 Target Block Height: %d, 28 Amount Locked: %s, 29 Amount Yielded: %s`, 30 e.TargetBlockHeight, e.AmountLocked, e.AmountYielded, 31 ) 32 }