Skip to content

Commit

Permalink
WIP: Add ST-20 support
Browse files Browse the repository at this point in the history
  • Loading branch information
srisankethu committed Jan 18, 2019
1 parent 50893a0 commit 2d8a8fc
Showing 1 changed file with 206 additions and 0 deletions.
206 changes: 206 additions & 0 deletions web3swift/PrecompiledContracts/Web3+ST20.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import Foundation
import BigInt
import EthereumAddress
import PromiseKit

// Token Standard
protocol ISecurityToken: IERC20 {

func decimals() throws -> UInt8
func totalSupply() throws -> BigUInt
func getBalance(account: EthereumAddress) throws -> BigUInt
func getAllowance(originalOwner: EthereumAddress, delegate: EthereumAddress) throws -> BigUInt
func transfer(from: EthereumAddress, to: EthereumAddress, amount: String) throws -> WriteTransaction
func transferFrom(from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String) throws -> WriteTransaction
func approve(from: EthereumAddress, spender: EthereumAddress, amount: String) throws -> WriteTransaction
func decreasedApproval(from: EthereumAddress, spender: EthereumAddress, subtractedValue: String) throws -> WriteTransaction
func increasedApproval(from: EthereumAddress, spender: EthereumAddress, addedValue: String) throws -> WriteTransaction

func verifyTransfer(from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String) throws -> WriteTransaction
func mint(investor: EthereumAddress, amount: String)
func mintWithData(investor: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction
func burnFromWithData(from: EthereumAddress, burner: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction
func burnWithData(burner: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction
func checkPermission(delegate: EthereumAddress, module: EthereumAddress, perm: Data) throws -> WriteTransaction
func getModule(module: EthereumAddress) throws -> [Data, EthereumAddress, Bool, UInt8, BigUInt, BigUInt]
func getModulesByName(name: Data) throws -> EthereumAddress[]
func getModulesByType(type: UInt8) throws -> EthereumAddress[]
func totalSupplyAt(checkpointId: String) throws -> BigUInt
func getBalanceAt(investor: Ethereum, checkpointId: String) throws -> BigUInt
func createCheckpoint() throws -> BigUInt
func getInvestors() throws -> EthereumAddress[]
func getInvestorsAt(checkpointId: String) throws -> EthereumAddress[]
func iterateInvestors(start: String, end: String) throws -> EthereumAddress[]
func currentCheckpointId() throws -> BigUInt
func investors(index: String) throws -> EthereumAddress
func withdrawERC20(tokenContract: EthereumAddress, amount: String) throws -> WriteTransaction
func changeModuleBudget(module: EthereumAddress, budget: String) throws -> WriteTransaction
func updateTokenDetails(newTokenDetails: String) throws -> WriteTransaction
func changeGranularity(granularity: String) throws -> WriteTransaction
func pruneInvestors(start: String, iters: String) throws -> WriteTransaction
func freezeTransfers() throws -> WriteTransaction
func unfreezeTransfers() throws -> WriteTransaction
func freezeMinting() throws -> WriteTransaction
func mintMulti(investors: EthereumAddress[], amounts: String[]) throws -> WriteTransaction
func addModule(moduleFactory: EthereumAddress, data: Data, maxCost: String, budget: String) throws -> WriteTransaction
func archiveModule(module: EthereumAddress) throws -> WriteTransaction
func unarchiveModule(module: EthereumAddress) throws -> WriteTransaction
func removeModule(module: EthereumAddress) throws -> WriteTransaction
func setController(controller: EthereumAddress) throws -> WriteTransaction
func forceTransfer(from: EthereumAddress, to: EthereumAddress, amount: String, data: Data, log: Data) throws -> WriteTransaction
func forceBurn(from: EthereumAddress, amount: String, data: Data, log: Data) throws -> WriteTransaction
func disableController() throws -> WriteTransaction
func getVersion() throws -> UInt8[]
func getInvestorCount() throws -> BigUInt
func transferWithData(to: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction
func transferFromWithData(from: EthereumAddress, to: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction
func granularity() throws -> BigUInt
}

public class ST20: ISecurityToken {

public func decimals() throws -> UInt8 {
}

public func totalSupply() throws -> BigUInt {
}

public func getBalance(account: EthereumAddress) throws -> BigUInt {
}

public func getAllowance(originalOwner: EthereumAddress, delegate: EthereumAddress) throws -> BigUInt {
}

public func transfer(from: EthereumAddress, to: EthereumAddress, amount: String) throws -> WriteTransaction {
}

public func transferFrom(from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String) throws -> WriteTransaction {
}

public func approve(from: EthereumAddress, spender: EthereumAddress, amount: String) throws -> WriteTransaction {
}

public func decreasedApproval(from: EthereumAddress, spender: EthereumAddress, subtractedValue: String) throws -> WriteTransaction {
}

public func increasedApproval(from: EthereumAddress, spender: EthereumAddress, addedValue: String) throws -> WriteTransaction {
}

public func verifyTransfer(from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String) throws -> WriteTransaction {
}

public func mint(investor: EthereumAddress, amount: String) {
}

public func mintWithData(investor: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction {
}

public func burnFromWithData(from: EthereumAddress, burner: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction {
}

public func burnWithData(burner: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction {
}

public func checkPermission(delegate: EthereumAddress, module: EthereumAddress, perm: Data) throws -> WriteTransaction {
}

public func getModule(module: EthereumAddress) throws -> [Data, EthereumAddress, Bool, UInt8, BigUInt, BigUInt] {
}

public func getModulesByName(name: Data) throws -> EthereumAddress[] {
}

public func getModulesByType(type: UInt8) throws -> EthereumAddress[] {
}

public func totalSupplyAt(checkpointId: String) throws -> BigUInt {
}

public func getBalanceAt(investor: Ethereum, checkpointId: String) throws -> BigUInt {
}

public func createCheckpoint() throws -> BigUInt {
}

public func getInvestors() throws -> EthereumAddress[] {
}

public func getInvestorsAt(checkpointId: String) throws -> EthereumAddress[] {
}

public func iterateInvestors(start: String, end: String) throws -> EthereumAddress[] {
}

public func currentCheckpointId() throws -> BigUInt {
}

public func investors(index: String) throws -> EthereumAddress {
}

public func withdrawERC20(tokenContract: EthereumAddress, amount: String) throws -> WriteTransaction {
}

public func changeModuleBudget(module: EthereumAddress, budget: String) throws -> WriteTransaction {
}

public func updateTokenDetails(newTokenDetails: String) throws -> WriteTransaction {
}

public func changeGranularity(granularity: String) throws -> WriteTransaction {
}

public func pruneInvestors(start: String, iters: String) throws -> WriteTransaction {
}

public func freezeTransfers() throws -> WriteTransaction {
}

public func unfreezeTransfers() throws -> WriteTransaction {
}

public func freezeMinting() throws -> WriteTransaction {
}

public func mintMulti(investors: EthereumAddress[], amounts: String[]) throws -> WriteTransaction {
}

public func addModule(moduleFactory: EthereumAddress, data: Data, maxCost: String, budget: String) throws -> WriteTransaction {
}

public func archiveModule(module: EthereumAddress) throws -> WriteTransaction {
}

public func unarchiveModule(module: EthereumAddress) throws -> WriteTransaction {
}

public func removeModule(module: EthereumAddress) throws -> WriteTransaction {
}

public func setController(controller: EthereumAddress) throws -> WriteTransaction {
}

public func forceTransfer(from: EthereumAddress, to: EthereumAddress, amount: String, data: Data, log: Data) throws -> WriteTransaction {
}

public func forceBurn(from: EthereumAddress, amount: String, data: Data, log: Data) throws -> WriteTransaction {
}

public func disableController() throws -> WriteTransaction {
}

public func getVersion() throws -> UInt8[] {
}

public func getInvestorCount() throws -> BigUInt {
}

public func transferWithData(to: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction {
}

public func transferFromWithData(from: EthereumAddress, to: EthereumAddress, amount: String, data: Data) throws -> WriteTransaction {
}

public func granularity() throws -> BigUInt {
}

}

0 comments on commit 2d8a8fc

Please sign in to comment.