66 "math/big"
77 "time"
88
9+ "github.com/ethereum/go-ethereum/accounts/abi"
910 "github.com/ethereum/go-ethereum/common"
1011 "github.com/ethereum/go-ethereum/crypto"
1112 "github.com/ethereum/go-ethereum/ethclient"
@@ -23,23 +24,26 @@ import (
2324)
2425
2526type FastUpdatesClient struct {
26- params config.FastUpdateClientConfig
27- chainClient * ethclient.Client
28- valuesProvider provider.ValuesProvider
29- signingAccount * Account
30- transactionAccounts []* Account
31- fastUpdater * fast_updater.FastUpdater
32- fastUpdatesConfig * fast_updates_configuration.FastUpdatesConfiguration
33- submission * submission.Submission
34- flareSystemMock * mock.Mock
35- flareSystemManager * system_manager.SystemManager
36- IncentiveManager * incentive.Incentive
37- key * sortition.Key
38- registeredEpochs map [int64 ]bool
39- transactionQueue * TransactionQueue
40- allFeeds []provider.FeedId
41- loggingParams config.LoggerConfig
42- Stats UpdatesStats
27+ params config.FastUpdateClientConfig
28+ chainClient * ethclient.Client
29+ valuesProvider provider.ValuesProvider
30+ signingAccount * Account
31+ transactionAccounts []* Account
32+ fastUpdater * fast_updater.FastUpdater
33+ fastUpdaterABI * abi.ABI
34+ fastUpdatesConfig * fast_updates_configuration.FastUpdatesConfiguration
35+ submission * submission.Submission
36+ flareSystemMock * mock.Mock
37+ flareSystemManager * system_manager.SystemManager
38+ IncentiveManager * incentive.Incentive
39+ key * sortition.Key
40+ registeredEpochs map [int64 ]bool
41+ transactionQueue * TransactionQueue
42+ allFeeds []provider.FeedId
43+ loggingParams config.LoggerConfig
44+ Stats UpdatesStats
45+ FetchCurrentFeedsValue * big.Int
46+ FetchCurrentFeedsAddress common.Address
4347}
4448
4549type Account struct {
@@ -113,6 +117,10 @@ func CreateFastUpdatesClient(cfg *config.Config, valuesProvider provider.ValuesP
113117 return nil , fmt .Errorf ("CreateFastUpdatesClient: NewFastUpdater: %w" , err )
114118 }
115119 }
120+ fastUpdatesClient .fastUpdaterABI , err = fast_updater .FastUpdaterMetaData .GetAbi ()
121+ if err != nil {
122+ return nil , fmt .Errorf ("CreateFastUpdatesClient: GetAbi: %w" , err )
123+ }
116124
117125 fastUpdatesClient .IncentiveManager , err = incentive .NewIncentive (
118126 common .HexToAddress (cfg .Client .IncentiveManagerAddress ), fastUpdatesClient .chainClient ,
@@ -177,6 +185,17 @@ func CreateFastUpdatesClient(cfg *config.Config, valuesProvider provider.ValuesP
177185 if fastUpdatesClient .params .MaxWeight == 0 {
178186 fastUpdatesClient .params .MaxWeight = 4096
179187 }
188+ if cfg .Client .FetchCurrentFeedsAddress != "" {
189+ fastUpdatesClient .FetchCurrentFeedsAddress = common .HexToAddress (cfg .Client .FetchCurrentFeedsAddress )
190+ var check bool
191+ fastUpdatesClient .FetchCurrentFeedsValue , check = new (big.Int ).SetString (cfg .Client .FetchCurrentFeedsValue , 10 )
192+ if ! check {
193+ return nil , fmt .Errorf ("CreateFastUpdatesClient: failed reading fetch_current_feeds_value: %s" , cfg .Client .FetchCurrentFeedsValue )
194+ }
195+ } else {
196+ fastUpdatesClient .FetchCurrentFeedsAddress = common .HexToAddress ("0x000000000000000000000000000000000000dEaD" )
197+ fastUpdatesClient .FetchCurrentFeedsValue , _ = new (big.Int ).SetString ("1000000000000000000000000" , 10 )
198+ }
180199
181200 return & fastUpdatesClient , nil
182201}
0 commit comments