github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/dex/types/deposits.go (about)

     1  package types
     2  
     3  import (
     4  	"time"
     5  
     6  	sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
     7  )
     8  
     9  // DefaultWithdrawPeriod defines default withdraw period
    10  const DefaultWithdrawPeriod = time.Hour * 24 * 3
    11  
    12  // WithdrawInfo represents infos for withdrawing
    13  type WithdrawInfo struct {
    14  	Owner        sdk.AccAddress `json:"owner"`
    15  	Deposits     sdk.SysCoin    `json:"deposits"`
    16  	CompleteTime time.Time      `json:"complete_time"`
    17  }
    18  
    19  // Equal returns boolean for whether two WithdrawInfo are Equal
    20  func (w WithdrawInfo) Equal(other WithdrawInfo) bool {
    21  	return w.Owner.Equals(other.Owner) && w.Deposits.IsEqual(other.Deposits) && w.CompleteTime.Equal(other.CompleteTime)
    22  }
    23  
    24  // WithdrawInfos defines list of WithdrawInfo
    25  type WithdrawInfos []WithdrawInfo
    26  
    27  // Equal returns boolean for whether two WithdrawInfos are Equal
    28  func (ws WithdrawInfos) Equal(other WithdrawInfos) bool {
    29  	if len(ws) != len(other) {
    30  		return false
    31  	}
    32  
    33  	for i := 0; i < len(ws); i++ {
    34  		if !ws[i].Equal(other[i]) {
    35  			return false
    36  		}
    37  	}
    38  	return true
    39  }