-
Notifications
You must be signed in to change notification settings - Fork 16
Smart Contracts
The following document describes the smart contracts the Front-End interacts with and how those interactions work.
Note (Sept, 2018): At this point in time this document is only describing the methods and properties that are used by the Front-End
NOTE: This document represents the relevant public APIs of each smart Contract using code
TODO: Explain types from-to JS
The following properties and methods are available in every contract
class PolyToken {
name: String = 'Polymath' // Name of the token
symbol: String = 'POLY' // Symbol of the token
decimals: Uint8 = 18 // Number of decimals the token supports (TODO: Confirm)
// Gets the amount of tokens `owner` is allowing `spender` to spend on their behalf
allowance(owner: Address, spender: Address): Number
// Gets the amount of tokens `owner` has in their account
balanceOf(owner: Address): Number
// Transfers `amount` of tokens from the address who called the method to `to`
transfer(_to: Address, _value: Uint256): Boolean
// Sets the `amount` of tokens the message sender allows `spender` to spend on their behalf
approve(_spender: Address, _value: Uint256): Boolean
}
// When a transfer from one address to another is executed
Event Transfer {
from: Address
to: Address
value: Uint256
}
// When an address approves an allowance
Event Transfer {
owner: Address
spender: Address
value: Uint256
}
Saves information about ticker reservations. It allows users to reserve their ticker symbols before actually generating their security token
class TickerRegistry {
// Returns the fee in `POLY` that is required to reserve a ticker
registrationFee(): Uint256
// Reserves a ticker to `owner`. Requires `allowance` of at least the registration fee in `POLY` to be approved
registerTicker(_owner: String, _symbol: String, _tokenName: String. _swarmHash: Bytes32): void
// Returns some details about a given symbol
getDetails(_symbol: String): [owner: Address, timestamp: Uint256, tokenName: String, swarmHash: Bytes32, status: Boolean],
}
// Emitted after a ticker is registered
Event LogRegisterTicker {
// Owner of the Ticker
_owner: Address
// The symbol (ticker) being reserved. Example: POLY
_symbol: String
// Human-friendly name of the symbol. Example: Polymath
_name: Bytes32
// TODO: Define this
_swarmHash: Bytes32
// Timestamp in which the ticker was reserved
_timestamp: Uint256
}
Factory for deploying a CappedSTOModule. TODO: Define CappedSTO
class CappedSTOFactory {
// Cost to deploy this STO module
setupCost: Uint256
}
#PolyToken
Description here
view function name() => String
view function totalSupply() => UInt256
view function decimals() => UInt8
view function decimalFactor() => UInt256
view function symbol() => String
view function balanceOf(_owner: Address) => balance: UInt256
view function allowance(_owner: Address, _spender: Address) => UInt256
function transfer(_to: Address, _value: UInt256) => Boolean
function transferFrom(_from: Address, _to: Address, _value: UInt256) => Boolean
function approve(_spender: Address, _value: UInt256) => Boolean
function increaseApproval(_spender: Address, _addedValue: UInt256) => Boolean
function decreaseApproval(_spender: Address, _subtractedValue: UInt256) => Boolean
event Transfer(from: Address, to: Address, value: UInt256)
event Approval(owner: Address, spender: Address, value: UInt256)
#TickerRegistry
Description here
view function expiryLimit() => UInt256
view function registrationFee() => UInt256
view function tickerRegistry() => Address
view function paused() => Boolean
view function polyToken() => Address
function renounceOwnership() => void
view function polymathRegistry() => Address
function reclaimERC20(_tokenContract: Address) => void
view function owner() => Address
view function moduleRegistry() => Address
view function securityTokenRegistry() => Address
function transferOwnership(_newOwner: Address) => void
function updateFromRegistry() => void
function registerTicker(_owner: Address, _symbol: String, _tokenName: String, _swarmHash: undefined) => void
function changeExpiryLimit(_newExpiry: UInt256) => void
function checkValidity(_symbol: String, _owner: Address, _tokenName: String) => Boolean
function isReserved(_symbol: String, _owner: Address, _tokenName: String, _swarmHash: undefined) => Boolean
view function getDetails(_symbol: String) => (Address, UInt256, String, undefined, Boolean)
function changePolyRegistrationFee(_registrationFee: UInt256) => void
function unpause() => void
function pause() => void
event LogRegisterTicker(_owner: Address, _symbol: String, _name: String, _swarmHash: undefined, _timestamp: UInt256)
event LogChangeExpiryLimit(_oldExpiry: UInt256, _newExpiry: UInt256)
event LogChangePolyRegistrationFee(_oldFee: UInt256, _newFee: UInt256)
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransferred(previousOwner: Address, newOwner: Address)
event Pause(_timestammp: UInt256)
event Unpause(_timestamp: UInt256)
#CappedSTOFactory
Description here
view function monthlySubscriptionCost() => UInt256
function changeFactorySubscriptionFee(_newSubscriptionCost: UInt256) => void
function changeFactorySetupFee(_newSetupCost: UInt256) => void
view function polyToken() => Address
function renounceOwnership() => void
view function setupCost() => UInt256
view function owner() => Address
function changeFactoryUsageFee(_newUsageCost: UInt256) => void
view function usageCost() => UInt256
function transferOwnership(_newOwner: Address) => void
function deploy(_data: undefined) => Address
view function getType() => UInt8
view function getName() => undefined
view function getDescription() => String
view function getTitle() => String
view function getInstructions() => String
view function getTags() => undefined
event LogChangeFactorySetupFee(_oldSetupcost: UInt256, _newSetupCost: UInt256, _moduleFactory: Address)
event LogChangeFactoryUsageFee(_oldUsageCost: UInt256, _newUsageCost: UInt256, _moduleFactory: Address)
event LogChangeFactorySubscriptionFee(_oldSubscriptionCost: UInt256, _newMonthlySubscriptionCost: UInt256, _moduleFactory: Address)
event LogGenerateModuleFromFactory(_module: Address, _moduleName: undefined, _moduleFactory: Address, _creator: Address, _timestamp: UInt256)
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransferred(previousOwner: Address, newOwner: Address)
#CountTransferManagerFactory
Description here
view function monthlySubscriptionCost() => UInt256
function changeFactorySubscriptionFee(_newSubscriptionCost: UInt256) => void
function changeFactorySetupFee(_newSetupCost: UInt256) => void
view function polyToken() => Address
function renounceOwnership() => void
view function setupCost() => UInt256
view function owner() => Address
function changeFactoryUsageFee(_newUsageCost: UInt256) => void
view function usageCost() => UInt256
function transferOwnership(_newOwner: Address) => void
function deploy(_data: undefined) => Address
view function getType() => UInt8
view function getName() => undefined
view function getDescription() => String
view function getTitle() => String
view function getInstructions() => String
view function getTags() => undefined
event LogChangeFactorySetupFee(_oldSetupcost: UInt256, _newSetupCost: UInt256, _moduleFactory: Address)
event LogChangeFactoryUsageFee(_oldUsageCost: UInt256, _newUsageCost: UInt256, _moduleFactory: Address)
event LogChangeFactorySubscriptionFee(_oldSubscriptionCost: UInt256, _newMonthlySubscriptionCost: UInt256, _moduleFactory: Address)
event LogGenerateModuleFromFactory(_module: Address, _moduleName: undefined, _moduleFactory: Address, _creator: Address, _timestamp: UInt256)
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransferred(previousOwner: Address, newOwner: Address)
#CountTransferManager
Description here
view function ADMIN() => undefined
function unpause() => void
view function paused() => Boolean
function takeFee(_amount: UInt256) => Boolean
view function polyToken() => Address
function pause() => void
view function maxHolderCount() => UInt256
view function securityToken() => Address
view function factory() => Address
view function FEE_ADMIN() => undefined
function verifyTransfer(: Address, _to: Address, : UInt256, : Boolean) => UInt8
function configure(_maxHolderCount: UInt256) => void
function getInitFunction() => undefined
function changeHolderCount(_maxHolderCount: UInt256) => void
view function getPermissions() => undefined
event LogModifyHolderCount(_oldHolderCount: UInt256, _newHolderCount: UInt256)
event Pause(_timestammp: UInt256)
event Unpause(_timestamp: UInt256)
#IModuleFactory
Description here
view function monthlySubscriptionCost() => UInt256
view function polyToken() => Address
function renounceOwnership() => void
view function setupCost() => UInt256
view function owner() => Address
view function usageCost() => UInt256
function transferOwnership(_newOwner: Address) => void
function deploy(_data: undefined) => Address
view function getType() => UInt8
view function getName() => undefined
view function getDescription() => String
view function getTitle() => String
view function getInstructions() => String
view function getTags() => undefined
function changeFactorySetupFee(_newSetupCost: UInt256) => void
function changeFactoryUsageFee(_newUsageCost: UInt256) => void
function changeFactorySubscriptionFee(_newSubscriptionCost: UInt256) => void
event LogChangeFactorySetupFee(_oldSetupcost: UInt256, _newSetupCost: UInt256, _moduleFactory: Address)
event LogChangeFactoryUsageFee(_oldUsageCost: UInt256, _newUsageCost: UInt256, _moduleFactory: Address)
event LogChangeFactorySubscriptionFee(_oldSubscriptionCost: UInt256, _newMonthlySubscriptionCost: UInt256, _moduleFactory: Address)
event LogGenerateModuleFromFactory(_module: Address, _moduleName: undefined, _moduleFactory: Address, _creator: Address, _timestamp: UInt256)
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransferred(previousOwner: Address, newOwner: Address)
#PercentageTransferManager
Description here
view function WHITELIST() => undefined
view function maxHolderPercentage() => UInt256
function unpause() => void
view function paused() => Boolean
function takeFee(_amount: UInt256) => Boolean
view function polyToken() => Address
function pause() => void
view function whitelist(: Address) => Boolean
view function securityToken() => Address
view function factory() => Address
view function FEE_ADMIN() => undefined
function verifyTransfer(: Address, _to: Address, _amount: UInt256, : Boolean) => UInt8
function configure(_maxHolderPercentage: UInt256) => void
function getInitFunction() => undefined
function changeHolderPercentage(_maxHolderPercentage: UInt256) => void
function modifyWhitelist(_investor: Address, _valid: Boolean) => void
function modifyWhitelistMulti(_investors: undefined, _valids: undefined) => void
view function getPermissions() => undefined
event LogModifyHolderPercentage(_oldHolderPercentage: UInt256, _newHolderPercentage: UInt256)
event LogModifyWhitelist(_investor: Address, _dateAdded: UInt256, _addedBy: Address, _valid: Boolean)
event Pause(_timestammp: UInt256)
event Unpause(_timestamp: UInt256)
#PercentageTransferManagerFactory
Description here
view function monthlySubscriptionCost() => UInt256
function changeFactorySubscriptionFee(_newSubscriptionCost: UInt256) => void
function changeFactorySetupFee(_newSetupCost: UInt256) => void
view function polyToken() => Address
function renounceOwnership() => void
view function setupCost() => UInt256
view function owner() => Address
function changeFactoryUsageFee(_newUsageCost: UInt256) => void
view function usageCost() => UInt256
function transferOwnership(_newOwner: Address) => void
function deploy(_data: undefined) => Address
view function getType() => UInt8
view function getName() => undefined
view function getDescription() => String
view function getTitle() => String
view function getInstructions() => String
view function getTags() => undefined
event LogChangeFactorySetupFee(_oldSetupcost: UInt256, _newSetupCost: UInt256, _moduleFactory: Address)
event LogChangeFactoryUsageFee(_oldUsageCost: UInt256, _newUsageCost: UInt256, _moduleFactory: Address)
event LogChangeFactorySubscriptionFee(_oldSubscriptionCost: UInt256, _newMonthlySubscriptionCost: UInt256, _moduleFactory: Address)
event LogGenerateModuleFromFactory(_module: Address, _moduleName: undefined, _moduleFactory: Address, _creator: Address, _timestamp: UInt256)
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransferred(previousOwner: Address, newOwner: Address)
#GeneralPermissionManager
Description here
view function perms(: Address, : Address, : undefined) => Boolean
function takeFee(_amount: UInt256) => Boolean
view function polyToken() => Address
view function CHANGE_PERMISSION() => undefined
view function securityToken() => Address
view function factory() => Address
view function FEE_ADMIN() => undefined
view function delegateDetails(: Address) => undefined
function getInitFunction() => undefined
view function checkPermission(_delegate: Address, _module: Address, _perm: undefined) => Boolean
function addPermission(_delegate: Address, _details: undefined) => void
function changePermission(_delegate: Address, _module: Address, _perm: undefined, _valid: Boolean) => Boolean
view function getDelegateDetails(_delegate: Address) => undefined
view function getPermissions() => undefined
event LogChangePermission(_delegate: Address, _module: Address, _perm: undefined, _valid: Boolean, _timestamp: UInt256)
event LogAddPermission(_delegate: Address, _details: undefined, _timestamp: UInt256)
#SecurityToken
Description here
view function name() => String
function approve(_spender: Address, _value: UInt256) => Boolean
view function investorListed(: Address) => Boolean
view function totalSupply() => UInt256
view function finishedSTOMinting() => Boolean
view function tokenBurner() => Address
view function tickerRegistry() => Address
view function decimals() => UInt8
view function securityTokenVersion() => undefined
view function investors(: UInt256) => Address
view function currentCheckpointId() => UInt256
view function granularity() => UInt256
view function MAX_MODULES() => UInt8
view function freeze() => Boolean
view function STO_KEY() => UInt8
function decreaseApproval(_spender: Address, _subtractedValue: UInt256) => Boolean
view function polyToken() => Address
view function balanceOf(_owner: Address) => UInt256
function renounceOwnership() => void
view function modules(: UInt8, : UInt256) => (name: undefined, moduleAddress: Address)
view function polymathRegistry() => Address
view function checkpointTotalSupply(: UInt256) => (checkpointId: UInt256, value: UInt256)
view function owner() => Address
view function TRANSFERMANAGER_KEY() => UInt8
view function symbol() => String
view function finishedIssuerMinting() => Boolean
view function PERMISSIONMANAGER_KEY() => UInt8
view function moduleRegistry() => Address
view function CHECKPOINT_KEY() => UInt8
view function securityTokenRegistry() => Address
view function tokenDetails() => String
function increaseApproval(_spender: Address, _addedValue: UInt256) => Boolean
view function investorCount() => UInt256
view function allowance(_owner: Address, _spender: Address) => UInt256
function transferOwnership(_newOwner: Address) => void
function updateFromRegistry() => void
view function checkpointBalances(: Address, : UInt256) => (checkpointId: UInt256, value: UInt256)
function addModule(_moduleFactory: Address, _data: undefined, _maxCost: UInt256, _budget: UInt256) => void
function removeModule(_moduleType: UInt8, _moduleIndex: UInt8) => void
view function getModule(_moduleType: UInt8, _moduleIndex: UInt256) => (undefined, Address)
view function getModuleByName(_moduleType: UInt8, _name: undefined) => (undefined, Address)
function withdrawPoly(_amount: UInt256) => void
function changeModuleBudget(_moduleType: UInt8, _moduleIndex: UInt8, _budget: UInt256) => void
function updateTokenDetails(_newTokenDetails: String) => void
function changeGranularity(_granularity: UInt256) => void
function pruneInvestors(_start: UInt256, _iters: UInt256) => void
view function getInvestorsLength() => UInt256
function freezeTransfers() => void
function unfreezeTransfers() => void
function transfer(_to: Address, _value: UInt256) => success: Boolean
function transferFrom(_from: Address, _to: Address, _value: UInt256) => success: Boolean
function verifyTransfer(_from: Address, _to: Address, _amount: UInt256) => Boolean
function finishMintingIssuer() => void
function finishMintingSTO() => void
function mint(_investor: Address, _amount: UInt256) => success: Boolean
function mintMulti(_investors: undefined, _amounts: UInt256[]) => success: Boolean
view function checkPermission(_delegate: Address, _module: Address, _perm: undefined) => Boolean
function setTokenBurner(_tokenBurner: Address) => void
function burn(_value: UInt256) => void
function createCheckpoint() => UInt256
view function totalSupplyAt(_checkpointId: UInt256) => UInt256
view function balanceOfAt(_investor: Address, _checkpointId: UInt256) => UInt256
event LogModuleAdded(_type: UInt8, _name: undefined, _moduleFactory: Address, _module: Address, _moduleCost: UInt256, _budget: UInt256, _timestamp: UInt256)
event LogUpdateTokenDetails(_oldDetails: String, _newDetails: String)
event LogGranularityChanged(_oldGranularity: UInt256, _newGranularity: UInt256)
event LogModuleRemoved(_type: UInt8, _module: Address, _timestamp: UInt256)
event LogModuleBudgetChanged(_moduleType: UInt8, _module: Address, _budget: UInt256)
event LogFreezeTransfers(_freeze: Boolean, _timestamp: UInt256)
event LogCheckpointCreated(_checkpointId: UInt256, _timestamp: UInt256)
event LogFinishMintingIssuer(_timestamp: UInt256)
event LogFinishMintingSTO(_timestamp: UInt256)
event LogChangeSTRAddress(_oldAddress: Address, _newAddress: Address)
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransferred(previousOwner: Address, newOwner: Address)
event Minted(to: Address, amount: UInt256)
event Burnt(_burner: Address, _value: UInt256)
event Approval(owner: Address, spender: Address, value: UInt256)
event Transfer(from: Address, to: Address, value: UInt256)
#SecurityTokenRegistry
Description here
view function registrationFee() => UInt256
view function tickerRegistry() => Address
view function protocolVersion() => undefined
view function paused() => Boolean
view function polyToken() => Address
function renounceOwnership() => void
view function protocolVersionST(: undefined) => Address
view function polymathRegistry() => Address
function reclaimERC20(_tokenContract: Address) => void
view function owner() => Address
view function moduleRegistry() => Address
view function securityTokenRegistry() => Address
function transferOwnership(_newOwner: Address) => void
function updateFromRegistry() => void
function generateSecurityToken(_name: String, _symbol: String, _tokenDetails: String, _divisible: Boolean) => void
function addCustomSecurityToken(_name: String, _symbol: String, _owner: Address, _securityToken: Address, _tokenDetails: String, _swarmHash: undefined) => void
function setProtocolVersion(_stVersionProxyAddress: Address, _version: undefined) => void
view function getSecurityTokenAddress(_symbol: String) => Address
view function getSecurityTokenData(_securityToken: Address) => (String, Address, String)
view function isSecurityToken(_securityToken: Address) => Boolean
function changePolyRegistrationFee(_registrationFee: UInt256) => void
function unpause() => void
function pause() => void
event LogChangePolyRegistrationFee(_oldFee: UInt256, _newFee: UInt256)
event LogNewSecurityToken(_ticker: String, _securityTokenAddress: Address, _owner: Address)
event LogAddCustomSecurityToken(_name: String, _symbol: String, _securityToken: Address, _addedAt: UInt256)
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransferred(previousOwner: Address, newOwner: Address)
event Pause(_timestammp: UInt256)
event Unpause(_timestamp: UInt256)
#CappedSTO
Description here
view function rate() => UInt256
view function endTime() => UInt256
view function cap() => UInt256
function unpause() => void
view function tokensSold() => UInt256
view function wallet() => Address
view function paused() => Boolean
function takeFee(_amount: UInt256) => Boolean
view function fundsRaised() => UInt256
view function investors(: Address) => UInt256
view function polyToken() => Address
view function startTime() => UInt256
function pause() => void
function reclaimERC20(_tokenContract: Address) => void
view function verifyInvestment(_beneficiary: Address, _fundsAmount: UInt256) => Boolean
view function pausedTime() => UInt256
view function securityToken() => Address
view function factory() => Address
view function FEE_ADMIN() => undefined
view function investorCount() => UInt256
view function fundRaiseType(: UInt8) => Boolean
function configure(_startTime: UInt256, _endTime: UInt256, _cap: UInt256, _rate: UInt256, _fundRaiseType: UInt8, _fundsReceiver: Address) => void
function getInitFunction() => undefined
function buyTokens(_beneficiary: Address) => void
function buyTokensWithPoly(_investedPOLY: UInt256) => void
view function capReached() => Boolean
view function getRaisedEther() => UInt256
view function getRaisedPOLY() => UInt256
view function getNumberInvestors() => UInt256
view function getTokensSold() => UInt256
view function getPermissions() => undefined
view function getSTODetails() => (UInt256, UInt256, UInt256, UInt256, UInt256, UInt256, UInt256, Boolean)
event TokenPurchase(purchaser: Address, beneficiary: Address, value: UInt256, amount: UInt256)
event Pause(_timestammp: UInt256)
event Unpause(_timestamp: UInt256)
#GeneralTransferManager
Description here
view function allowAllBurnTransfers() => Boolean
view function WHITELIST() => undefined
view function allowAllWhitelistTransfers() => Boolean
function unpause() => void
view function paused() => Boolean
function takeFee(_amount: UInt256) => Boolean
view function polyToken() => Address
function pause() => void
view function FLAGS() => undefined
view function whitelist(: Address) => (fromTime: UInt256, toTime: UInt256, expiryTime: UInt256, canBuyFromSTO: Boolean)
view function allowAllTransfers() => Boolean
view function signingAddress() => Address
view function issuanceAddress() => Address
view function securityToken() => Address
view function factory() => Address
view function FEE_ADMIN() => undefined
view function allowAllWhitelistIssuances() => Boolean
function getInitFunction() => undefined
function changeIssuanceAddress(_issuanceAddress: Address) => void
function changeSigningAddress(_signingAddress: Address) => void
function changeAllowAllTransfers(_allowAllTransfers: Boolean) => void
function changeAllowAllWhitelistTransfers(_allowAllWhitelistTransfers: Boolean) => void
function changeAllowAllWhitelistIssuances(_allowAllWhitelistIssuances: Boolean) => void
function changeAllowAllBurnTransfers(_allowAllBurnTransfers: Boolean) => void
function verifyTransfer(_from: Address, _to: Address, : UInt256, : Boolean) => UInt8
function modifyWhitelist(_investor: Address, _fromTime: UInt256, _toTime: UInt256, _expiryTime: UInt256, _canBuyFromSTO: Boolean) => void
function modifyWhitelistMulti(_investors: undefined, _fromTimes: UInt256[], _toTimes: UInt256[], _expiryTimes: UInt256[], _canBuyFromSTO: undefined) => void
function modifyWhitelistSigned(_investor: Address, _fromTime: UInt256, _toTime: UInt256, _expiryTime: UInt256, _canBuyFromSTO: Boolean, _validFrom: UInt256, _validTo: UInt256, _v: UInt8, _r: undefined, _s: undefined) => void
view function getPermissions() => undefined
event LogChangeIssuanceAddress(_issuanceAddress: Address)
event LogAllowAllTransfers(_allowAllTransfers: Boolean)
event LogAllowAllWhitelistTransfers(_allowAllWhitelistTransfers: Boolean)
event LogAllowAllWhitelistIssuances(_allowAllWhitelistIssuances: Boolean)
event LogAllowAllBurnTransfers(_allowAllBurnTransfers: Boolean)
event LogChangeSigningAddress(_signingAddress: Address)
event LogModifyWhitelist(_investor: Address, _dateAdded: UInt256, _addedBy: Address, _fromTime: UInt256, _toTime: UInt256, _expiryTime: UInt256, _canBuyFromSTO: Boolean)
event Pause(_timestammp: UInt256)
event Unpause(_timestamp: UInt256)