@leofcoin/chain 1.0.10 → 1.0.13

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 (132) hide show
  1. package/dist/node.browser.js +1055 -1047
  2. package/dist/node.browser.min.js +1 -1
  3. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/chain.js.html +0 -0
  4. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_factory.js.html +0 -0
  5. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_nameService.js.html +0 -0
  6. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_proxies_factoryProxy.js.html +0 -0
  7. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_proxies_nameServiceProxy.js.html +0 -0
  8. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_proxies_nativeTokenProxy.js.html +0 -0
  9. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_proxies_validatorsProxy.js.html +0 -0
  10. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_proxies_votingProxy.js.html +0 -0
  11. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/contracts_validators.js.html +0 -0
  12. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Bold-webfont.eot +0 -0
  13. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Bold-webfont.svg +0 -0
  14. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Bold-webfont.woff +0 -0
  15. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  16. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-BoldItalic-webfont.svg +0 -0
  17. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  18. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Italic-webfont.eot +0 -0
  19. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Italic-webfont.svg +0 -0
  20. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Italic-webfont.woff +0 -0
  21. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Light-webfont.eot +0 -0
  22. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Light-webfont.svg +0 -0
  23. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Light-webfont.woff +0 -0
  24. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  25. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-LightItalic-webfont.svg +0 -0
  26. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  27. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Regular-webfont.eot +0 -0
  28. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Regular-webfont.svg +0 -0
  29. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Regular-webfont.woff +0 -0
  30. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Semibold-webfont.eot +0 -0
  31. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Semibold-webfont.svg +0 -0
  32. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  33. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-Semibold-webfont.woff +0 -0
  34. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  35. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -0
  36. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  37. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  38. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/global.html +0 -0
  39. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/icons/home.svg +0 -0
  40. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/icons/search.svg +0 -0
  41. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/index.html +0 -0
  42. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/machine.js.html +0 -0
  43. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/scripts/linenumber.js +0 -0
  44. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/scripts/pagelocation.js +0 -0
  45. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/standards_roles.js.html +0 -0
  46. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/standards_token.js.html +0 -0
  47. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/styles/collapse.css +0 -0
  48. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/styles/jsdoc-default.css +0 -0
  49. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/styles/prettify-jsdoc.css +0 -0
  50. package/docs/@leofcoin/chain/{1.0.7 → 1.0.12}/styles/prettify-tomorrow.css +0 -0
  51. package/package.json +2 -2
  52. package/rollup.config.js +0 -42
  53. package/_node.js +0 -1
  54. package/chain.js +0 -938
  55. package/docs/@leofcoin/chain/1.0.8/chain.js.html +0 -738
  56. package/docs/@leofcoin/chain/1.0.8/contracts_factory.js.html +0 -182
  57. package/docs/@leofcoin/chain/1.0.8/contracts_nameService.js.html +0 -231
  58. package/docs/@leofcoin/chain/1.0.8/contracts_proxies_factoryProxy.js.html +0 -135
  59. package/docs/@leofcoin/chain/1.0.8/contracts_proxies_nameServiceProxy.js.html +0 -135
  60. package/docs/@leofcoin/chain/1.0.8/contracts_proxies_nativeTokenProxy.js.html +0 -135
  61. package/docs/@leofcoin/chain/1.0.8/contracts_proxies_validatorsProxy.js.html +0 -135
  62. package/docs/@leofcoin/chain/1.0.8/contracts_proxies_votingProxy.js.html +0 -135
  63. package/docs/@leofcoin/chain/1.0.8/contracts_validators.js.html +0 -242
  64. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Bold-webfont.eot +0 -0
  65. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Bold-webfont.svg +0 -1830
  66. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Bold-webfont.woff +0 -0
  67. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  68. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  69. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  70. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Italic-webfont.eot +0 -0
  71. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Italic-webfont.svg +0 -1830
  72. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Italic-webfont.woff +0 -0
  73. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Light-webfont.eot +0 -0
  74. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Light-webfont.svg +0 -1831
  75. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Light-webfont.woff +0 -0
  76. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  77. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  78. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  79. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Regular-webfont.eot +0 -0
  80. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Regular-webfont.svg +0 -1831
  81. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Regular-webfont.woff +0 -0
  82. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Semibold-webfont.eot +0 -0
  83. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Semibold-webfont.svg +0 -1830
  84. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  85. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-Semibold-webfont.woff +0 -0
  86. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  87. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
  88. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  89. package/docs/@leofcoin/chain/1.0.8/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  90. package/docs/@leofcoin/chain/1.0.8/global.html +0 -1153
  91. package/docs/@leofcoin/chain/1.0.8/icons/home.svg +0 -4
  92. package/docs/@leofcoin/chain/1.0.8/icons/search.svg +0 -4
  93. package/docs/@leofcoin/chain/1.0.8/index.html +0 -125
  94. package/docs/@leofcoin/chain/1.0.8/machine.js.html +0 -252
  95. package/docs/@leofcoin/chain/1.0.8/scripts/linenumber.js +0 -23
  96. package/docs/@leofcoin/chain/1.0.8/scripts/pagelocation.js +0 -89
  97. package/docs/@leofcoin/chain/1.0.8/standards_roles.js.html +0 -188
  98. package/docs/@leofcoin/chain/1.0.8/standards_token.js.html +0 -260
  99. package/docs/@leofcoin/chain/1.0.8/styles/collapse.css +0 -27
  100. package/docs/@leofcoin/chain/1.0.8/styles/jsdoc-default.css +0 -953
  101. package/docs/@leofcoin/chain/1.0.8/styles/prettify-jsdoc.css +0 -111
  102. package/docs/@leofcoin/chain/1.0.8/styles/prettify-tomorrow.css +0 -138
  103. package/lib.js +0 -1
  104. package/out/@leofcoin/chain/1.0.7/chain.js.html +0 -645
  105. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.eot +0 -0
  106. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.svg +0 -1830
  107. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.woff +0 -0
  108. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  109. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  110. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  111. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.eot +0 -0
  112. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.svg +0 -1830
  113. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.woff +0 -0
  114. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.eot +0 -0
  115. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.svg +0 -1831
  116. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.woff +0 -0
  117. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  118. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  119. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  120. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.eot +0 -0
  121. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.svg +0 -1831
  122. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.woff +0 -0
  123. package/out/@leofcoin/chain/1.0.7/global.html +0 -477
  124. package/out/@leofcoin/chain/1.0.7/index.html +0 -69
  125. package/out/@leofcoin/chain/1.0.7/machine.js.html +0 -180
  126. package/out/@leofcoin/chain/1.0.7/scripts/linenumber.js +0 -25
  127. package/out/@leofcoin/chain/1.0.7/scripts/prettify/Apache-License-2.0.txt +0 -202
  128. package/out/@leofcoin/chain/1.0.7/scripts/prettify/lang-css.js +0 -2
  129. package/out/@leofcoin/chain/1.0.7/scripts/prettify/prettify.js +0 -28
  130. package/out/@leofcoin/chain/1.0.7/styles/jsdoc-default.css +0 -358
  131. package/out/@leofcoin/chain/1.0.7/styles/prettify-jsdoc.css +0 -111
  132. package/out/@leofcoin/chain/1.0.7/styles/prettify-tomorrow.css +0 -132
@@ -1,188 +0,0 @@
1
-
2
-
3
- <!DOCTYPE html>
4
- <html lang="en">
5
- <head>
6
-
7
- <meta charset="utf-8">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
-
10
- <title>
11
- standards/roles.js - Documentation
12
- </title>
13
-
14
- <link href="https://www.braintreepayments.com/images/favicon-ccda0b14.png" rel="icon" type="image/png">
15
-
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
17
- <script>hljs.initHighlightingOnLoad();</script>
18
-
19
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
20
-
21
- <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
22
- <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
23
-
24
- <link type="text/css" rel="stylesheet" href="styles/collapse.css">
25
-
26
-
27
-
28
-
29
- <!-- start Mixpanel -->
30
- <script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
31
- 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
32
- for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
33
- mixpanel.init("1919205b2da72e4da3b9b6639b444d59");</script>
34
- <!-- end Mixpanel -->
35
- </head>
36
-
37
- <body>
38
- <svg style="display: none;">
39
- <defs>
40
- <symbol id="linkIcon" fill="#706d77" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
41
- <path d="M0 0h24v24H0z" fill="none"/>
42
- <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
43
- </symbol>
44
- </defs>
45
- </svg>
46
-
47
- <input type="checkbox" id="nav-trigger" class="nav-trigger" />
48
- <label for="nav-trigger" class="navicon-button x">
49
- <div class="navicon"></div>
50
- </label>
51
-
52
- <label for="nav-trigger" class="overlay"></label>
53
-
54
- <div class="top-nav-wrapper">
55
- <ul>
56
- <li >
57
- <a href="index.html">
58
-
59
- <svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
60
- <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
61
- <path d="M0 0h24v24H0z" fill="none"/>
62
- </svg>
63
-
64
-
65
- </a>
66
- </li>
67
-
68
-
69
-
70
- </ul>
71
- </div>
72
-
73
- <nav>
74
- <h3 class="reference-title">
75
- @leofcoin/chain
76
- </h3>
77
-
78
-
79
- <h3>
80
- Resources
81
- </h3>
82
-
83
- <a href="https://github.com/arteontoken/monorepo/chain">github</a>
84
-
85
-
86
-
87
- <h3 id="global-nav">Global</h3><ul><li><a href="global.html#addContract">addContract</a></li><li><a href="global.html#createTransaction">createTransaction</a></li><li><a href="global.html#createTransactionFrom">createTransactionFrom</a></li><li><a href="global.html#deployContract">deployContract</a></li><li><a href="global.html#lookup">lookup</a></li><li><a href="global.html#state">state</a></li></ul>
88
- </nav>
89
-
90
- <div id="main">
91
-
92
- <h1 class="page-title">
93
- standards/roles.js
94
- </h1>
95
-
96
-
97
-
98
-
99
-
100
- <section>
101
- <article>
102
- <pre class="prettyprint source linenums"><code>export default class Roles {
103
-
104
- /**
105
- * Object => Array
106
- */
107
- #roles = {
108
- 'OWNER': [],
109
- 'MINT': [],
110
- 'BURN': []
111
- }
112
-
113
- constructor(roles) {
114
- // allow devs to set their own roles but always keep the default ones included
115
- // also allows roles to be loaded from the stateStore
116
- // carefull when includin gthe roles make sure to add the owner
117
- // since no roles are granted by default when using custom roles
118
- if (roles) {
119
- if (roles instanceof Object) {
120
- this.#roles = {...roles, ...this.#roles}
121
- } else {
122
- throw new Error(`expected roles to be an object`)
123
- }
124
- } else {
125
- // no roles given so default to the msg sender
126
- this.#grantRole(msg.sender, 'OWNER')
127
- }
128
- }
129
-
130
- get state() {
131
- return { roles: this.roles }
132
- }
133
-
134
- get roles() {
135
- return {...this.#roles}
136
- }
137
-
138
- hasRole(address, role) {
139
- return this.#roles[role] ? this.#roles[role].indexOf(address) !== -1 : false
140
- }
141
-
142
- #grantRole(address, role) {
143
- if (this.hasRole(address, role)) throw new Error(`${role} role already granted for ${address}`)
144
-
145
- this.#roles[role].push(address)
146
- }
147
-
148
- #revokeRole(address, role) {
149
- if (!this.hasRole(address, role)) throw new Error(`${role} role already revoked for ${address}`)
150
- if (role === 'OWNER' &amp;&amp; this.#roles[role].length === 1) throw new Error(`atleast one owner is needed!`)
151
-
152
- this.#roles[role].splice(this.#roles[role].indexOf(address))
153
- }
154
-
155
- grantRole(address, role) {
156
- if (!this.hasRole(address, 'OWNER')) throw new Error('Not allowed')
157
-
158
- this.#grantRole(address, role)
159
- }
160
-
161
- revokeRole(address, role) {
162
- if (!this.hasRole(address, 'OWNER')) throw new Error('Not allowed')
163
-
164
- this.#revokeRole(address, role)
165
- }
166
- }
167
- </code></pre>
168
- </article>
169
- </section>
170
-
171
-
172
-
173
-
174
- </div>
175
-
176
- <br class="clear">
177
-
178
- <footer>
179
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a>
180
- </footer>
181
-
182
- <script src="scripts/linenumber.js"></script>
183
- <script src="scripts/pagelocation.js"></script>
184
-
185
-
186
-
187
- </body>
188
- </html>
@@ -1,260 +0,0 @@
1
-
2
-
3
- <!DOCTYPE html>
4
- <html lang="en">
5
- <head>
6
-
7
- <meta charset="utf-8">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
-
10
- <title>
11
- standards/token.js - Documentation
12
- </title>
13
-
14
- <link href="https://www.braintreepayments.com/images/favicon-ccda0b14.png" rel="icon" type="image/png">
15
-
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
17
- <script>hljs.initHighlightingOnLoad();</script>
18
-
19
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
20
-
21
- <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
22
- <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
23
-
24
- <link type="text/css" rel="stylesheet" href="styles/collapse.css">
25
-
26
-
27
-
28
-
29
- <!-- start Mixpanel -->
30
- <script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
31
- 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
32
- for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
33
- mixpanel.init("1919205b2da72e4da3b9b6639b444d59");</script>
34
- <!-- end Mixpanel -->
35
- </head>
36
-
37
- <body>
38
- <svg style="display: none;">
39
- <defs>
40
- <symbol id="linkIcon" fill="#706d77" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
41
- <path d="M0 0h24v24H0z" fill="none"/>
42
- <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
43
- </symbol>
44
- </defs>
45
- </svg>
46
-
47
- <input type="checkbox" id="nav-trigger" class="nav-trigger" />
48
- <label for="nav-trigger" class="navicon-button x">
49
- <div class="navicon"></div>
50
- </label>
51
-
52
- <label for="nav-trigger" class="overlay"></label>
53
-
54
- <div class="top-nav-wrapper">
55
- <ul>
56
- <li >
57
- <a href="index.html">
58
-
59
- <svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
60
- <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
61
- <path d="M0 0h24v24H0z" fill="none"/>
62
- </svg>
63
-
64
-
65
- </a>
66
- </li>
67
-
68
-
69
-
70
- </ul>
71
- </div>
72
-
73
- <nav>
74
- <h3 class="reference-title">
75
- @leofcoin/chain
76
- </h3>
77
-
78
-
79
- <h3>
80
- Resources
81
- </h3>
82
-
83
- <a href="https://github.com/arteontoken/monorepo/chain">github</a>
84
-
85
-
86
-
87
- <h3 id="global-nav">Global</h3><ul><li><a href="global.html#addContract">addContract</a></li><li><a href="global.html#createTransaction">createTransaction</a></li><li><a href="global.html#createTransactionFrom">createTransactionFrom</a></li><li><a href="global.html#deployContract">deployContract</a></li><li><a href="global.html#lookup">lookup</a></li><li><a href="global.html#state">state</a></li></ul>
88
- </nav>
89
-
90
- <div id="main">
91
-
92
- <h1 class="page-title">
93
- standards/token.js
94
- </h1>
95
-
96
-
97
-
98
-
99
-
100
- <section>
101
- <article>
102
- <pre class="prettyprint source linenums"><code>import Roles from './roles.js'
103
-
104
- export default class Token extends Roles {
105
- /**
106
- * string
107
- */
108
- #name
109
- /**
110
- * String
111
- */
112
- #symbol
113
- /**
114
- * uint
115
- */
116
- #holders = 0
117
- /**
118
- * Object => Object => uint
119
- */
120
- #balances = {}
121
- /**
122
- * Object => Object => uint
123
- */
124
- #approvals = {}
125
-
126
- #decimals = 18
127
-
128
- #totalSupply = BigNumber.from(0)
129
-
130
- // this.#privateField2 = 1
131
- constructor(name, symbol, decimals = 18, state) {
132
- if (!name) throw new Error(`name undefined`)
133
- if (!symbol) throw new Error(`symbol undefined`)
134
-
135
- super(state?.roles)
136
-
137
- this.#name = name
138
- this.#symbol = symbol
139
- this.#decimals = decimals
140
- }
141
-
142
- // enables snapshotting
143
- // needs dev attention so nothing breaks after snapshot happens
144
- // iow everything that is not static needs to be included in the stateObject
145
- /**
146
- * @return {Object} {holders, balances, ...}
147
- */
148
- get state() {
149
- return {
150
- ...super.state,
151
- holders: this.holders,
152
- balances: this.balances,
153
- approvals: { ...this.#approvals },
154
- totalSupply: this.totalSupply
155
- }
156
- }
157
-
158
- get totalSupply() {
159
- return this.#totalSupply
160
- }
161
-
162
- get name() {
163
- return this.#name
164
- }
165
-
166
- get symbol() {
167
- return this.#symbol
168
- }
169
-
170
- get holders() {
171
- return this.#holders
172
- }
173
-
174
- get balances() {
175
- return {...this.#balances}
176
- }
177
-
178
- mint(to, amount) {
179
- if (!this.hasRole(msg.sender, 'MINT')) throw new Error('not allowed')
180
-
181
- this.#totalSupply = this.#totalSupply.add(amount)
182
- this.#increaseBalance(to, amount)
183
- }
184
-
185
- burn(to, amount) {
186
- if (!this.hasRole(msg.sender, 'BURN')) throw new Error('not allowed')
187
-
188
- this.#totalSupply = this.#totalSupply.sub(amount)
189
- this.#decreaseBalance(to, amount)
190
- }
191
-
192
- #beforeTransfer(from, to, amount) {
193
- if (!this.#balances[from] || this.#balances[from] &lt; amount) throw new Error('amount exceeds balance')
194
- }
195
-
196
- #updateHolders(address, previousBalance) {
197
- if (this.#balances[address].toHexString() === '0x00') this.#holders -= 1
198
- else if (this.#balances[address].toHexString() !== '0x00' &amp;&amp; previousBalance.toHexString() === '0x00') this.#holders += 1
199
- }
200
-
201
- #increaseBalance(address, amount) {
202
- if (!this.#balances[address]) this.#balances[address] = BigNumber.from(0)
203
- const previousBalance = this.#balances[address]
204
-
205
- this.#balances[address] = this.#balances[address].add(amount)
206
- this.#updateHolders(address, previousBalance)
207
- }
208
-
209
- #decreaseBalance(address, amount) {
210
- const previousBalance = this.#balances[address]
211
- this.#balances[address] = this.#balances[address].sub(amount)
212
- this.#updateHolders(address, previousBalance)
213
- }
214
-
215
- balanceOf(address) {
216
- return this.#balances[address]
217
- }
218
-
219
- setApproval(operator, amount) {
220
- const owner = globalThis.msg.sender
221
- if (!this.#approvals[owner]) this.#approvals[owner] = {}
222
- this.#approvals[owner][operator] = amount
223
- }
224
-
225
- approved(owner, operator, amount) {
226
- return this.#approvals[owner][operator] === amount
227
- }
228
-
229
- transfer(from, to, amount) {
230
- // TODO: is BigNumber?
231
- amount = BigNumber.from(amount)
232
- this.#beforeTransfer(from, to, amount)
233
- this.#decreaseBalance(from, amount)
234
- this.#increaseBalance(to, amount)
235
- }
236
-
237
-
238
- }
239
- </code></pre>
240
- </article>
241
- </section>
242
-
243
-
244
-
245
-
246
- </div>
247
-
248
- <br class="clear">
249
-
250
- <footer>
251
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a>
252
- </footer>
253
-
254
- <script src="scripts/linenumber.js"></script>
255
- <script src="scripts/pagelocation.js"></script>
256
-
257
-
258
-
259
- </body>
260
- </html>
@@ -1,27 +0,0 @@
1
- @media only screen and (min-width: 681px) {
2
- nav > ul > li:hover .methods,
3
- .active .methods {
4
- display: block;
5
- }
6
-
7
- .methods {
8
- display: none;
9
- }
10
-
11
- nav > ul > li {
12
- padding: 20px 0;
13
- }
14
-
15
- nav > ul > li > a {
16
- padding: 0;
17
- }
18
-
19
- nav > ul > li.active a {
20
- margin-bottom: 10px;
21
- }
22
-
23
- nav > ul > li:hover > a,
24
- nav > ul > li.active > a {
25
- margin-bottom: 15px;
26
- }
27
- }