polkamarkets-js 1.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/.openzeppelin/unknown-1337.json +2056 -0
  2. package/CONTRIBUTING.md +36 -0
  3. package/README.md +24 -25
  4. package/_book/README.md +590 -0
  5. package/_book/core.md +50 -0
  6. package/_book/gitbook/fonts/fontawesome/FontAwesome.otf +0 -0
  7. package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot +0 -0
  8. package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.svg +685 -0
  9. package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
  10. package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff +0 -0
  11. package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 +0 -0
  12. package/_book/gitbook/gitbook-plugin-fontsettings/fontsettings.js +240 -0
  13. package/_book/gitbook/gitbook-plugin-fontsettings/website.css +291 -0
  14. package/_book/gitbook/gitbook-plugin-highlight/ebook.css +135 -0
  15. package/_book/gitbook/gitbook-plugin-highlight/website.css +434 -0
  16. package/_book/gitbook/gitbook-plugin-lunr/lunr.min.js +7 -0
  17. package/_book/gitbook/gitbook-plugin-lunr/search-lunr.js +59 -0
  18. package/_book/gitbook/gitbook-plugin-search/lunr.min.js +7 -0
  19. package/_book/gitbook/gitbook-plugin-search/search-engine.js +50 -0
  20. package/_book/gitbook/gitbook-plugin-search/search.css +35 -0
  21. package/_book/gitbook/gitbook-plugin-search/search.js +213 -0
  22. package/_book/gitbook/gitbook-plugin-sharing/buttons.js +90 -0
  23. package/_book/gitbook/gitbook.js +4 -0
  24. package/_book/gitbook/images/apple-touch-icon-precomposed-152.png +0 -0
  25. package/_book/gitbook/images/favicon.ico +0 -0
  26. package/_book/gitbook/style.css +9 -0
  27. package/_book/gitbook/theme.js +4 -0
  28. package/_book/index.html +705 -0
  29. package/_book/intro.md +32 -0
  30. package/_book/search_index.json +1 -0
  31. package/book.json +8 -0
  32. package/build/contracts/AccessControl.json +1 -0
  33. package/build/contracts/AccessControlEnumerable.json +1 -0
  34. package/build/contracts/Achievements.json +1 -0
  35. package/build/contracts/Address.json +1 -0
  36. package/build/contracts/BalanceHolder.json +1 -0
  37. package/build/contracts/BalanceHolder_ERC20.json +1 -0
  38. package/build/contracts/CeilDiv.json +1 -0
  39. package/build/contracts/Clones.json +1 -0
  40. package/build/contracts/Context.json +1 -0
  41. package/build/contracts/Counters.json +1 -0
  42. package/build/contracts/ERC165.json +1 -0
  43. package/build/contracts/ERC20.json +1 -0
  44. package/build/contracts/ERC20Burnable.json +1 -0
  45. package/build/contracts/ERC20Pausable.json +1 -0
  46. package/build/contracts/ERC20PresetMinterPauser.json +1 -0
  47. package/build/contracts/ERC721.json +1 -0
  48. package/build/contracts/EnumerableMap.json +1 -0
  49. package/build/contracts/EnumerableSet.json +1 -0
  50. package/build/contracts/FantasyERC20.json +1 -0
  51. package/build/contracts/IAccessControl.json +1 -0
  52. package/build/contracts/IAccessControlEnumerable.json +1 -0
  53. package/build/contracts/IBalanceHolder_ERC20.json +1 -0
  54. package/build/contracts/IERC165.json +1 -0
  55. package/build/contracts/IERC20.json +1 -0
  56. package/build/contracts/IERC20Metadata.json +1 -0
  57. package/build/contracts/IERC20Permit.json +1 -0
  58. package/build/contracts/IERC721.json +1 -0
  59. package/build/contracts/IERC721Enumerable.json +1 -0
  60. package/build/contracts/IERC721Metadata.json +1 -0
  61. package/build/contracts/IERC721Receiver.json +1 -0
  62. package/build/contracts/IFantasyERC20.json +1 -0
  63. package/build/contracts/IPredictionMarketV3.json +1 -0
  64. package/build/contracts/IPredictionMarketV3Factory.json +1 -0
  65. package/build/contracts/IPredictionMarketV3Manager.json +1 -0
  66. package/build/contracts/IRealityETH_ERC20.json +1 -0
  67. package/build/contracts/IRealityETH_IERC20.json +1 -0
  68. package/build/contracts/IWETH.json +1 -0
  69. package/build/contracts/LandFactory.json +1 -0
  70. package/build/contracts/Math.json +1 -0
  71. package/build/contracts/Migrations.json +1 -0
  72. package/build/contracts/Ownable.json +1 -0
  73. package/build/contracts/Pausable.json +1 -0
  74. package/build/contracts/PredictionMarket.json +1 -0
  75. package/build/contracts/PredictionMarketV2.json +1 -0
  76. package/build/contracts/PredictionMarketV3.json +1 -0
  77. package/build/contracts/PredictionMarketV3Controller.json +1 -0
  78. package/build/contracts/PredictionMarketV3Factory.json +1 -0
  79. package/build/contracts/PredictionMarketV3Manager.json +1 -0
  80. package/build/contracts/PredictionMarketV3Querier.json +1 -0
  81. package/build/contracts/RealitioERC20.json +1 -0
  82. package/build/contracts/RealitioForeignArbitrationProxyWithAppeals.json +1 -0
  83. package/build/contracts/RealitioHomeArbitrationProxy.json +1 -0
  84. package/build/contracts/RealitioSafeMath256.json +1 -0
  85. package/build/contracts/RealitioSafeMath32.json +1 -0
  86. package/build/contracts/RealityETH_ERC20_Factory.json +1 -0
  87. package/build/contracts/RealityETH_ERC20_v3_0.json +1 -0
  88. package/build/contracts/ReentrancyGuard.json +1 -0
  89. package/build/contracts/SafeERC20.json +1 -0
  90. package/build/contracts/SafeMath.json +1 -0
  91. package/build/contracts/Strings.json +1 -0
  92. package/build/contracts/Voting.json +1 -0
  93. package/build/contracts/WETH9.json +1 -0
  94. package/build/contracts/test.json +1 -0
  95. package/cleanContracts.js +22 -0
  96. package/contracts/FantasyERC20.sol +81 -0
  97. package/contracts/IFantasyERC20.sol +20 -0
  98. package/contracts/IPredictionMarketV3.sol +207 -0
  99. package/contracts/IPredictionMarketV3Factory.sol +10 -0
  100. package/contracts/IPredictionMarketV3Manager.sol +12 -0
  101. package/contracts/IRealityETH_ERC20.sol +64 -0
  102. package/contracts/LandFactory.sol +248 -0
  103. package/contracts/Migrations.sol +24 -0
  104. package/contracts/PredictionMarketV3.sol +1332 -0
  105. package/contracts/PredictionMarketV3Controller.sol +87 -0
  106. package/contracts/PredictionMarketV3Factory.sol +205 -0
  107. package/contracts/PredictionMarketV3Manager.sol +45 -0
  108. package/contracts/PredictionMarketV3Querier.sol +79 -0
  109. package/contracts/RealityETH_ERC20_Factory.sol +54 -0
  110. package/contracts/Voting.sol +153 -0
  111. package/contracts/WETH9.sol +62 -0
  112. package/help.txt +8 -0
  113. package/index.js +3 -0
  114. package/migrations/10_deploy_weth.js +5 -0
  115. package/migrations/11_deploy_full_flow.js +99 -0
  116. package/migrations/12_deploy_pm_v3_querier.js +7 -0
  117. package/migrations/13_deploy_pm_v3_factory.js +14 -0
  118. package/migrations/1_initial_migration.js +5 -0
  119. package/migrations/2_deploy_erc20.js +10 -0
  120. package/migrations/3_deploy_realitio.js +11 -0
  121. package/migrations/4_deploy_pm.js +20 -0
  122. package/migrations/5_seed_markets.js +51 -0
  123. package/migrations/6_deploy_achievements.js +5 -0
  124. package/migrations/7_deploy_voting.js +14 -0
  125. package/migrations/8_deploy_pm_v2.js +20 -0
  126. package/migrations/9_seed_markets_v2.js +68 -0
  127. package/package.json +106 -13
  128. package/src/Application.js +421 -0
  129. package/src/interfaces/index.js +19 -0
  130. package/src/models/AchievementsContract.js +217 -0
  131. package/src/models/ArbitrationContract.js +69 -0
  132. package/src/models/ArbitrationProxyContract.js +32 -0
  133. package/src/models/ERC20Contract.js +156 -0
  134. package/src/models/FantasyERC20Contract.js +92 -0
  135. package/src/models/IContract.js +1002 -0
  136. package/src/models/PolkamarketsSmartAccount.js +100 -0
  137. package/src/models/PredictionMarketContract.js +562 -0
  138. package/src/models/PredictionMarketV2Contract.js +830 -0
  139. package/src/models/PredictionMarketV3Contract.js +233 -0
  140. package/src/models/PredictionMarketV3ControllerContract.js +102 -0
  141. package/src/models/PredictionMarketV3FactoryContract.js +96 -0
  142. package/src/models/PredictionMarketV3ManagerContract.js +111 -0
  143. package/src/models/PredictionMarketV3QuerierContract.js +24 -0
  144. package/src/models/RealitioERC20Contract.js +286 -0
  145. package/src/models/VotingContract.js +182 -0
  146. package/src/models/WETH9Contract.js +92 -0
  147. package/src/models/index.js +33 -0
  148. package/src/utils/Account.js +40 -0
  149. package/src/utils/Contract.js +120 -0
  150. package/src/utils/Numbers.js +94 -0
  151. package/tests/fantasyERC20Contract.js +225 -0
  152. package/tests/index.js +10 -0
  153. package/tests/predictionMarketContract.js +466 -0
  154. package/tests/predictionMarketV2Contract.js +1042 -0
  155. package/tests/predictionMarketV3Contract.js +1079 -0
  156. package/tests/predictionMarketV3ControllerContract.js +613 -0
  157. package/tests/predictionMarketV3FactoryContract.js +469 -0
  158. package/tests/predictionMarketV3ManagerContract.js +610 -0
  159. package/tests/utils.js +16 -0
  160. package/tests/votingContract.js +490 -0
  161. package/tooling/docs/jsdoc.json +6 -0
  162. package/truffle-config.js +134 -0
  163. package/polkamarkets.js +0 -436
@@ -0,0 +1,705 @@
1
+
2
+ <!DOCTYPE HTML>
3
+ <html lang="" >
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
7
+ <title>Introduction · GitBook</title>
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
9
+ <meta name="description" content="">
10
+ <meta name="generator" content="GitBook 3.2.2">
11
+
12
+
13
+
14
+
15
+ <link rel="stylesheet" href="gitbook/style.css">
16
+
17
+
18
+
19
+
20
+ <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
21
+
22
+
23
+
24
+ <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
25
+
26
+
27
+
28
+ <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+ <meta name="HandheldFriendly" content="true"/>
53
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
54
+ <meta name="apple-mobile-web-app-capable" content="yes">
55
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
56
+ <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
57
+ <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
58
+
59
+
60
+
61
+
62
+ </head>
63
+ <body>
64
+
65
+ <div class="book">
66
+ <div class="book-summary">
67
+
68
+
69
+ <div id="book-search-input" role="search">
70
+ <input type="text" placeholder="Type to search" />
71
+ </div>
72
+
73
+
74
+ <nav role="navigation">
75
+
76
+
77
+
78
+ <ul class="summary">
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+ <li class="chapter active" data-level="1.1" data-path="./">
89
+
90
+ <a href="./">
91
+
92
+
93
+ Introduction
94
+
95
+ </a>
96
+
97
+
98
+
99
+ </li>
100
+
101
+
102
+
103
+
104
+ <li class="divider"></li>
105
+
106
+ <li>
107
+ <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
108
+ Published with GitBook
109
+ </a>
110
+ </li>
111
+ </ul>
112
+
113
+
114
+ </nav>
115
+
116
+
117
+ </div>
118
+
119
+ <div class="book-body">
120
+
121
+ <div class="body-inner">
122
+
123
+
124
+
125
+ <div class="book-header" role="navigation">
126
+
127
+
128
+ <!-- Title -->
129
+ <h1>
130
+ <i class="fa fa-circle-o-notch fa-spin"></i>
131
+ <a href="." >Introduction</a>
132
+ </h1>
133
+ </div>
134
+
135
+
136
+
137
+
138
+ <div class="page-wrapper" tabindex="-1" role="main">
139
+ <div class="page-inner">
140
+
141
+ <div id="book-search-results">
142
+ <div class="search-noresults">
143
+
144
+ <section class="normal markdown-section">
145
+
146
+ <h2 id="classes">Classes</h2>
147
+ <dl>
148
+ <dt><a href="#FixedSwapContract">FixedSwapContract</a> : <code>Object</code></dt>
149
+ <dd></dd>
150
+ </dl>
151
+
152
+ <h2 id="functions">Functions</h2>
153
+ <dl>
154
+ <dt><a href="#setNewOwner">setNewOwner(address)</a></dt>
155
+ <dd><p>Set New Owner of the Contract</p>
156
+ </dd>
157
+ <dt><a href="#owner">owner()</a> &#x21D2; <code>string</code></dt>
158
+ <dd><p>Get Owner of the Contract</p>
159
+ </dd>
160
+ <dt><a href="#isPaused">isPaused()</a> &#x21D2; <code>boolean</code></dt>
161
+ <dd><p>Get Owner of the Contract</p>
162
+ </dd>
163
+ <dt><a href="#pauseContract">pauseContract()</a> &#x21D2; <code>admin</code></dt>
164
+ <dd><p>Pause Contract</p>
165
+ </dd>
166
+ <dt><a href="#unpauseContract">unpauseContract()</a> &#x21D2; <code>admin</code></dt>
167
+ <dd><p>Unpause Contract</p>
168
+ </dd>
169
+ <dt><a href="#tradeValue">tradeValue()</a> &#x21D2; <code>Integer</code></dt>
170
+ <dd><p>Get swapratio for the pool</p>
171
+ </dd>
172
+ <dt><a href="#startDate">startDate()</a> &#x21D2; <code>Date</code></dt>
173
+ <dd><p>Get Start Date of Pool</p>
174
+ </dd>
175
+ <dt><a href="#endDate">endDate()</a> &#x21D2; <code>Date</code></dt>
176
+ <dd><p>Get End Date of Pool</p>
177
+ </dd>
178
+ <dt><a href="#individualMinimumAmount">individualMinimumAmount()</a> &#x21D2; <code>Integer</code></dt>
179
+ <dd><p>Get Individual Minimum Amount for each address</p>
180
+ </dd>
181
+ <dt><a href="#individualMaximumAmount">individualMaximumAmount()</a> &#x21D2; <code>Integer</code></dt>
182
+ <dd><p>Get Individual Maximum Amount for each address</p>
183
+ </dd>
184
+ <dt><a href="#minimumRaise">minimumRaise()</a> &#x21D2; <code>Integer</code></dt>
185
+ <dd><p>Get Minimum Raise amount for Token Sale</p>
186
+ </dd>
187
+ <dt><a href="#tokensAllocated">tokensAllocated()</a> &#x21D2; <code>Integer</code></dt>
188
+ <dd><p>Get Total tokens Allocated already, therefore the tokens bought until now</p>
189
+ </dd>
190
+ <dt><a href="#tokensForSale">tokensForSale()</a> &#x21D2; <code>Integer</code></dt>
191
+ <dd><p>Get Total tokens Allocated/In Sale for the Pool</p>
192
+ </dd>
193
+ <dt><a href="#tokensAvailable">tokensAvailable()</a> &#x21D2; <code>Integer</code></dt>
194
+ <dd><p>Get Total tokens owned by the Pool</p>
195
+ </dd>
196
+ <dt><a href="#tokensLeft">tokensLeft()</a> &#x21D2; <code>Integer</code></dt>
197
+ <dd><p>Get Total tokens available to be sold in the pool</p>
198
+ </dd>
199
+ <dt><a href="#isTokenSwapAtomic">isTokenSwapAtomic()</a> &#x21D2; <code>Boolean</code></dt>
200
+ <dd><p>Verify if the Token Swap is atomic on this pool</p>
201
+ </dd>
202
+ <dt><a href="#isFunded">isFunded()</a> &#x21D2; <code>Boolean</code></dt>
203
+ <dd><p>Verify if the Token Sale is Funded with all Tokens proposed in tokensForSale</p>
204
+ </dd>
205
+ <dt><a href="#isOpen">isOpen()</a> &#x21D2; <code>Boolean</code></dt>
206
+ <dd><p>Verify if the Token Sale is Open for Swap</p>
207
+ </dd>
208
+ <dt><a href="#hasStarted">hasStarted()</a> &#x21D2; <code>Boolean</code></dt>
209
+ <dd><p>Verify if the Token Sale has started the Swap</p>
210
+ </dd>
211
+ <dt><a href="#hasFinalized">hasFinalized()</a> &#x21D2; <code>Boolean</code></dt>
212
+ <dd><p>Verify if the Token Sale has finalized, if the current date is after endDate</p>
213
+ </dd>
214
+ <dt><a href="#isPreStart">isPreStart()</a> &#x21D2; <code>Boolean</code></dt>
215
+ <dd><p>Verify if the Token Sale in not open yet, where the admin can fund the pool</p>
216
+ </dd>
217
+ <dt><a href="#getPurchase">getPurchase(purchase_id)</a> &#x21D2; <code>Integer</code> | <code>Integer</code> | <code>Address</code> | <code>Integer</code> | <code>Date</code> | <code>Boolean</code> | <code>Boolean</code></dt>
218
+ <dd><p>Get Purchase based on ID</p>
219
+ </dd>
220
+ <dt><a href="#getBuyers">getBuyers()</a> &#x21D2; <code>Array</code> | <code>Integer</code></dt>
221
+ <dd><p>Get Buyers</p>
222
+ </dd>
223
+ <dt><a href="#getPurchaseIds">getPurchaseIds()</a> &#x21D2; <code>Array</code> | <code>Integer</code></dt>
224
+ <dd><p>Get All Purchase Ids</p>
225
+ </dd>
226
+ <dt><a href="#getPurchaseIds">getPurchaseIds(address)</a> &#x21D2; <code>Array</code> | <code>Integer</code></dt>
227
+ <dd><p>Get All Purchase Ids filter by Address/Purchaser</p>
228
+ </dd>
229
+ <dt><a href="#getETHCostFromTokens">getETHCostFromTokens(tokenAmount)</a> &#x21D2; <code>Integer</code></dt>
230
+ <dd><p>Get ETH Cost from Tokens Amount</p>
231
+ </dd>
232
+ <dt><a href="#swap">swap(tokenAmount)</a></dt>
233
+ <dd><p>Swap tokens by Ethereum</p>
234
+ </dd>
235
+ <dt><a href="#redeemTokens(isStandard)">redeemTokens(purchase_id)</a></dt>
236
+ <dd><p>Reedem tokens bought</p>
237
+ </dd>
238
+ <dt><a href="#redeemGivenMinimumGoalNotAchieved(isStandard)">redeemGivenMinimumGoalNotAchieved(purchase_id)</a></dt>
239
+ <dd><p>Reedem Ethereum from sale that did not achieve minimum goal</p>
240
+ </dd>
241
+ <dt><a href="#withdrawUnsoldTokens">withdrawUnsoldTokens()</a> &#x21D2; <code>admin</code></dt>
242
+ <dd><p>Withdraw unsold tokens of sale</p>
243
+ </dd>
244
+ <dt><a href="#withdrawFunds">withdrawFunds()</a> &#x21D2; <code>admin</code></dt>
245
+ <dd><p>Withdraw all funds from tokens sold</p>
246
+ </dd>
247
+ <dt><a href="#approveFundERC20">approveFundERC20()</a> &#x21D2; <code>admin</code></dt>
248
+ <dd><p>Approve the pool to use approved tokens for sale</p>
249
+ </dd>
250
+ <dt><a href="#isApproved">isApproved(tokenAmount, address)</a> &#x21D2; <code>admin</code> | <code>Boolean</code></dt>
251
+ <dd><p>Verify if the Admin has approved the pool to use receive the tokens for sale</p>
252
+ </dd>
253
+ <dt><a href="#fund">fund(tokenAmount)</a> &#x21D2; <code>admin</code></dt>
254
+ <dd><p>Send tokens to pool for sale, fund the sale</p>
255
+ </dd>
256
+ <dt><a href="#removeOtherERC20Tokens">removeOtherERC20Tokens(tokenAddress, toAddress)</a> &#x21D2; <code>admin</code></dt>
257
+ <dd><p>Remove Tokens from other ERC20 Address (in case of accident)</p>
258
+ </dd>
259
+ <dt><a href="#deploy">deploy(tradeValue, tokensForSale, startDate, endDate, individualMinimumAmount, individualMaximumAmount, isTokenSwapAtomic, minimumRaise, feeAmount)</a> &#x21D2; <code>admin</code></dt>
260
+ <dd><p>Deploy the Pool Contract</p>
261
+ </dd>
262
+ <dt><a href="#getOwner">getOwner(Address)</a> &#x21D2; <code>admin</code></dt>
263
+ <dd><p>Get owner address of contract</p>
264
+ </dd>
265
+ </dl>
266
+
267
+ <p><a name="FixedSwapContract"></a></p>
268
+ <h2 id="fixedswapcontract--object">FixedSwapContract : <code>Object</code></h2>
269
+ <p><strong>Kind</strong>: global class<br><a name="new_FixedSwapContract_new"></a></p>
270
+ <h3 id="new-fixedswapcontractweb3-tokenaddress-decimals-contractaddress">new FixedSwapContract(web3, tokenAddress, decimals, contractAddress)</h3>
271
+ <p>Fixed Swap Object</p>
272
+ <table>
273
+ <thead>
274
+ <tr>
275
+ <th>Param</th>
276
+ <th>Type</th>
277
+ <th>Description</th>
278
+ </tr>
279
+ </thead>
280
+ <tbody>
281
+ <tr>
282
+ <td>web3</td>
283
+ <td><code>Web3</code></td>
284
+ <td></td>
285
+ </tr>
286
+ <tr>
287
+ <td>tokenAddress</td>
288
+ <td><code>Address</code></td>
289
+ <td></td>
290
+ </tr>
291
+ <tr>
292
+ <td>decimals</td>
293
+ <td><code>Integer</code></td>
294
+ <td></td>
295
+ </tr>
296
+ <tr>
297
+ <td>contractAddress</td>
298
+ <td><code>Address</code></td>
299
+ <td>? (opt)</td>
300
+ </tr>
301
+ </tbody>
302
+ </table>
303
+ <p><a name="setNewOwner"></a></p>
304
+ <h2 id="setnewowneraddress">setNewOwner(address)</h2>
305
+ <p>Set New Owner of the Contract</p>
306
+ <p><strong>Kind</strong>: global function </p>
307
+ <table>
308
+ <thead>
309
+ <tr>
310
+ <th>Param</th>
311
+ <th>Type</th>
312
+ </tr>
313
+ </thead>
314
+ <tbody>
315
+ <tr>
316
+ <td>address</td>
317
+ <td><code>string</code></td>
318
+ </tr>
319
+ </tbody>
320
+ </table>
321
+ <p><a name="owner"></a></p>
322
+ <h2 id="owner-&#x21D2;-string">owner() &#x21D2; <code>string</code></h2>
323
+ <p>Get Owner of the Contract</p>
324
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>string</code> - address<br><a name="isPaused"></a></p>
325
+ <h2 id="ispaused-&#x21D2;-boolean">isPaused() &#x21D2; <code>boolean</code></h2>
326
+ <p>Get Owner of the Contract</p>
327
+ <p><strong>Kind</strong>: global function<br><a name="pauseContract"></a></p>
328
+ <h2 id="pausecontract-&#x21D2;-admin">pauseContract() &#x21D2; <code>admin</code></h2>
329
+ <p>Pause Contract</p>
330
+ <p><strong>Kind</strong>: global function<br><a name="unpauseContract"></a></p>
331
+ <h2 id="unpausecontract-&#x21D2;-admin">unpauseContract() &#x21D2; <code>admin</code></h2>
332
+ <p>Unpause Contract</p>
333
+ <p><strong>Kind</strong>: global function<br><a name="tradeValue"></a></p>
334
+ <h2 id="tradevalue-&#x21D2;-integer">tradeValue() &#x21D2; <code>Integer</code></h2>
335
+ <p>Get swapratio for the pool</p>
336
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - trade value against ETH<br><a name="startDate"></a></p>
337
+ <h2 id="startdate-&#x21D2;-date">startDate() &#x21D2; <code>Date</code></h2>
338
+ <p>Get Start Date of Pool</p>
339
+ <p><strong>Kind</strong>: global function<br><a name="endDate"></a></p>
340
+ <h2 id="enddate-&#x21D2;-date">endDate() &#x21D2; <code>Date</code></h2>
341
+ <p>Get End Date of Pool</p>
342
+ <p><strong>Kind</strong>: global function<br><a name="individualMinimumAmount"></a></p>
343
+ <h2 id="individualminimumamount-&#x21D2;-integer">individualMinimumAmount() &#x21D2; <code>Integer</code></h2>
344
+ <p>Get Individual Minimum Amount for each address</p>
345
+ <p><strong>Kind</strong>: global function<br><a name="individualMaximumAmount"></a></p>
346
+ <h2 id="individualmaximumamount-&#x21D2;-integer">individualMaximumAmount() &#x21D2; <code>Integer</code></h2>
347
+ <p>Get Individual Maximum Amount for each address</p>
348
+ <p><strong>Kind</strong>: global function<br><a name="minimumRaise"></a></p>
349
+ <h2 id="minimumraise-&#x21D2;-integer">minimumRaise() &#x21D2; <code>Integer</code></h2>
350
+ <p>Get Minimum Raise amount for Token Sale</p>
351
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - Amount in Tokens<br><a name="tokensAllocated"></a></p>
352
+ <h2 id="tokensallocated-&#x21D2;-integer">tokensAllocated() &#x21D2; <code>Integer</code></h2>
353
+ <p>Get Total tokens Allocated already, therefore the tokens bought until now</p>
354
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - Amount in Tokens<br><a name="tokensForSale"></a></p>
355
+ <h2 id="tokensforsale-&#x21D2;-integer">tokensForSale() &#x21D2; <code>Integer</code></h2>
356
+ <p>Get Total tokens Allocated/In Sale for the Pool</p>
357
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - Amount in Tokens<br><a name="tokensAvailable"></a></p>
358
+ <h2 id="tokensavailable-&#x21D2;-integer">tokensAvailable() &#x21D2; <code>Integer</code></h2>
359
+ <p>Get Total tokens owned by the Pool</p>
360
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - Amount in Tokens<br><a name="tokensLeft"></a></p>
361
+ <h2 id="tokensleft-&#x21D2;-integer">tokensLeft() &#x21D2; <code>Integer</code></h2>
362
+ <p>Get Total tokens available to be sold in the pool</p>
363
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - Amount in Tokens<br><a name="isTokenSwapAtomic"></a></p>
364
+ <h2 id="istokenswapatomic-&#x21D2;-boolean">isTokenSwapAtomic() &#x21D2; <code>Boolean</code></h2>
365
+ <p>Verify if the Token Swap is atomic on this pool</p>
366
+ <p><strong>Kind</strong>: global function<br><a name="isFunded"></a></p>
367
+ <h2 id="isfunded-&#x21D2;-boolean">isFunded() &#x21D2; <code>Boolean</code></h2>
368
+ <p>Verify if the Token Sale is Funded with all Tokens proposed in tokensForSale</p>
369
+ <p><strong>Kind</strong>: global function<br><a name="isOpen"></a></p>
370
+ <h2 id="isopen-&#x21D2;-boolean">isOpen() &#x21D2; <code>Boolean</code></h2>
371
+ <p>Verify if the Token Sale is Open for Swap</p>
372
+ <p><strong>Kind</strong>: global function<br><a name="hasStarted"></a></p>
373
+ <h2 id="hasstarted-&#x21D2;-boolean">hasStarted() &#x21D2; <code>Boolean</code></h2>
374
+ <p>Verify if the Token Sale has started the Swap</p>
375
+ <p><strong>Kind</strong>: global function<br><a name="hasFinalized"></a></p>
376
+ <h2 id="hasfinalized-&#x21D2;-boolean">hasFinalized() &#x21D2; <code>Boolean</code></h2>
377
+ <p>Verify if the Token Sale has finalized, if the current date is after endDate</p>
378
+ <p><strong>Kind</strong>: global function<br><a name="isPreStart"></a></p>
379
+ <h2 id="isprestart-&#x21D2;-boolean">isPreStart() &#x21D2; <code>Boolean</code></h2>
380
+ <p>Verify if the Token Sale in not open yet, where the admin can fund the pool</p>
381
+ <p><strong>Kind</strong>: global function<br><a name="getPurchase"></a></p>
382
+ <h2 id="getpurchasepurchaseid-&#x21D2;-integer--integer--address--integer--date--boolean--boolean">getPurchase(purchase_id) &#x21D2; <code>Integer</code> | <code>Integer</code> | <code>Address</code> | <code>Integer</code> | <code>Date</code> | <code>Boolean</code> | <code>Boolean</code></h2>
383
+ <p>Get Purchase based on ID</p>
384
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - _id<code>Integer</code> - amount<code>Address</code> - purchaser<code>Integer</code> - ethAmount<code>Date</code> - timestamp<code>Boolean</code> - wasFinalized<code>Boolean</code> - reverted </p>
385
+ <table>
386
+ <thead>
387
+ <tr>
388
+ <th>Param</th>
389
+ <th>Type</th>
390
+ </tr>
391
+ </thead>
392
+ <tbody>
393
+ <tr>
394
+ <td>purchase_id</td>
395
+ <td><code>Integer</code></td>
396
+ </tr>
397
+ </tbody>
398
+ </table>
399
+ <p><a name="getBuyers"></a></p>
400
+ <h2 id="getbuyers-&#x21D2;-array--integer">getBuyers() &#x21D2; <code>Array</code> | <code>Integer</code></h2>
401
+ <p>Get Buyers</p>
402
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Array</code> | <code>Integer</code> - _ids<br><a name="getPurchaseIds"></a></p>
403
+ <h2 id="getpurchaseids-&#x21D2;-array--integer">getPurchaseIds() &#x21D2; <code>Array</code> | <code>Integer</code></h2>
404
+ <p>Get All Purchase Ids</p>
405
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Array</code> | <code>Integer</code> - _ids<br><a name="getPurchaseIds"></a></p>
406
+ <h2 id="getpurchaseidsaddress-&#x21D2;-array--integer">getPurchaseIds(address) &#x21D2; <code>Array</code> | <code>Integer</code></h2>
407
+ <p>Get All Purchase Ids filter by Address/Purchaser</p>
408
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Array</code> | <code>Integer</code> - _ids </p>
409
+ <table>
410
+ <thead>
411
+ <tr>
412
+ <th>Param</th>
413
+ <th>Type</th>
414
+ </tr>
415
+ </thead>
416
+ <tbody>
417
+ <tr>
418
+ <td>address</td>
419
+ <td><code>Address</code></td>
420
+ </tr>
421
+ </tbody>
422
+ </table>
423
+ <p><a name="getETHCostFromTokens"></a></p>
424
+ <h2 id="getethcostfromtokenstokenamount-&#x21D2;-integer">getETHCostFromTokens(tokenAmount) &#x21D2; <code>Integer</code></h2>
425
+ <p>Get ETH Cost from Tokens Amount</p>
426
+ <p><strong>Kind</strong>: global function<br><strong>Returns</strong>: <code>Integer</code> - ethAmount </p>
427
+ <table>
428
+ <thead>
429
+ <tr>
430
+ <th>Param</th>
431
+ <th>Type</th>
432
+ </tr>
433
+ </thead>
434
+ <tbody>
435
+ <tr>
436
+ <td>tokenAmount</td>
437
+ <td><code>Integer</code></td>
438
+ </tr>
439
+ </tbody>
440
+ </table>
441
+ <p><a name="swap"></a></p>
442
+ <h2 id="swaptokenamount">swap(tokenAmount)</h2>
443
+ <p>Swap tokens by Ethereum</p>
444
+ <p><strong>Kind</strong>: global function </p>
445
+ <table>
446
+ <thead>
447
+ <tr>
448
+ <th>Param</th>
449
+ <th>Type</th>
450
+ </tr>
451
+ </thead>
452
+ <tbody>
453
+ <tr>
454
+ <td>tokenAmount</td>
455
+ <td><code>Integer</code></td>
456
+ </tr>
457
+ </tbody>
458
+ </table>
459
+ <p><a name="redeemTokens(isStandard)"></a></p>
460
+ <h2 id="redeemtokenspurchaseid">redeemTokens(purchase_id)</h2>
461
+ <p>Reedem tokens bought</p>
462
+ <p><strong>Kind</strong>: global function </p>
463
+ <table>
464
+ <thead>
465
+ <tr>
466
+ <th>Param</th>
467
+ <th>Type</th>
468
+ </tr>
469
+ </thead>
470
+ <tbody>
471
+ <tr>
472
+ <td>purchase_id</td>
473
+ <td><code>Integer</code></td>
474
+ </tr>
475
+ </tbody>
476
+ </table>
477
+ <p><a name="redeemGivenMinimumGoalNotAchieved(isStandard)"></a></p>
478
+ <h2 id="redeemgivenminimumgoalnotachievedpurchaseid">redeemGivenMinimumGoalNotAchieved(purchase_id)</h2>
479
+ <p>Reedem Ethereum from sale that did not achieve minimum goal</p>
480
+ <p><strong>Kind</strong>: global function </p>
481
+ <table>
482
+ <thead>
483
+ <tr>
484
+ <th>Param</th>
485
+ <th>Type</th>
486
+ </tr>
487
+ </thead>
488
+ <tbody>
489
+ <tr>
490
+ <td>purchase_id</td>
491
+ <td><code>Integer</code></td>
492
+ </tr>
493
+ </tbody>
494
+ </table>
495
+ <p><a name="withdrawUnsoldTokens"></a></p>
496
+ <h2 id="withdrawunsoldtokens-&#x21D2;-admin">withdrawUnsoldTokens() &#x21D2; <code>admin</code></h2>
497
+ <p>Withdraw unsold tokens of sale</p>
498
+ <p><strong>Kind</strong>: global function<br><a name="withdrawFunds"></a></p>
499
+ <h2 id="withdrawfunds-&#x21D2;-admin">withdrawFunds() &#x21D2; <code>admin</code></h2>
500
+ <p>Withdraw all funds from tokens sold</p>
501
+ <p><strong>Kind</strong>: global function<br><a name="approveFundERC20"></a></p>
502
+ <h2 id="approvefunderc20-&#x21D2;-admin">approveFundERC20() &#x21D2; <code>admin</code></h2>
503
+ <p>Approve the pool to use approved tokens for sale</p>
504
+ <p><strong>Kind</strong>: global function<br><a name="isApproved"></a></p>
505
+ <h2 id="isapprovedtokenamount-address-&#x21D2;-admin--boolean">isApproved(tokenAmount, address) &#x21D2; <code>admin</code> | <code>Boolean</code></h2>
506
+ <p>Verify if the Admin has approved the pool to use receive the tokens for sale</p>
507
+ <p><strong>Kind</strong>: global function </p>
508
+ <table>
509
+ <thead>
510
+ <tr>
511
+ <th>Param</th>
512
+ <th>Type</th>
513
+ </tr>
514
+ </thead>
515
+ <tbody>
516
+ <tr>
517
+ <td>tokenAmount</td>
518
+ <td><code>Integer</code></td>
519
+ </tr>
520
+ <tr>
521
+ <td>address</td>
522
+ <td><code>Address</code></td>
523
+ </tr>
524
+ </tbody>
525
+ </table>
526
+ <p><a name="fund"></a></p>
527
+ <h2 id="fundtokenamount-&#x21D2;-admin">fund(tokenAmount) &#x21D2; <code>admin</code></h2>
528
+ <p>Send tokens to pool for sale, fund the sale</p>
529
+ <p><strong>Kind</strong>: global function </p>
530
+ <table>
531
+ <thead>
532
+ <tr>
533
+ <th>Param</th>
534
+ <th>Type</th>
535
+ </tr>
536
+ </thead>
537
+ <tbody>
538
+ <tr>
539
+ <td>tokenAmount</td>
540
+ <td><code>Integer</code></td>
541
+ </tr>
542
+ </tbody>
543
+ </table>
544
+ <p><a name="removeOtherERC20Tokens"></a></p>
545
+ <h2 id="removeothererc20tokenstokenaddress-toaddress-&#x21D2;-admin">removeOtherERC20Tokens(tokenAddress, toAddress) &#x21D2; <code>admin</code></h2>
546
+ <p>Remove Tokens from other ERC20 Address (in case of accident)</p>
547
+ <p><strong>Kind</strong>: global function </p>
548
+ <table>
549
+ <thead>
550
+ <tr>
551
+ <th>Param</th>
552
+ <th>Type</th>
553
+ </tr>
554
+ </thead>
555
+ <tbody>
556
+ <tr>
557
+ <td>tokenAddress</td>
558
+ <td><code>Address</code></td>
559
+ </tr>
560
+ <tr>
561
+ <td>toAddress</td>
562
+ <td><code>Address</code></td>
563
+ </tr>
564
+ </tbody>
565
+ </table>
566
+ <p><a name="deploy"></a></p>
567
+ <h2 id="deploytradevalue-tokensforsale-startdate-enddate-individualminimumamount-individualmaximumamount-istokenswapatomic-minimumraise-feeamount-&#x21D2;-admin">deploy(tradeValue, tokensForSale, startDate, endDate, individualMinimumAmount, individualMaximumAmount, isTokenSwapAtomic, minimumRaise, feeAmount) &#x21D2; <code>admin</code></h2>
568
+ <p>Deploy the Pool Contract</p>
569
+ <p><strong>Kind</strong>: global function </p>
570
+ <table>
571
+ <thead>
572
+ <tr>
573
+ <th>Param</th>
574
+ <th>Type</th>
575
+ </tr>
576
+ </thead>
577
+ <tbody>
578
+ <tr>
579
+ <td>tradeValue</td>
580
+ <td><code>Integer</code></td>
581
+ </tr>
582
+ <tr>
583
+ <td>tokensForSale</td>
584
+ <td><code>Integer</code></td>
585
+ </tr>
586
+ <tr>
587
+ <td>startDate</td>
588
+ <td><code>Date</code></td>
589
+ </tr>
590
+ <tr>
591
+ <td>endDate</td>
592
+ <td><code>Date</code></td>
593
+ </tr>
594
+ <tr>
595
+ <td>individualMinimumAmount</td>
596
+ <td><code>Integer</code></td>
597
+ </tr>
598
+ <tr>
599
+ <td>individualMaximumAmount</td>
600
+ <td><code>Integer</code></td>
601
+ </tr>
602
+ <tr>
603
+ <td>isTokenSwapAtomic</td>
604
+ <td><code>Boolean</code></td>
605
+ </tr>
606
+ <tr>
607
+ <td>minimumRaise</td>
608
+ <td><code>Integer</code></td>
609
+ </tr>
610
+ <tr>
611
+ <td>feeAmount</td>
612
+ <td><code>Integer</code></td>
613
+ </tr>
614
+ </tbody>
615
+ </table>
616
+ <p><a name="getOwner"></a></p>
617
+ <h2 id="getowneraddress-&#x21D2;-admin">getOwner(Address) &#x21D2; <code>admin</code></h2>
618
+ <p>Get owner address of contract</p>
619
+ <p><strong>Kind</strong>: global function </p>
620
+ <table>
621
+ <thead>
622
+ <tr>
623
+ <th>Param</th>
624
+ <th>Type</th>
625
+ </tr>
626
+ </thead>
627
+ <tbody>
628
+ <tr>
629
+ <td>Address</td>
630
+ <td><code>Address</code></td>
631
+ </tr>
632
+ </tbody>
633
+ </table>
634
+
635
+
636
+ </section>
637
+
638
+ </div>
639
+ <div class="search-results">
640
+ <div class="has-results">
641
+
642
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
643
+ <ul class="search-results-list"></ul>
644
+
645
+ </div>
646
+ <div class="no-results">
647
+
648
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
649
+
650
+ </div>
651
+ </div>
652
+ </div>
653
+
654
+ </div>
655
+ </div>
656
+
657
+ </div>
658
+
659
+
660
+
661
+
662
+
663
+
664
+ </div>
665
+
666
+ <script>
667
+ var gitbook = gitbook || [];
668
+ gitbook.push(function() {
669
+ gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"dir":"ltr"},"config":{"plugins":[],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"api.md","glossary":"GLOSSARY.md","summary":"toc.md"},"variables":{},"gitbook":"3.2.2"},"file":{"path":"api.md","mtime":"2020-12-03T00:18:53.031Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2020-12-16T10:25:24.316Z"},"basePath":".","book":{"language":""}});
670
+ });
671
+ </script>
672
+ </div>
673
+
674
+
675
+ <script src="gitbook/gitbook.js"></script>
676
+ <script src="gitbook/theme.js"></script>
677
+
678
+
679
+ <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
680
+
681
+
682
+
683
+ <script src="gitbook/gitbook-plugin-search/search.js"></script>
684
+
685
+
686
+
687
+ <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
688
+
689
+
690
+
691
+ <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
692
+
693
+
694
+
695
+ <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
696
+
697
+
698
+
699
+ <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
700
+
701
+
702
+
703
+ </body>
704
+ </html>
705
+