-
Notifications
You must be signed in to change notification settings - Fork 44
/
commitments.go
41 lines (36 loc) · 932 Bytes
/
commitments.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (c *Commitments) GetUncommittedTokensForDenom(denom string) (*UncommittedTokens, bool) {
for _, token := range c.UncommittedTokens {
if token.Denom == denom {
return token, true
}
}
return &UncommittedTokens{}, false
}
func (c *Commitments) GetCommittedTokensForDenom(denom string) (*CommittedTokens, bool) {
for _, token := range c.CommittedTokens {
if token.Denom == denom {
return token, true
}
}
return &CommittedTokens{}, false
}
func (c *Commitments) GetUncommittedAmountForDenom(denom string) sdk.Int {
for _, token := range c.UncommittedTokens {
if token.Denom == denom {
return token.Amount
}
}
return sdk.NewInt(0)
}
func (c *Commitments) GetCommittedAmountForDenom(denom string) sdk.Int {
for _, token := range c.CommittedTokens {
if token.Denom == denom {
return token.Amount
}
}
return sdk.NewInt(0)
}