# API

## FixedSwapContract

**Kind**: global class<br>

### 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<br>

## isPaused() ⇒ `boolean`

Get Owner of the Contract

**Kind**: global function<br>

## pauseContract() ⇒ `admin`

Pause Contract

**Kind**: global function<br>

## erc20() ⇒ `Address`

Get Token Address

**Kind**: global function\
**Returns**: `Address` - Token Address<br>

## decimals() ⇒ `Integer`

Get Decimals

**Kind**: global function\
**Returns**: `Integer` - Integer<br>

## unpauseContract() ⇒ `admin`

Unpause Contract

**Kind**: global function<br>

## tradeValue() ⇒ `Integer`

Get swapratio for the pool

**Kind**: global function\
**Returns**: `Integer` - trade value against ETH<br>

## startDate() ⇒ `Date`

Get Start Date of Pool

**Kind**: global function<br>

## endDate() ⇒ `Date`

Get End Date of Pool

**Kind**: global function<br>

## isFinalized() ⇒ `Boolean`

To see if contract was finalized

**Kind**: global function<br>

## individualMinimumAmount() ⇒ `Integer`

Get Individual Minimum Amount for each address

**Kind**: global function<br>

## individualMaximumAmount() ⇒ `Integer`

Get Individual Maximum Amount for each address

**Kind**: global function<br>

## minimumRaiseAchieved() ⇒ `Boolean`

Was Minimum Raise Achieved

**Kind**: global function<br>

## minimumRaise() ⇒ `Integer`

Get Minimum Raise amount for Token Sale

**Kind**: global function\
**Returns**: `Integer` - Amount in Tokens<br>

## tokensAllocated() ⇒ `Integer`

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

**Kind**: global function\
**Returns**: `Integer` - Amount in Tokens<br>

## tokensForSale() ⇒ `Integer`

Get Total tokens Allocated/In Sale for the Pool

**Kind**: global function\
**Returns**: `Integer` - Amount in Tokens<br>

## hasMinimumRaise() ⇒ `Boolea`

See if hasMinimumRaise

**Kind**: global function<br>

## minimumReached() ⇒ `Integer`

See if minimumRaise was Reached

**Kind**: global function<br>

## tokensAvailable() ⇒ `Integer`

Get Total tokens owned by the Pool

**Kind**: global function\
**Returns**: `Integer` - Amount in Tokens<br>

## tokensLeft() ⇒ `Integer`

Get Total tokens available to be sold in the pool

**Kind**: global function\
**Returns**: `Integer` - Amount in Tokens<br>

## withdrawableUnsoldTokens() ⇒ `Integer`

Get Total tokens available to be withdrawn by the admin

**Kind**: global function\
**Returns**: `Integer` - Amount in Tokens<br>

## withdrawableFunds() ⇒ `Integer`

Get Total funds raised to be withdrawn by the admin

**Kind**: global function\
**Returns**: `Integer` - Amount in ETH<br>

## isTokenSwapAtomic() ⇒ `Boolean`

Verify if the Token Swap is atomic on this pool

**Kind**: global function<br>

## hasWhitelisting() ⇒ `Boolean`

Verify if swap has whitelisting

**Kind**: global function<br>

## isWhitelisted() ⇒ `Boolean`

Verify if address is whitelisted

**Kind**: global function<br>

## wereUnsoldTokensReedemed() ⇒ `Boolean`

Verify if the admin already reemeded unsold tokens

**Kind**: global function<br>

## isFunded() ⇒ `Boolean`

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

**Kind**: global function<br>

## isOpen() ⇒ `Boolean`

Verify if the Token Sale is Open for Swap

**Kind**: global function<br>

## hasStarted() ⇒ `Boolean`

Verify if the Token Sale has started the Swap

**Kind**: global function<br>

## hasFinalized() ⇒ `Boolean`

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

**Kind**: global function<br>

## isPreStart() ⇒ `Boolean`

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

**Kind**: global function<br>

## getPurchase(purchase\_id) ⇒ `Integer` | `Integer` | `Address` | `Integer` | `Date` | `Boolean` | `Boolean`

Get Purchase based on ID

**Kind**: global function\
**Returns**: `Integer` - \_id`Integer` - amount`Address` - purchaser`Integer` - ethAmount`Date` - timestamp`Boolean` - wasFinalized`Boolean` - reverted

| Param        | Type      |
| ------------ | --------- |
| purchase\_id | `Integer` |

## getWhiteListedAddresses() ⇒ `Array` | `Address`

Get Whitelisted Addresses

**Kind**: global function\
**Returns**: `Array` | `Address` - addresses<br>

## getBuyers() ⇒ `Array` | `Integer`

Get Buyers

**Kind**: global function\
**Returns**: `Array` | `Integer` - \_ids<br>

## getPurchaseIds() ⇒ `Array` | `Integer`

Get All Purchase Ids

**Kind**: global function\
**Returns**: `Array` | `Integer` - \_ids<br>

## 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<br>

## withdrawFunds()

Withdraw all funds from tokens sold

**Kind**: global function<br>

## approveFundERC20()

Approve the pool to use approved tokens for sale

**Kind**: global function<br>

## 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<br>

## safePull()

Safe Pull all tokens & ETH

**Kind**: global function<br>

## 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<br>

## 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` |
