-
Notifications
You must be signed in to change notification settings - Fork 573
/
ack.go
27 lines (23 loc) · 940 Bytes
/
ack.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// NewIncentivizedAcknowledgement creates a new instance of IncentivizedAcknowledgement
func NewIncentivizedAcknowledgement(relayer string, ack []byte, success bool) IncentivizedAcknowledgement {
return IncentivizedAcknowledgement{
AppAcknowledgement: ack,
ForwardRelayerAddress: relayer,
UnderlyingAppSuccess: success,
}
}
// Success implements the Acknowledgement interface. The acknowledgement is
// considered successful if the forward relayer address is empty. Otherwise it is
// considered a failed acknowledgement.
func (ack IncentivizedAcknowledgement) Success() bool {
return ack.UnderlyingAppSuccess
}
// Acknowledgement implements the Acknowledgement interface. It returns the
// acknowledgement serialised using JSON.
func (ack IncentivizedAcknowledgement) Acknowledgement() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&ack))
}