File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,35 @@ func validate(cfg *Client) error {
209209 if err != nil {
210210 return fmt .Errorf ("validating RelayGas: %v" , err )
211211 }
212+ err = validateContracts (cfg )
213+ if err != nil {
214+ return fmt .Errorf ("validating contracts: %v" , err )
215+ }
216+ return nil
217+ }
218+
219+ func validateContracts (cfg * Client ) error {
220+ if cfg .ContractAddresses .Submission == (common.Address {}) {
221+ return errors .New ("submission contract address not set" )
222+ }
223+ if cfg .ContractAddresses .SystemsManager == (common.Address {}) {
224+ return errors .New ("systems_manager contract address not set" )
225+ }
226+ if cfg .Clients .EnabledPreregistration {
227+ if cfg .ContractAddresses .VoterPreRegistry == (common.Address {}) {
228+ return errors .New ("pre-registration enabled but voter_preregistry contract address not set" )
229+ }
230+ }
231+ if cfg .Clients .EnabledRegistration {
232+ if cfg .ContractAddresses .VoterRegistry == (common.Address {}) {
233+ return errors .New ("registration enabled but voter_registry contract address not set" )
234+ }
235+ }
236+ if cfg .Clients .EnabledFinalizer {
237+ if cfg .ContractAddresses .Relay == (common.Address {}) {
238+ return errors .New ("finalizer enabled but relay contract address not set" )
239+ }
240+ }
212241 return nil
213242}
214243
You can’t perform that action at this time.
0 commit comments