Skip to content

Commit e6c129e

Browse files
Merge pull request #704 from JeneaVranceanu/fix/security-token-investors-call
fix: deprecated SecurityToken investors function actually expects a uint256 - an index argument
2 parents ed2dc96 + 1f610b7 commit e6c129e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ protocol ISecurityToken: IST20, IOwnable {
2828
/// Total number of non-zero token holders
2929
func investorCount() async throws -> BigUInt
3030

31-
/// List of token holders
32-
func investors() async throws -> [EthereumAddress]
31+
/// List of token holders at specified index
32+
func investors(index: UInt) async throws -> [EthereumAddress]
3333

3434
/// Permissions this to a Permission module, which has a key of 1
3535
/// If no Permission return false - note that IModule withPerm will allow ST owner all permissions anyway
@@ -326,10 +326,9 @@ public class SecurityToken: ISecurityToken, ERC20BaseProperties {
326326
return res
327327
}
328328

329-
public func investors() async throws -> [EthereumAddress] {
330-
let contract = self.contract
331-
self.transaction.callOnBlock = .latest
332-
let result = try await contract.createReadOperation("investors", parameters: [AnyObject](), extraData: Data() )!.callContractMethod()
329+
public func investors(index: UInt) async throws -> [EthereumAddress] {
330+
transaction.callOnBlock = .latest
331+
let result = try await contract.createReadOperation("investors", parameters: [index] as [AnyObject])!.callContractMethod()
333332
guard let res = result["0"] as? [EthereumAddress] else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
334333
return res
335334
}

0 commit comments

Comments
 (0)