Skip to content

curation API

Ezra Weller edited this page Nov 10, 2019 · 2 revisions

Version: Pre-alpha

Squad's curation market package is an automated token market generator built on Ethereum.

API

newBond(addressOfCurve, bondId, initialBuyNumber, opts)

Create a new "curved bond" (a token with an automatic buy/sell mechanism).

Inputs:

  • addressOfCurve: string (Ethereum address of the curve function to control price of the token, defaults to a simple linear "curve")
  • bondId: string (the string that will identify the token/market, usually derived from the metastore address)
  • initialBuyNumber: integer >= 0 (number of tokens to buy initially)
  • opts: web3 transaction object (this includes the tokens used to buy the initialBuyUnits)

Outputs: Ethereum transaction object

getSupply(bondId)

Check the number of tokens of a certain bondId that are in circulation.

Inputs: bondId (string)

Outputs: number of tokens in circulation

getBalance(bondId, holderAddress)

Check the number of a specific token an address holds.

Inputs:

  • bondId: string
  • holderAddress: Ethereum address

Outputs: number of tokens held by the address

getBuyPrice(units, bondId)

Check the cost of buying X of a specific token.

Inputs:

  • units: number of tokens to check the buy price of
  • `bondId: string

Outputs: Price of buying the tokens in Gwei

getSellPrice(units, bondId)

Check the sell price for X of a specific token.

Inputs:

  • units: number of tokens to check the buy price of
  • `bondId: string

Outputs: Amount that would be received for selling the tokens

buy(units, bondId, opts)

Buy X of a specific token.

Inputs:

  • units: number of tokens to check the buy price of
  • `bondId: string
  • opts: web3 transaction object (this includes the payment for the tokens)

Outputs: Ethereum transaction object

sell(units, bondId, opts)

Sell X of a specific token.

Inputs:

Outputs: Ethereum transaction object