@@ -64,23 +64,14 @@ protocol IERC1400: IERC20 {
6464// can be imperatively read and saved
6565// FIXME: Rewrite this to CodableTransaction
6666public class ERC1400 : IERC1400 , ERC20BaseProperties {
67-
68- internal var _name : String ?
69- internal var _symbol : String ?
70- internal var _decimals : UInt8 ?
71- internal var _hasReadProperties : Bool = false
72-
67+ public private( set) var basePropertiesProvider : ERC20BasePropertiesProvider
7368 public var transaction : CodableTransaction
7469 public var web3 : Web3
7570 public var provider : Web3Provider
7671 public var address : EthereumAddress
7772 public var abi : String
7873
79- lazy var contract : Web3 . Contract = {
80- let contract = self . web3. contract ( self . abi, at: self . address, abiVersion: 2 )
81- precondition ( contract != nil )
82- return contract!
83- } ( )
74+ public let contract : Web3 . Contract
8475
8576 public init ( web3: Web3 , provider: Web3Provider , address: EthereumAddress , abi: String = Web3 . Utils. erc1400ABI, transaction: CodableTransaction = . emptyTransaction) {
8677 self . web3 = web3
@@ -89,6 +80,9 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
8980 self . transaction = transaction
9081 self . transaction. to = address
9182 self . abi = abi
83+ // TODO: Make `init` and `web3.contract.init` throwing. Forced because this should fail if ABI is wrongly configured
84+ contract = web3. contract ( abi, at: address) !
85+ basePropertiesProvider = ERC20BasePropertiesProvider ( contract: contract)
9286 }
9387
9488 public func getBalance( account: EthereumAddress ) async throws -> BigUInt {
0 commit comments