LogoLogo
  • Home
  • History of Polkastarter
  • Key Features
  • What Problem is Polkastarter solving?
  • What is a Fixed Swap Pool?
  • What are the benefits of Fixed Swaps?
  • Polkastarter’s NFT Sales Platform
  • Polkastarter Gaming
  • What is the POLS Token Utility?
  • What are the Tokenomics?
  • polkastarter-js
    • Introduction
    • API
Powered by GitBook
On this page
  • FixedSwapContract
  • new FixedSwapContract(web3, tokenAddress, decimals, contractAddress)
  • setNewOwner(address)
  • owner() ⇒ string
  • isPaused() ⇒ boolean
  • pauseContract() ⇒ admin
  • erc20() ⇒ Address
  • decimals() ⇒ Integer
  • unpauseContract() ⇒ admin
  • tradeValue() ⇒ Integer
  • startDate() ⇒ Date
  • endDate() ⇒ Date
  • isFinalized() ⇒ Boolean
  • individualMinimumAmount() ⇒ Integer
  • individualMaximumAmount() ⇒ Integer
  • minimumRaiseAchieved() ⇒ Boolean
  • minimumRaise() ⇒ Integer
  • tokensAllocated() ⇒ Integer
  • tokensForSale() ⇒ Integer
  • hasMinimumRaise() ⇒ Boolea
  • minimumReached() ⇒ Integer
  • tokensAvailable() ⇒ Integer
  • tokensLeft() ⇒ Integer
  • withdrawableUnsoldTokens() ⇒ Integer
  • withdrawableFunds() ⇒ Integer
  • isTokenSwapAtomic() ⇒ Boolean
  • hasWhitelisting() ⇒ Boolean
  • isWhitelisted() ⇒ Boolean
  • wereUnsoldTokensReedemed() ⇒ Boolean
  • isFunded() ⇒ Boolean
  • isOpen() ⇒ Boolean
  • hasStarted() ⇒ Boolean
  • hasFinalized() ⇒ Boolean
  • isPreStart() ⇒ Boolean
  • getPurchase(purchase_id) ⇒ Integer | Integer | Address | Integer | Date | Boolean | Boolean
  • getWhiteListedAddresses() ⇒ Array | Address
  • getBuyers() ⇒ Array | Integer
  • getPurchaseIds() ⇒ Array | Integer
  • getPurchaseIds(address) ⇒ Array | Integer
  • getETHCostFromTokens(tokenAmount) ⇒ Integer
  • swap(tokenAmount)
  • redeemTokens(purchase_id)
  • redeemGivenMinimumGoalNotAchieved(purchase_id)
  • withdrawUnsoldTokens()
  • withdrawFunds()
  • approveFundERC20()
  • isApproved(tokenAmount, address) ⇒ Boolean
  • fund(tokenAmount)
  • addWhitelistedAddress(Addresses)
  • removeWhitelistedAddress()
  • safePull()
  • removeOtherERC20Tokens(tokenAddress, toAddress)
  • deploy()
  • getOwner(Address)
  • getBalance(Balance)
  1. polkastarter-js

API

FixedSwapContract

Kind: global class

new FixedSwapContract(web3, tokenAddress, decimals, contractAddress)

Fixed Swap Object

Param

Type

Description

web3

Web3

tokenAddress

Address

decimals

Integer

contractAddress

Address

? (opt)

setNewOwner(address)

Set New Owner of the Contract

Kind: global function

Param

Type

address

string

owner() ⇒ string

Get Owner of the Contract

Kind: global function Returns: string - address

isPaused() ⇒ boolean

Get Owner of the Contract

Kind: global function

pauseContract() ⇒ admin

Pause Contract

Kind: global function

erc20() ⇒ Address

Get Token Address

Kind: global function Returns: Address - Token Address

decimals() ⇒ Integer

Get Decimals

Kind: global function Returns: Integer - Integer

unpauseContract() ⇒ admin

Unpause Contract

Kind: global function

tradeValue() ⇒ Integer

Get swapratio for the pool

Kind: global function Returns: Integer - trade value against ETH

startDate() ⇒ Date

Get Start Date of Pool

Kind: global function

endDate() ⇒ Date

Get End Date of Pool

Kind: global function

isFinalized() ⇒ Boolean

To see if contract was finalized

Kind: global function

individualMinimumAmount() ⇒ Integer

Get Individual Minimum Amount for each address

Kind: global function

individualMaximumAmount() ⇒ Integer

Get Individual Maximum Amount for each address

Kind: global function

minimumRaiseAchieved() ⇒ Boolean

Was Minimum Raise Achieved

Kind: global function

minimumRaise() ⇒ Integer

Get Minimum Raise amount for Token Sale

Kind: global function Returns: Integer - Amount in Tokens

tokensAllocated() ⇒ Integer

Get Total tokens Allocated already, therefore the tokens bought until now

Kind: global function Returns: Integer - Amount in Tokens

tokensForSale() ⇒ Integer

Get Total tokens Allocated/In Sale for the Pool

Kind: global function Returns: Integer - Amount in Tokens

hasMinimumRaise() ⇒ Boolea

See if hasMinimumRaise

Kind: global function

minimumReached() ⇒ Integer

See if minimumRaise was Reached

Kind: global function

tokensAvailable() ⇒ Integer

Get Total tokens owned by the Pool

Kind: global function Returns: Integer - Amount in Tokens

tokensLeft() ⇒ Integer

Get Total tokens available to be sold in the pool

Kind: global function Returns: Integer - Amount in Tokens

withdrawableUnsoldTokens() ⇒ Integer

Get Total tokens available to be withdrawn by the admin

Kind: global function Returns: Integer - Amount in Tokens

withdrawableFunds() ⇒ Integer

Get Total funds raised to be withdrawn by the admin

Kind: global function Returns: Integer - Amount in ETH

isTokenSwapAtomic() ⇒ Boolean

Verify if the Token Swap is atomic on this pool

Kind: global function

hasWhitelisting() ⇒ Boolean

Verify if swap has whitelisting

Kind: global function

isWhitelisted() ⇒ Boolean

Verify if address is whitelisted

Kind: global function

wereUnsoldTokensReedemed() ⇒ Boolean

Verify if the admin already reemeded unsold tokens

Kind: global function

isFunded() ⇒ Boolean

Verify if the Token Sale is Funded with all Tokens proposed in tokensForSale

Kind: global function

isOpen() ⇒ Boolean

Verify if the Token Sale is Open for Swap

Kind: global function

hasStarted() ⇒ Boolean

Verify if the Token Sale has started the Swap

Kind: global function

hasFinalized() ⇒ Boolean

Verify if the Token Sale has finalized, if the current date is after endDate

Kind: global function

isPreStart() ⇒ Boolean

Verify if the Token Sale in not open yet, where the admin can fund the pool

Kind: global function

getPurchase(purchase_id) ⇒ Integer | Integer | Address | Integer | Date | Boolean | Boolean

Get Purchase based on ID

Kind: global function Returns: Integer - _idInteger - amountAddress - purchaserInteger - ethAmountDate - timestampBoolean - wasFinalizedBoolean - reverted

Param

Type

purchase_id

Integer

getWhiteListedAddresses() ⇒ Array | Address

Get Whitelisted Addresses

Kind: global function Returns: Array | Address - addresses

getBuyers() ⇒ Array | Integer

Get Buyers

Kind: global function Returns: Array | Integer - _ids

getPurchaseIds() ⇒ Array | Integer

Get All Purchase Ids

Kind: global function Returns: Array | Integer - _ids

getPurchaseIds(address) ⇒ Array | Integer

Get All Purchase Ids filter by Address/Purchaser

Kind: global function Returns: Array | Integer - _ids

Param

Type

address

Address

getETHCostFromTokens(tokenAmount) ⇒ Integer

Get ETH Cost from Tokens Amount

Kind: global function Returns: Integer - ethAmount

Param

Type

tokenAmount

Integer

swap(tokenAmount)

Swap tokens by Ethereum

Kind: global function

Param

Type

tokenAmount

Integer

redeemTokens(purchase_id)

Reedem tokens bought

Kind: global function

Param

Type

purchase_id

Integer

redeemGivenMinimumGoalNotAchieved(purchase_id)

Reedem Ethereum from sale that did not achieve minimum goal

Kind: global function

Param

Type

purchase_id

Integer

withdrawUnsoldTokens()

Withdraw unsold tokens of sale

Kind: global function

withdrawFunds()

Withdraw all funds from tokens sold

Kind: global function

approveFundERC20()

Approve the pool to use approved tokens for sale

Kind: global function

isApproved(tokenAmount, address) ⇒ Boolean

Verify if the Admin has approved the pool to use receive the tokens for sale

Kind: global function

Param

Type

tokenAmount

Integer

address

Address

fund(tokenAmount)

Send tokens to pool for sale, fund the sale

Kind: global function

Param

Type

tokenAmount

Integer

addWhitelistedAddress(Addresses)

add WhiteListed Address

Kind: global function

Param

Type

Addresses

Array | Addresses

removeWhitelistedAddress()

remove WhiteListed Address

Kind: global function

safePull()

Safe Pull all tokens & ETH

Kind: global function

removeOtherERC20Tokens(tokenAddress, toAddress)

Remove Tokens from other ERC20 Address (in case of accident)

Kind: global function

Param

Type

tokenAddress

Address

toAddress

Address

deploy()

Deploy the Pool Contract

Kind: global function

getOwner(Address)

Get owner address of contract

Kind: global function

Param

Type

Address

Address

getBalance(Balance)

Get Balance of Contract

Kind: global function

Param

Type

Balance

Integer

PreviousIntroduction

Last updated 4 years ago