Skip to content

Commit

Permalink
Merge pull request #704 from JeneaVranceanu/fix/security-token-invest…
Browse files Browse the repository at this point in the history
…ors-call

fix: deprecated SecurityToken investors function actually expects a uint256 - an index argument
  • Loading branch information
yaroslavyaroslav authored Dec 12, 2022
2 parents ed2dc96 + 1f610b7 commit e6c129e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Sources/web3swift/Tokens/ST20/Web3+SecurityToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ protocol ISecurityToken: IST20, IOwnable {
/// Total number of non-zero token holders
func investorCount() async throws -> BigUInt

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

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

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

0 comments on commit e6c129e

Please sign in to comment.