|
| 1 | +package chainaccessor |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + "errors" |
| 6 | + "time" |
| 7 | + |
| 8 | + "github.com/xssnick/tonutils-go/ton" |
| 9 | + |
| 10 | + "github.com/smartcontractkit/chainlink-common/pkg/logger" |
| 11 | + "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3" |
| 12 | + "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" |
| 13 | + |
| 14 | + "github.com/smartcontractkit/chainlink-ton/pkg/logpoller" |
| 15 | +) |
| 16 | + |
| 17 | +type TONAccessor struct { |
| 18 | + lggr logger.Logger |
| 19 | + client ton.APIClientWrapped |
| 20 | + logPoller logpoller.LogPoller |
| 21 | +} |
| 22 | + |
| 23 | +var _ ccipocr3.ChainAccessor = (*TONAccessor)(nil) |
| 24 | + |
| 25 | +func NewTONAccessor( |
| 26 | + lggr logger.Logger, |
| 27 | + client ton.APIClientWrapped, |
| 28 | + logPoller logpoller.LogPoller, |
| 29 | + addrCodec ccipocr3.AddressCodec, |
| 30 | +) (ccipocr3.ChainAccessor, error) { |
| 31 | + // TODO: validate state of client and logPoller (should be initialized in NewChain) |
| 32 | + return &TONAccessor{ |
| 33 | + lggr: lggr, |
| 34 | + client: client, |
| 35 | + logPoller: logPoller, |
| 36 | + }, nil |
| 37 | +} |
| 38 | + |
| 39 | +// Common Accessor methods |
| 40 | +func (a *TONAccessor) GetContractAddress(contractName string) ([]byte, error) { |
| 41 | + // TODO(NONEVM-2364) implement me |
| 42 | + return nil, errors.New("not implemented") |
| 43 | +} |
| 44 | + |
| 45 | +func (a *TONAccessor) GetAllConfigLegacySnapshot(ctx context.Context) (ccipocr3.ChainConfigSnapshot, error) { |
| 46 | + // TODO(NONEVM-2364) implement me |
| 47 | + return ccipocr3.ChainConfigSnapshot{}, errors.New("not implemented") |
| 48 | +} |
| 49 | + |
| 50 | +func (a *TONAccessor) GetChainFeeComponents(ctx context.Context) (ccipocr3.ChainFeeComponents, error) { |
| 51 | + // TODO(NONEVM-2364) implement me |
| 52 | + return ccipocr3.ChainFeeComponents{}, errors.New("not implemented") |
| 53 | +} |
| 54 | + |
| 55 | +func (a *TONAccessor) Sync(ctx context.Context, contractName string, contractAddress ccipocr3.UnknownAddress) error { |
| 56 | + // TODO(NONEVM-2364) implement me |
| 57 | + return errors.New("not implemented") |
| 58 | +} |
| 59 | + |
| 60 | +// TON as source chain methods |
| 61 | +func (a *TONAccessor) MsgsBetweenSeqNums(ctx context.Context, dest ccipocr3.ChainSelector, seqNumRange ccipocr3.SeqNumRange) ([]ccipocr3.Message, error) { |
| 62 | + // TODO(NONEVM-2364) implement me |
| 63 | + return nil, errors.New("not implemented") |
| 64 | +} |
| 65 | + |
| 66 | +func (a *TONAccessor) LatestMessageTo(ctx context.Context, dest ccipocr3.ChainSelector) (ccipocr3.SeqNum, error) { |
| 67 | + // TODO(NONEVM-2364) implement me |
| 68 | + return 0, errors.New("not implemented") |
| 69 | +} |
| 70 | + |
| 71 | +func (a *TONAccessor) GetExpectedNextSequenceNumber(ctx context.Context, dest ccipocr3.ChainSelector) (ccipocr3.SeqNum, error) { |
| 72 | + // TODO(NONEVM-2364) implement me |
| 73 | + return 0, errors.New("not implemented") |
| 74 | +} |
| 75 | + |
| 76 | +func (a *TONAccessor) GetTokenPriceUSD(ctx context.Context, address ccipocr3.UnknownAddress) (ccipocr3.TimestampedUnixBig, error) { |
| 77 | + // TODO(NONEVM-2364) implement me |
| 78 | + return ccipocr3.TimestampedUnixBig{}, errors.New("not implemented") |
| 79 | +} |
| 80 | + |
| 81 | +func (a *TONAccessor) GetFeeQuoterDestChainConfig(ctx context.Context, dest ccipocr3.ChainSelector) (ccipocr3.FeeQuoterDestChainConfig, error) { |
| 82 | + // TODO(NONEVM-2364) implement me |
| 83 | + return ccipocr3.FeeQuoterDestChainConfig{}, errors.New("not implemented") |
| 84 | +} |
| 85 | + |
| 86 | +// TON as destination chain methods |
| 87 | +func (a *TONAccessor) CommitReportsGTETimestamp(ctx context.Context, ts time.Time, confidence primitives.ConfidenceLevel, limit int) ([]ccipocr3.CommitPluginReportWithMeta, error) { |
| 88 | + // TODO(NONEVM-2365) implement me |
| 89 | + return nil, errors.New("not implemented") |
| 90 | +} |
| 91 | + |
| 92 | +func (a *TONAccessor) ExecutedMessages(ctx context.Context, ranges map[ccipocr3.ChainSelector][]ccipocr3.SeqNumRange, confidence primitives.ConfidenceLevel) (map[ccipocr3.ChainSelector][]ccipocr3.SeqNum, error) { |
| 93 | + // TODO(NONEVM-2365) implement me |
| 94 | + return nil, errors.New("not implemented") |
| 95 | +} |
| 96 | + |
| 97 | +func (a *TONAccessor) NextSeqNum(ctx context.Context, sources []ccipocr3.ChainSelector) (seqNum map[ccipocr3.ChainSelector]ccipocr3.SeqNum, err error) { |
| 98 | + // TODO(NONEVM-2365) implement me |
| 99 | + return nil, errors.New("not implemented") |
| 100 | +} |
| 101 | + |
| 102 | +func (a *TONAccessor) Nonces(ctx context.Context, addresses map[ccipocr3.ChainSelector][]ccipocr3.UnknownEncodedAddress) (map[ccipocr3.ChainSelector]map[string]uint64, error) { |
| 103 | + // TODO(NONEVM-2365) implement me |
| 104 | + return nil, errors.New("not implemented") |
| 105 | +} |
| 106 | + |
| 107 | +func (a *TONAccessor) GetChainFeePriceUpdate(ctx context.Context, selectors []ccipocr3.ChainSelector) map[ccipocr3.ChainSelector]ccipocr3.TimestampedBig { |
| 108 | + // TODO(NONEVM-2365) implement me |
| 109 | + return nil |
| 110 | +} |
| 111 | + |
| 112 | +func (a *TONAccessor) GetLatestPriceSeqNr(ctx context.Context) (uint64, error) { |
| 113 | + // TODO(NONEVM-2365) implement me |
| 114 | + return 0, errors.New("not implemented") |
| 115 | +} |
| 116 | + |
| 117 | +func (a *TONAccessor) GetRMNCurseInfo(ctx context.Context) (ccipocr3.CurseInfo, error) { |
| 118 | + // TODO(NONEVM-2365) implement me |
| 119 | + return ccipocr3.CurseInfo{}, errors.New("not implemented") |
| 120 | +} |
0 commit comments