Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deprecated SecurityToken investors function actually expects a uint256 - an index argument #704

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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