Skip to content

Smart Contracts

Rafael Vidaurre edited this page Sep 28, 2018 · 23 revisions

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

Types

TODO: Explain types from-to JS

General

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
}

TickerRegistry

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
}

CappedSTOFactory

Factory for deploying a CappedSTOModule. TODO: Define CappedSTO

class CappedSTOFactory { // Cost to deploy this STO module setupCost: Uint256 }

Clone this wiki locally