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

PolyToken: Contract {
  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
Transfer: Event {
  from: Address
  to: Address
  value: Uint256
}
// When an address approves an allowance
Transfer: Event {
  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

Methods

registrationFee

Returns the fee in POLY that is required to reserve a ticker

registrationFee() => fee:Number

registerTicker

Reserves a ticker to owner. Requires allowance of at least the registration fee in POLY to be approved. See approve() and allowance()

registerTicker(owner:Address, symbol:String, tokenName:String, swarmHash:String) => void

Emits:

getDetails

Returns the owner and timestamp for a given symbol (ticker)

getDetails(symbol:String) => [address:String, timestamp:Number, tokenName:String, swarmHash:String, status:Boolean]

Events

LogRegisterTicker

When a ticker gets registered

Values:

  • _owner:Address
  • _symbol:String
  • _name:String
  • _swarmHash:String
  • _timestamp:Number

Unused but worth mentioning methods

  • isReserved

Clone this wiki locally