/
interface.go
30 lines (23 loc) · 1.42 KB
/
interface.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
package adaptors
import (
"context"
"github.com/Gravity-Tech/gravity-core/oracle/extractor"
"github.com/Gravity-Tech/gravity-core/common/contracts"
"github.com/Gravity-Tech/gravity-core/common/account"
)
type IBlockchainAdaptor interface {
GetHeight(ctx context.Context) (uint64, error)
WaitTx(id string, ctx context.Context) error
Sign(msg []byte) ([]byte, error)
PubKey() account.OraclesPubKey
ValueType(nebulaId account.NebulaId, ctx context.Context) (contracts.ExtractorType, error)
AddPulse(nebulaId account.NebulaId, pulseId uint64, validators []account.OraclesPubKey, hash []byte, ctx context.Context) (string, error)
SendValueToSubs(nebulaId account.NebulaId, pulseId uint64, value *extractor.Data, ctx context.Context) error
SetOraclesToNebula(nebulaId account.NebulaId, oracles []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)
SendConsulsToGravityContract(newConsulsAddresses []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)
SignConsuls(consulsAddresses []*account.OraclesPubKey, roundId int64) ([]byte, error)
SignOracles(nebulaId account.NebulaId, oracles []*account.OraclesPubKey) ([]byte, error)
LastPulseId(nebulaId account.NebulaId, ctx context.Context) (uint64, error)
LastRound(ctx context.Context) (uint64, error)
RoundExist(roundId int64, ctx context.Context) (bool, error)
}