11package types
22
33import (
4+ sdkmath "cosmossdk.io/math"
45 sdk "github.com/cosmos/cosmos-sdk/types"
56)
67
@@ -25,13 +26,17 @@ var (
2526 EventIdKey = []byte {0x04 } // key for event id
2627 AttestationIdKey = []byte {0x05 } // key for attestation id
2728
28- OracleKeyPrefix = []byte {0x10 } // prefix for each key to an oracle
29- OracleByPubKeyKeyPrefix = []byte {0x11 } // prefix for each key to an oracle by public key
30- AgencyKeyPrefix = []byte {0x12 } // prefix for each key to an agency
31- NonceIndexKeyPrefix = []byte {0x13 } // key prefix for the nonce index
32- NonceKeyPrefix = []byte {0x14 } // prefix for each key to a nonce
33- EventKeyPrefix = []byte {0x15 } // prefix for each key to an event
34- AttestationKeyPrefix = []byte {0x16 } // prefix for each key to an attestation
29+ OracleKeyPrefix = []byte {0x10 } // prefix for each key to an oracle
30+ OracleByPubKeyKeyPrefix = []byte {0x11 } // prefix for each key to an oracle by public key
31+ PendingOraclePubKeyKeyPrefix = []byte {0x12 } // key prefix for the pending oracle public key
32+ AgencyKeyPrefix = []byte {0x13 } // prefix for each key to an agency
33+ PendingAgencyPubKeyKeyPrefix = []byte {0x14 } // key prefix for the pending agency public key
34+ NonceIndexKeyPrefix = []byte {0x15 } // key prefix for the nonce index
35+ NonceKeyPrefix = []byte {0x16 } // prefix for each key to a nonce
36+ EventKeyPrefix = []byte {0x17 } // prefix for each key to an event
37+ EventByPriceKeyPrefix = []byte {0x18 } // prefix for each key to an event by triggering price
38+ CurrentEventPriceKeyPrefix = []byte {0x19 } // key prefix for the current event price
39+ AttestationKeyPrefix = []byte {0x20 } // prefix for each key to an attestation
3540
3641 PriceKeyPrefix = []byte {0x20 } // key prefix for the price
3742)
@@ -44,10 +49,24 @@ func OracleByPubKeyKey(pubKey []byte) []byte {
4449 return append (OracleByPubKeyKeyPrefix , pubKey ... )
4550}
4651
52+ func PendingOraclePubKeyKey (id uint64 , sender string , pubKey []byte ) []byte {
53+ key := append (PendingOraclePubKeyKeyPrefix , sdk .Uint64ToBigEndian (id )... )
54+ key = append (key , []byte (sender )... )
55+
56+ return append (key , pubKey ... )
57+ }
58+
4759func AgencyKey (id uint64 ) []byte {
4860 return append (AgencyKeyPrefix , sdk .Uint64ToBigEndian (id )... )
4961}
5062
63+ func PendingAgencyPubKeyKey (id uint64 , sender string , pubKey []byte ) []byte {
64+ key := append (PendingAgencyPubKeyKeyPrefix , sdk .Uint64ToBigEndian (id )... )
65+ key = append (key , []byte (sender )... )
66+
67+ return append (key , pubKey ... )
68+ }
69+
5170func NonceIndexKey (oracleId uint64 ) []byte {
5271 return append (NonceIndexKeyPrefix , sdk .Uint64ToBigEndian (oracleId )... )
5372}
@@ -60,6 +79,14 @@ func EventKey(id uint64) []byte {
6079 return append (EventKeyPrefix , sdk .Uint64ToBigEndian (id )... )
6180}
6281
82+ func EventByPriceKey (price sdkmath.Int ) []byte {
83+ return append (EventByPriceKeyPrefix , price .BigInt ().Bytes ()... )
84+ }
85+
86+ func CurrentEventPriceKey (pair string ) []byte {
87+ return append (CurrentEventPriceKeyPrefix , []byte (pair )... )
88+ }
89+
6390func AttestationKey (id uint64 ) []byte {
6491 return append (AttestationKeyPrefix , sdk .Uint64ToBigEndian (id )... )
6592}
0 commit comments