forked from bandprotocol/bandchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packets.go
47 lines (42 loc) · 1.29 KB
/
packets.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
42
43
44
45
46
47
package proof
import (
"github.com/GeoDB-Limited/odincore/chain/x/oracle/types"
)
// RequestPacketEthereum is an Ethereum version of OracleRequestPacketData for solidity ABI-encoding.
type RequestPacketEthereum struct {
ClientId string
OracleScriptId uint64
Params []byte
AskCount uint64
MinCount uint64
}
func transformRequestPacket(p types.OracleRequestPacketData) RequestPacketEthereum {
return RequestPacketEthereum{
ClientId: p.ClientID,
OracleScriptId: uint64(p.OracleScriptID),
Params: p.Calldata,
AskCount: uint64(p.AskCount),
MinCount: uint64(p.MinCount),
}
}
// ResponsePacketEthereum is an Ethereum version of OracleResponsePacketData for solidity ABI-encoding.
type ResponsePacketEthereum struct {
ClientId string
RequestId uint64
AnsCount uint64
RequestTime uint64
ResolveTime uint64
ResolveStatus uint8
Result []byte
}
func transformResponsePacket(p types.OracleResponsePacketData) ResponsePacketEthereum {
return ResponsePacketEthereum{
ClientId: p.ClientID,
RequestId: uint64(p.RequestID),
AnsCount: uint64(p.AnsCount),
RequestTime: uint64(p.RequestTime),
ResolveTime: uint64(p.ResolveTime),
ResolveStatus: uint8(p.ResolveStatus),
Result: p.Result,
}
}