github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/farm/types/lock_info.go (about) 1 package types 2 3 import ( 4 "fmt" 5 sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types" 6 ) 7 8 // LockInfo is locked info of an address 9 type LockInfo struct { 10 Owner sdk.AccAddress `json:"owner"` 11 PoolName string `json:"pool_name"` 12 Amount sdk.SysCoin `json:"amount"` 13 StartBlockHeight int64 `json:"start_block_height"` 14 ReferencePeriod uint64 `json:"reference_period"` 15 } 16 17 // NewLockInfo creates a new instance of LockInfo 18 func NewLockInfo(owner sdk.AccAddress, poolName string, amount sdk.SysCoin, startBlockHeight int64, referencePeriod uint64) LockInfo { 19 return LockInfo{ 20 Owner: owner, 21 PoolName: poolName, 22 Amount: amount, 23 StartBlockHeight: startBlockHeight, 24 ReferencePeriod: referencePeriod, 25 } 26 } 27 28 // String returns a human readable string representation of LockInfo 29 func (li LockInfo) String() string { 30 return fmt.Sprintf(`Lock Info: 31 Owner: %s 32 Pool Name: %s 33 Locked Amount: %s 34 Start Block Height: %d 35 Reference Period: %d`, 36 li.Owner, li.PoolName, li.Amount, li.StartBlockHeight, li.ReferencePeriod) 37 }