Skip to content

Commit 6674f6d

Browse files
committed
Update decimals
1 parent 42a5026 commit 6674f6d

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

Sources/web3swift/Tokens/ERC777/Web3+ERC777.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,9 @@ public class ERC777: IERC777, ERC20BaseProperties {
5151
basePropertiesProvider = ERC20BasePropertiesProvider(contract: contract)
5252
}
5353

54-
// Must be 18!
5554
public func decimals() async throws -> UInt8 {
56-
try await self.readProperties()
57-
if self.decimals != nil {
58-
return self.decimals!
59-
}
60-
return 18
55+
try await readProperties()
56+
return decimals ?? 18
6157
}
6258

6359
public func getGranularity() async throws -> BigUInt {

Sources/web3swift/Tokens/ST20/Web3+SecurityToken.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,9 @@ public class SecurityToken: ISecurityToken, ERC20BaseProperties {
8484
basePropertiesProvider = ERC20BasePropertiesProvider(contract: contract)
8585
}
8686

87-
// Must be 18!
8887
public func decimals() async throws -> UInt8 {
89-
try await self.readProperties()
90-
if self.decimals != nil {
91-
return self.decimals!
92-
}
93-
return 18
88+
try await readProperties()
89+
return decimals ?? 18
9490
}
9591

9692
func tokenDetails() async throws -> [UInt32] {

0 commit comments

Comments
 (0)