@@ -110,31 +110,36 @@ public interface IETHClient
110110
111111 public class ETHClient : IETHClient
112112 {
113- private readonly InteropSettings interopSettings ;
114- private readonly Web3 web3 ;
115- private Event < TransferEventDTO > transferEventHandler ;
116- private NewFilterInput filterAllTransferEventsForContract ;
117- private HexBigInteger filterId ;
113+ protected ETHInteropSettings settings ;
114+ protected Web3 web3 ;
115+ protected Event < TransferEventDTO > transferEventHandler ;
116+ protected NewFilterInput filterAllTransferEventsForContract ;
117+ protected HexBigInteger filterId ;
118118
119119 public const string ZeroAddress = "0x0000000000000000000000000000000000000000" ;
120120
121121 public ETHClient ( InteropSettings interopSettings )
122122 {
123- this . interopSettings = interopSettings ;
124-
125- if ( ! this . interopSettings . InteropEnabled )
123+ this . SetupConfiguration ( interopSettings ) ;
124+
125+ if ( ! this . settings . InteropEnabled )
126126 return ;
127127
128- var account = new ManagedAccount ( interopSettings . ETHAccount , interopSettings . ETHPassphrase ) ;
129-
128+ var account = new ManagedAccount ( this . settings . Account , this . settings . Passphrase ) ;
129+
130130 // TODO: Support loading offline accounts from keystore JSON directly?
131- this . web3 = ! string . IsNullOrWhiteSpace ( interopSettings . ETHClientUrl ) ? new Web3 ( account , interopSettings . ETHClientUrl ) : new Web3 ( account ) ;
131+ this . web3 = ! string . IsNullOrWhiteSpace ( this . settings . ClientUrl ) ? new Web3 ( account , this . settings . ClientUrl ) : new Web3 ( account ) ;
132+ }
133+
134+ protected virtual void SetupConfiguration ( InteropSettings interopSettings )
135+ {
136+ this . settings = interopSettings . ETHSettings ;
132137 }
133138
134139 /// <inheritdoc />
135140 public async Task CreateTransferEventFilterAsync ( )
136141 {
137- this . transferEventHandler = this . web3 . Eth . GetEvent < TransferEventDTO > ( this . interopSettings . ETHWrappedStraxContractAddress ) ;
142+ this . transferEventHandler = this . web3 . Eth . GetEvent < TransferEventDTO > ( this . settings . WrappedStraxContractAddress ) ;
138143 this . filterAllTransferEventsForContract = this . transferEventHandler . CreateFilterInput ( ) ;
139144 this . filterId = await this . transferEventHandler . CreateFilterAsync ( this . filterAllTransferEventsForContract ) . ConfigureAwait ( false ) ;
140145 }
@@ -159,7 +164,7 @@ public async Task<List<EventLog<TransferEventDTO>>> GetTransferEventsForWrappedS
159164 /// <inheritdoc />
160165 public async Task < string > GetDestinationAddressAsync ( string address )
161166 {
162- return await WrappedStrax . GetDestinationAddressAsync ( this . web3 , this . interopSettings . ETHWrappedStraxContractAddress , address ) . ConfigureAwait ( false ) ;
167+ return await WrappedStrax . GetDestinationAddressAsync ( this . web3 , this . settings . WrappedStraxContractAddress , address ) . ConfigureAwait ( false ) ;
163168 }
164169
165170 /// <inheritdoc />
@@ -183,19 +188,19 @@ public async Task<BigInteger> GetBalanceAsync(string address)
183188 /// <inheritdoc />
184189 public async Task < MultisigTransactionIdentifiers > SubmitTransactionAsync ( string destination , BigInteger value , string data , int gasPrice )
185190 {
186- return await MultisigWallet . SubmitTransactionAsync ( this . web3 , this . interopSettings . ETHMultisigWalletAddress , destination , value , data , this . interopSettings . ETHGasLimit , gasPrice ) . ConfigureAwait ( false ) ;
191+ return await MultisigWallet . SubmitTransactionAsync ( this . web3 , this . settings . MultisigWalletAddress , destination , value , data , this . settings . GasLimit , this . settings . GasPrice ) . ConfigureAwait ( false ) ;
187192 }
188193
189194 /// <inheritdoc />
190195 public async Task < string > ConfirmTransactionAsync ( BigInteger transactionId , int gasPrice )
191196 {
192- return await MultisigWallet . ConfirmTransactionAsync ( this . web3 , this . interopSettings . ETHMultisigWalletAddress , transactionId , this . interopSettings . ETHGasLimit , gasPrice ) . ConfigureAwait ( false ) ;
197+ return await MultisigWallet . ConfirmTransactionAsync ( this . web3 , this . settings . MultisigWalletAddress , transactionId , this . settings . GasLimit , this . settings . GasPrice ) . ConfigureAwait ( false ) ;
193198 }
194199
195200 /// <inheritdoc />
196201 public async Task < BigInteger > GetMultisigConfirmationCountAsync ( BigInteger transactionId )
197202 {
198- return await MultisigWallet . GetConfirmationCountAsync ( this . web3 , this . interopSettings . ETHMultisigWalletAddress , transactionId ) . ConfigureAwait ( false ) ;
203+ return await MultisigWallet . GetConfirmationCountAsync ( this . web3 , this . settings . MultisigWalletAddress , transactionId ) . ConfigureAwait ( false ) ;
199204 }
200205
201206 public async Task < BigInteger > GetConfirmationsAsync ( string transactionHash )
@@ -214,7 +219,7 @@ public async Task<BigInteger> GetConfirmationsAsync(string transactionHash)
214219
215220 public async Task < BigInteger > GetErc20BalanceAsync ( string addressToQuery )
216221 {
217- return await WrappedStrax . GetErc20BalanceAsync ( this . web3 , this . interopSettings . ETHWrappedStraxContractAddress , addressToQuery ) . ConfigureAwait ( false ) ;
222+ return await WrappedStrax . GetErc20BalanceAsync ( this . web3 , this . settings . WrappedStraxContractAddress , addressToQuery ) . ConfigureAwait ( false ) ;
218223 }
219224
220225 /// <inheritdoc />
0 commit comments