Repository: status-im/status-network-token Branch: master Commit: cea17ed3d445 Files: 52 Total size: 292.8 KB Directory structure: gitextract_uyqsp8mt/ ├── .babelrc ├── .eslintrc ├── .flake8 ├── .gitignore ├── .pylintrc ├── .travis.yml ├── INSTRUCTIONS.md ├── LICENSE ├── MINIME_README.md ├── MULTISIG.md ├── README.md ├── SPEC.md ├── audits/ │ ├── BlockchainLabs-SNT-audit-report.md │ └── prelim-smartcontractsolutions-ef163f1b6fd6fb0630a4b8c78d3b706f3fe1da33.md ├── contracts/ │ ├── ContributionWallet.sol │ ├── DevTokensHolder.sol │ ├── DynamicCeiling.sol │ ├── ERC20Token.sol │ ├── MiniMeToken.sol │ ├── MultiSigWallet.sol │ ├── Owned.sol │ ├── SGT.sol │ ├── SGTExchanger.sol │ ├── SNT.sol │ ├── SNTPlaceHolder.sol │ ├── SafeMath.sol │ ├── StatusContribution.sol │ └── test/ │ ├── DevTokensHolderMock.sol │ ├── ExternalToken.sol │ ├── Migrations.sol │ ├── SGTExchangerMock.sol │ ├── SGTMock.sol │ ├── SNTMock.sol │ ├── SNTPlaceHolderMock.sol │ └── StatusContributionMock.sol ├── migrations/ │ ├── 1_initial_migration.js │ └── 2_deploy_contracts.js ├── mypy.ini ├── package.json ├── scripts/ │ ├── ceiling_curve_calc.py │ └── sgtGeneration/ │ ├── deploy.js │ ├── deploy_test.js │ ├── initialBalance.csv │ └── loadBalances.js ├── test/ │ ├── claimExternal.js │ ├── contribution.js │ ├── dynamicCeiling.js │ └── helpers/ │ ├── assertFail.js │ ├── assertGas.js │ ├── assertJump.js │ └── hiddenCurves.js └── truffle.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc ================================================ { "presets": ["es2015", "stage-2", "stage-3"] } ================================================ FILE: .eslintrc ================================================ { "env": { "browser": true, "es6": true, "node": true, "mocha": true }, "extends": "airbnb", "parser": "babel-eslint", "rules": { // indentation "indent": [ 2, 4 ], // spacing "template-curly-spacing": [ 2, "always" ], "array-bracket-spacing": [ 2, "always" ], "object-curly-spacing": [ 2, "always" ], "computed-property-spacing": [ 2, "always" ], "no-multiple-empty-lines": [ 2, { "max": 1, "maxEOF": 0, "maxBOF": 0 } ], // strings "quotes": [ 2, "double", "avoid-escape" ], // code arrangement matter "no-use-before-define": [ 2, { "functions": false } ], // make it meaningful "prefer-const": 1, // keep it simple "complexity": [ 1, 5 ], // Consisten return "consistent-return": 0, "import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js", "**/compile.js", "**/test/*.js"]}], // react "react/prefer-es6-class": 0, "react/jsx-filename-extension": 0, "react/jsx-indent": [ 2, 4 ] }, "globals": { "artifacts": true, "web3": true, "contract": true, "assert": true } } ================================================ FILE: .flake8 ================================================ [flake8] max-line-length = 99 ================================================ FILE: .gitignore ================================================ node_modules/ build/ .DS_Store .mypy_cache __pycache__ ================================================ FILE: .pylintrc ================================================ [BASIC] good-names=i,j,k,n,ex,Run,_ [FORMAT] max-line-length = 99 disable=locally-disabled,locally-enabled ================================================ FILE: .travis.yml ================================================ dist: 'trusty' group: 'beta' language: 'node_js' sudo: false node_js: - '8' cache: yarn: true script: - 'truffle compile' - 'testrpc --network-id 15 --mnemonic ''status mnemonic status mnemonic status mnemonic status mnemonic status mnemonic status mnemonic'' > /dev/null &' - 'truffle test --network development' - 'truffle migrate --reset --network development_migrate' ================================================ FILE: INSTRUCTIONS.md ================================================ ## Before starting * Install `yarn` and `npm`. * Run `yarn` at the repo root. * Use the same BIP39 compatible mnemonic in both `truffle.js` (can be set by environment variable `TEST_MNEMONIC`) and for your client. * Change the `from` key in `truffle.js` for any network that requires it. * Compile contracts: ``` ./node_modules/.bin/truffle compile ``` * Start your Ethereum client: ``` ./node_modules/.bin/testrpc --network-id 15 --mnemonic 'status mnemonic status mnemonic status mnemonic status mnemonic status mnemonic status mnemonic' ``` ## Run tests * Run tests ``` ./node_modules/.bin/truffle test --network development ``` ## Deploy * Change the config constants in `migrations/2_deploy_contracts.js` to match your addresses and parameters. * Deploy contracts (choose network from `truffle.js`). The following command deploys up to migration step 2: ``` ./node_modules/.bin/truffle migrate --network development_migrate -f 2 ``` ## Calculations * Install `python3.6`. * Caculate outcomes of different ceilings by running: ``` ./scripts/ceiling_curve_calc.py --limit=6100000000000000000000 --curve-factor=300 --fee-token=0.1 ``` * Run the following to see all options: ``` ./scripts/ceiling_curve_calc.py --help ``` ================================================ FILE: LICENSE ================================================ Jarrad Hope (Status Research & Development) Copyright (C) 2017 Jorge Izquierdo (Aragon Foundation) Copyright (C) 2017 Jordi Baylina (Giveth) Copyright (C) 2017 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRSNTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRSNTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRSNTIES OF MERCHSNTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {one line to give the program's name and a brief idea of what it does.} Jorge Izquierdo (Aragon Foundation) Copyright (C) 2017 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRSNTY; without even the implied warranty of MERCHSNTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Jorge Izquierdo (Aragon Foundation) Copyright (C) 2017 This program comes with ABSOLUTELY NO WARRSNTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: MINIME_README.md ================================================ # Status Network Token The MiniMeToken contract is a standard ERC20 token with extra functionality: ### The token is easy to clone! Anybody can create a new clone token from any token using this contract with an initial distribution identical to the original token at a specified block. The address calling the `createCloneToken` function will become the token controller and the token's default settings can be specified in the function call. function createCloneToken( string _cloneTokenName, uint8 _cloneDecimalUnits, string _cloneTokenSymbol, uint _snapshotBlock, bool _isConstant ) returns(address) { Once the clone token is created, it acts as a completely independent token, with it's own unique functionalities. ### Balance history is registered and available to be queried All MiniMe Tokens maintain a history of the balance changes that occur during each block. Two calls are introduced to read the totalSupply and the balance of any address at any block in the past. function totalSupplyAt(uint _blockNumber) constant returns(uint) function balanceOfAt(address _holder, uint _blockNumber) constant returns (uint) ### Optional token controller The controller of the contract can generate/destroy/transfer tokens at its own discretion. The controller can be a regular account, but the intention is for the controller to be another contract that imposes transparent rules on the token's issuance and functionality. The Token Controller is not required for the MiniMe token to function, if there is no reason to generate/destroy/transfer tokens, the token controller can be set to 0x0 and this functionality will be disabled. For example, a Token Creation contract can be set as the controller of the MiniMe Token and at the end of the token creation period, the controller can be transferred to the 0x0 address, to guarantee that no new tokens will be created. To create and destroy tokens, these two functions are introduced: function generateTokens(address _holder, uint _value) onlyController function destroyTokens(address _holder, uint _value) onlyController ### The Token's Controller can freeze transfers. If transfersEnabled == false, tokens cannot be transferred by the users, however they can still be created, destroyed, and transferred by the controller. The controller can also toggle this flag. // Allows tokens to be transferred if true or frozen if false function enableTransfers(bool _transfersEnabled) onlyController ## Applications If this token contract is used as the base token, then clones of itself can be easily generated at any given block number, this allows for incredibly powerful functionality, effectively the ability for anyone to give extra features to the token holders without having to migrate to a new contract. Some of the applications that the MiniMe token contract can be used for are: 1. Generating a voting token that is burned when you vote. 2. Generating a discount "coupon" that is redeemed when you use it. 3. Generating a token for a "spinoff" DAO. 4. Generating a token that can be used to give explicit support to an action or a campaign, like polling. 5. Generating a token to enable the token holders to collect daily, monthly or yearly payments. 6. Generating a token to limit participation in a contribution period or similar event to holders of a specific token. 7. Generating token that allows a central party complete control to transfer/generate/destroy tokens at will. 8. Lots of other applications including all the applications the standard ERC 20 token can be used for. All these applications and more are enabled by the MiniMe Token Contract. The most amazing part being that anyone that wants to add these features can, in a permissionless yet safe manner without affecting the parent token's intended functionality. # How to deploy a campaign 1. Deploy the MinimeTokenFactory 2. Deploy the MinimeToken 3. Deploy the campaign 4. Assign the controller of the MinimeToken to the campaign. ================================================ FILE: MULTISIG.md ================================================ # Status Community Multisig [0xbbf0cc1c63f509d48a4674e270d26d80ccaf6022](https://etherscan.io/address/0xbbf0cc1c63f509d48a4674e270d26d80ccaf6022) Required signatures: 3/5 ## Signers - Jordi Baylina, [Giveth](http://www.giveth.io/). [Address](https://etherscan.io/address/0x6b9ef02657339310e28a7a9d4b5f25f7c1f68d61). - Joe Urgo, [district0x](https://district0x.io/), [Sourcerers](http://sourcerers.io/). [Address](https://etherscan.io/address/0x904Ef6ff8E82478c5604d99884EB9Bcd7F73Cc36). - Hudson Jameson, [Oaken Innovations](https://www.projectoaken.com/). [Address](https://etherscan.io/address/0x02E3F16cA21cf0508835B190933ECbdE2f7f14DF). - Jorge Izquierdo, [Aragon](https://aragon.one/). [Address](https://etherscan.io/address/0x4838eab6f43841e0d233db4cea47bd64f614f0c5). - Status Research & Development Multisig. [Address](https://etherscan.io/address/0xa646e29877d52b9e2de457eca09c724ff16d0a2b). ## Responsibilities - The Status Community Multisig will serve SNT holders and the broader crypto community to ensure Status' stated mission is carried. - The Status Community Multisig manages the 29% reserve SNT allocation. - The Status Community Multisig can be used to solve hypothetical deadlock problems in the Status Research & Development Multisig to ensure resources won't get locked and the project will continue its course. # Status Research & Development Multisig – [0xa646e29877d52b9e2de457eca09c724ff16d0a2b](https://etherscan.io/address/0xa646e29877d52b9e2de457eca09c724ff16d0a2b) Required signatures: 2/3 ## Signers - Jarrad Hope, Status Research & Development CEO. [Address](https://etherscan.io/address/0x3ac6cb2ccfd8c8aae3ba31d7ed44c20d241b16a4). - Carl Bennetts, Status Research & Development CMO. [Address](https://etherscan.io/address/0xdBD6ffD3CB205576367915Dd2f8De0aF7edcCeeF). - Status Community Multisig – [Address](https://etherscan.io/address/0xbbf0cc1c63f509d48a4674e270d26d80ccaf6022). ## Responsibilities - Status Research & Development Multisig will hold the Status Research & Development ether funds and SNT tokens. ================================================ FILE: README.md ================================================ # Status Network Token [![Build Status](https://travis-ci.org/status-im/status-network-token.svg?branch=master)](https://travis-ci.org/status-im/status-network-token) - [Whitepaper](https://status.im/whitepaper.pdf) - [Contribution Period Specification](/SPEC.md) - [The Importance of Distribution](https://blog.status.im/distribution-dynamic-ceilings-e2f427f5cca) blogpost. - [Encoding the Status ‘Genesis Block’](https://blog.status.im/encoding-the-status-genesis-block-d73d287a750) blogpost. ## Technical definition At the technical level SGT & SNT are a ERC20-compliant tokens, derived from the [MiniMe Token](https://github.com/Giveth/minime) that allows for token cloning (forking), which will be useful for many future use-cases. Also built in the token is a vesting schedule for limiting SNT transferability over time. Status Project Founders tokens are vesting. ## Contracts - [SNT.sol](/contracts/SNT.sol): Main contract for the token. - [SGT.sol](/contracts/SGT.sol): Token contract for early adopters. Deployed to [0xd248B0D48E44aaF9c49aea0312be7E13a6dc1468](https://etherscan.io/address/0xd248B0D48E44aaF9c49aea0312be7E13a6dc1468#readContract) - [MiniMeToken.sol](/contracts/MiniMeToken.sol): Token implementation. - [StatusContribution.sol](/contracts/StatusContribution.sol): Implementation of the initial distribution of SNT. - [DynamicCeiling.sol](/contracts/DynamicCeiling.sol): Auxiliary contract to manage the dynamic ceiling during the contribution period. - [SNTPlaceHolder.sol](/contracts/SNTPlaceHolder.sol): Placeholder for the Status Network before its deployment. - [ContributionWallet.sol](/contracts/ContributionWallet.sol): Simple contract that will hold all funds until final block of the contribution period. - [MultiSigWallet.sol](/contracts/MultiSigWallet.sol): ConsenSys multisig used for Status and community multisigs. - [DevTokensHolder.sol](/contracts/DevTokensHolder.sol): Contract where tokens belonging to developers will be held. This contract will release this tokens in a vested timing. - [SGTExchanger.sol](/contracts/SGTExchanger.sol): Contract responsible for crediting SNTs to the SGT holders after the contribution period ends. See [INSTRUCTIONS.md](/INSTRUCTIONS.md) for instructions on how to test and deploy the contracts. ## Reviewers and audits. Code for the SNT token and the offering is being reviewed by: - Jordi Baylina, Author. - [Smart Contract Solutions (OpenZeppelin)](https://smartcontractsolutions.com/). [Pending audit results](/) [Preliminary](/audits/prelim-smartcontractsolutions-ef163f1b6fd6fb0630a4b8c78d3b706f3fe1da33.md) - [CoinFabrik](http://www.coinfabrik.com/). [2152b17aa2ef584a2aea95533c707a345c6ccf69](/audits/coinfabrik-2152b17aa2ef584a2aea95533c707a345c6ccf69.pdf) - [BlockchainLabs.nz](http://blockchainlabs.nz/). [Audit results](/audits/BlockchainLabs-SNT-audit-report.md) - [Bok Consulting](https://www.bokconsulting.com.au/). [Pending audit results](/) - YYYYYY. [Pending audit results](/) A bug bounty for the SNT token and offering started on 14/6/2017. [More details](https://blog.status.im/status-network-token-bug-bounty-a66fc2324359) ================================================ FILE: SPEC.md ================================================ # Status Network Contribution Period ## Functional Specification ### Distribution - 29% is for reserve (multisig) - 20% goes to the status team and founders (multisig, 2 Year Vesting Contract, 6 month cliffs) - Remaining 51% is divided between the initial contribution period itself and SGT, where SGT is <= 10% of total supply. ### Whitelist Addresses can be whitelisted and have guaranteed participation up to a set maximum amount, ignores Dynamic Ceiling. Sending ETH to the smart contract address should be no different, whether whitelisted or not. Status Genesis Tokens SGT is a Minime Token that’s total supply of 500,000,000 maps to, and cannot exceed 10% of the total supply. ie. If 250,000,000 of SGT is allocated then SGT maps to 5% of the total supply. SGT can be redeemed for SNT after contribution period. ### Dynamic Ceiling A Curve that specifies a series of hidden hard caps at specific block intervals, that can be revealed at anytime during the contribution period. The entire curve must be revealed before finalising the contribution period. Finalising the contribution period can happen at any moment during the curve, as long as entire curve has been revealed. Whitelisted addresses ignore ceiling. ### Misc Tokens are not transferrable for 1 week after contribution period and are minted at 10,000 SNT per 1 ETH. ================================================ FILE: audits/BlockchainLabs-SNT-audit-report.md ================================================ # Status Network Token Audit ## Preamble This audit report was undertaken by BlockchainLabs.nz for the purpose of providing feedback to Status Research & Development Gmbh. It has subsequently been shared publicly without any express or implied warranty. Solidity contracts were sourced from the public Github repo [status-im/status-network-token](https://github.com/status-im/status-network-token) prior to commit [79419f86c1b4bfcfcd18f08aecee168ff1f73fc4](https://github.com/status-im/status-network-token/tree/79419f86c1b4bfcfcd18f08aecee168ff1f73fc4) - we would encourage all community members and token holders to make their own assessment of the contracts. ## Scope All Solidity code contained in [/contracts](https://github.com/status-im/status-network-token/tree/master/contracts) was considered in scope along with the tests contained in [/test](https://github.com/status-im/status-network-token/tree/master/test) as a basis for static and dynamic analysis. ## Focus Areas The audit report is focused on the following key areas - though this is *not an exhaustive list*. ### Correctness * No correctness defects uncovered during static analysis? * No implemented contract violations uncovered during execution? * No other generic incorrect behavior detected during execution? * Adherence to adopted standards such as ERC20? ### Testability * Test coverage across all functions and events? * Test cases for both expected behaviour and failure modes? * Settings for easy testing of a range of parameters? * No reliance on nested callback functions or console logs? * Avoidance of test scenarios calling other test scenarios? ### Security * No presence of known security weaknesses? * No funds at risk of malicious attempts to withdraw/transfer? * No funds at risk of control fraud? * Prevention of Integer Overflow or Underflow? ### Best Practice * Explicit labeling for the visibility of functions and state variables? * Proper management of gas limits and nested execution? * Latest version of the Solidity compiler? ## Classification ### Defect Severity * **Minor** - A defect that does not have a material impact on the contract execution and is likely to be subjective. * **Moderate** - A defect that could impact the desired outcome of the contract execution in a specific scenario. * **Major** - A defect that impacts the desired outcome of the contract execution or introduces a weakness that may be exploited. * **Critical** - A defect that presents a significant security vulnerability or failure of the contract across a range of scenarios. ## Findings ### Minor **SGT Exchanger** - While testing the correctness of SGTExchanger, we found that it was possible for a user with no SGT tokens to call the collect() function. It was also possible for a user with SGT tokens to call the collect() function for a second time, after having already collected their SNT. However, this is a minor issue because in both cases no SNT was issued. Since commit `450fbc85fd7a4a0dc17d22fc7a6ab5071277fb46`, PR 106 on 16th June an exception is now thrown: https://github.com/status-im/status-network-token/pull/106 **Test Failures** - Tests designed to check for failures were encapsulated within a `catch` and were never properly evaluated. The fix for this issue was addressed on https://github.com/status-im/status-network-token#70 and later improved on https://github.com/status-im/status-network-token#133 **SGT after Contribution** - As of 19 June, attempts to generate additional SGT tokens after the contribution period has begun do not throw an exception. Prior to 19 June this resulted in a thrown exception, which is preferable. ~~However, no new tokens are created so this is only a minor issue.~~ _Status have advised that SGT can be issued after the contribution period._ ### Moderate _No moderate defects were found during this audit._ ### Major **Short Address** - The current implementation of MiniMeToken is vulnerable to ERC20 Short Address 'Attack' http://vessenes.com/the-erc20-short-address-attack-explained/ https://blog.golemproject.net/how-to-find-10m-by-just-reading-blockchain-6ae9d39fcd95 While this isn't a critical issue as it only comes into play with user error, we suggest making the fix to MiniMeToken. A simple fix would be to add a modifier to check address size, and apply this modifier to the transfer function of the MiniMeToken: ``` modifier onlyPayloadSize(uint size) { assert(msg.data.length == size + 4); _; } function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) { //function body unchanged } ``` **DevTokensHolder** - The function collectTokens on the DevTokensHolder contract will mistakenly floor the division of any period of time by 24 months. Making it impossible for developers to collect any token until 2 years. The fix was merged on status-im/status-network-token#105 ### Critical _No critical defects were found during this audit._ ## Conclusion Overall we have been satisfied with the quality of the code and responsiveness of the developers in fixing defects. There was good test coverage for some components such as MultiSigWallet and MiniMeToken as they've been used in other projects, meanwhile tests for the other contracts/functions were written during the audit period to improve the testability of the project as a whole. The developers have followed common best practices and demonstrated an awareness of security weaknesses that could put funds at risk. During the audit the **Short Address** advisory was published and we recommend that this be handled upstream as a modifier in the MiniMeToken contract itself. ================================================ FILE: audits/prelim-smartcontractsolutions-ef163f1b6fd6fb0630a4b8c78d3b706f3fe1da33.md ================================================ Hi all! Here are the severe issues we've found so far: #### Cloning a MiniMeToken with snapshot block set to the current block is subject to a value change attack. If a `MiniMeToken` is cloned by calling the `createCloneToken` function on [line 384 of MiniMeToken.sol](https://github.com/status-im/status-network-token/blob/2152b17aa2ef584a2aea95533c707a345c6ccf69/contracts/MiniMeToken.sol#L384) with the `_snapshotBlock` parameter set to zero or `block.number`, the clone will be creating using the current block as `parentSnapShotBlock`. This opens a small window of time for an attacker to see this transaction in the network, and insert `transfer` transactions in the same block. Given these will be [in the context of the current block too](https://github.com/status-im/status-network-token/blob/2152b17aa2ef584a2aea95533c707a345c6ccf69/contracts/MiniMeToken.sol#L500), the values used for the clone token will contain the modifications by the attacker. This would be confusing for the user creating the clone at the very least, and potentially dangerous. Luckily this can be very easily fixed. Consider replacing [line 391 of MiniMeToken.sol](https://github.com/status-im/status-network-token/blob/2152b17aa2ef584a2aea95533c707a345c6ccf69/contracts/MiniMeToken.sol#L391) for a check that will throw if `_snapshotBlock` equals `block.number`. Consider adding the same check [in the MiniMeToken constructor](https://github.com/status-im/status-network-token/blob/2152b17aa2ef584a2aea95533c707a345c6ccf69/contracts/MiniMeToken.sol#L156) too, for `_parentSnapShotBlock`. #### ContributionWallet finalBlock can be different from StatusContribution stopBlock Withdrawal from the `ContributionWallet` contract is enabled once [the contribution is finalized](https://github.com/status-im/status-network-token/blob/2152b17aa2ef584a2aea95533c707a345c6ccf69/contracts/ContributionWallet.sol#L58) or when the current block is after `finalBlock`, a state variable. For the contract to serve its purpose, `finalBlock` should be the same as the contribution's `stopBlock` or greater. Otherwise, the funds could be withdrawn [before the contribution is finalized](https://github.com/status-im/status-network-token/blob/2152b17aa2ef584a2aea95533c707a345c6ccf69/contracts/ContributionWallet.sol#L57), which would defeat the purpose of `ContributionWallet`. Consider using `contribution.stopBlock()` in place of `finalBlock` or checking that `finalBlock` is greater or equal than `stopBlock`. **Addendum** We also have and additional comment about [a PR you merged adding gas price cap to transactions](https://github.com/status-im/status-network-token/pull/20/files) and [a pending PR adding a cap to call frequency by address](https://github.com/status-im/status-network-token/pull/67/files). Both are out of the audit's commit scope, but we want to let you guys know our thoughts anyway as a friendly help. We don't this this additions are a good idea, and recommend you revert them. See [Vitalik's post](http://vitalik.ca/general/2017/06/09/sales.html) about the gas price cap issue, and the frequency cap can be easily circumvented so it doesn't add security but does add complexity and attack surface. Let me know your thoughts/questions. The final report will be delivered on Friday, as agreed. Happy to be working on this together, Cheers, Manuel Araoz [openzeppelin.com](https://openzeppelin.com/) ================================================ FILE: contracts/ContributionWallet.sol ================================================ pragma solidity ^0.4.11; /* Copyright 2017, Jordi Baylina This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /// @title ContributionWallet Contract /// @author Jordi Baylina /// @dev This contract will be hold the Ether during the contribution period. /// The idea of this contract is to avoid recycling Ether during the contribution /// period. So all the ETH collected will be locked here until the contribution /// period ends // @dev Contract to hold sale raised funds during the sale period. // Prevents attack in which the Aragon Multisig sends raised ether // to the sale contract to mint tokens to itself, and getting the // funds back immediately. import "./StatusContribution.sol"; contract ContributionWallet { // Public variables address public multisig; uint256 public endBlock; StatusContribution public contribution; // @dev Constructor initializes public variables // @param _multisig The address of the multisig that will receive the funds // @param _endBlock Block after which the multisig can request the funds // @param _contribution Address of the StatusContribution contract function ContributionWallet(address _multisig, uint256 _endBlock, address _contribution) { require(_multisig != 0x0); require(_contribution != 0x0); require(_endBlock != 0 && _endBlock <= 4000000); multisig = _multisig; endBlock = _endBlock; contribution = StatusContribution(_contribution); } // @dev Receive all sent funds without any further logic function () public payable {} // @dev Withdraw function sends all the funds to the wallet if conditions are correct function withdraw() public { require(msg.sender == multisig); // Only the multisig can request it require(block.number > endBlock || // Allow after end block contribution.finalizedBlock() != 0); // Allow when sale is finalized multisig.transfer(this.balance); } } ================================================ FILE: contracts/DevTokensHolder.sol ================================================ pragma solidity ^0.4.11; /* Copyright 2017, Jordi Baylina This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /// @title DevTokensHolder Contract /// @author Jordi Baylina /// @dev This contract will hold the tokens of the developers. /// Tokens will not be able to be collected until 6 months after the contribution /// period ends. And it will be increasing linearly until 2 years. // collectable tokens // | _/-------- vestedTokens rect // | _/ // | _/ // | _/ // | _/ // | _/ // | _/ // | _/ // | | // | . | // | . | // | . | // +===+======+--------------+----------> time // Contrib 6 Months 24 Months // End import "./MiniMeToken.sol"; import "./StatusContribution.sol"; import "./SafeMath.sol"; import "./ERC20Token.sol"; contract DevTokensHolder is Owned { using SafeMath for uint256; uint256 collectedTokens; StatusContribution contribution; MiniMeToken snt; function DevTokensHolder(address _owner, address _contribution, address _snt) { owner = _owner; contribution = StatusContribution(_contribution); snt = MiniMeToken(_snt); } /// @notice The Dev (Owner) will call this method to extract the tokens function collectTokens() public onlyOwner { uint256 balance = snt.balanceOf(address(this)); uint256 total = collectedTokens.add(balance); uint256 finalizedTime = contribution.finalizedTime(); require(finalizedTime > 0 && getTime() > finalizedTime.add(months(6))); uint256 canExtract = total.mul(getTime().sub(finalizedTime)).div(months(24)); canExtract = canExtract.sub(collectedTokens); if (canExtract > balance) { canExtract = balance; } collectedTokens = collectedTokens.add(canExtract); assert(snt.transfer(owner, canExtract)); TokensWithdrawn(owner, canExtract); } function months(uint256 m) internal returns (uint256) { return m.mul(30 days); } function getTime() internal returns (uint256) { return now; } ////////// // Safety Methods ////////// /// @notice This method can be used by the controller to extract mistakenly /// sent tokens to this contract. /// @param _token The address of the token contract that you want to recover /// set to 0 in case you want to extract ether. function claimTokens(address _token) public onlyOwner { require(_token != address(snt)); if (_token == 0x0) { owner.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint256 balance = token.balanceOf(this); token.transfer(owner, balance); ClaimedTokens(_token, owner, balance); } event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); event TokensWithdrawn(address indexed _holder, uint256 _amount); } ================================================ FILE: contracts/DynamicCeiling.sol ================================================ pragma solidity ^0.4.11; /* Copyright 2017, Jordi Baylina This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /// @title DynamicCeiling Contract /// @author Jordi Baylina /// @dev This contract calculates the ceiling from a series of curves. /// These curves are committed first and revealed later. /// All the curves must be in increasing order and the last curve is marked /// as the last one. /// This contract allows to hide and reveal the ceiling at will of the owner. import "./SafeMath.sol"; import "./Owned.sol"; contract DynamicCeiling is Owned { using SafeMath for uint256; struct Curve { bytes32 hash; // Absolute limit for this curve uint256 limit; // The funds remaining to be collected are divided by `slopeFactor` smooth ceiling // with a long tail where big and small buyers can take part. uint256 slopeFactor; // This keeps the curve flat at this number, until funds to be collected is less than this uint256 collectMinimum; } address public contribution; Curve[] public curves; uint256 public currentIndex; uint256 public revealedCurves; bool public allRevealed; /// @dev `contribution` is the only address that can call a function with this /// modifier modifier onlyContribution { require(msg.sender == contribution); _; } function DynamicCeiling(address _owner, address _contribution) { owner = _owner; contribution = _contribution; } /// @notice This should be called by the creator of the contract to commit /// all the curves. /// @param _curveHashes Array of hashes of each curve. Each hash is calculated /// by the `calculateHash` method. More hashes than actual curves can be /// committed in order to hide also the number of curves. /// The remaining hashes can be just random numbers. function setHiddenCurves(bytes32[] _curveHashes) public onlyOwner { require(curves.length == 0); curves.length = _curveHashes.length; for (uint256 i = 0; i < _curveHashes.length; i = i.add(1)) { curves[i].hash = _curveHashes[i]; } } /// @notice Anybody can reveal the next curve if he knows it. /// @param _limit Ceiling cap. /// (must be greater or equal to the previous one). /// @param _last `true` if it's the last curve. /// @param _salt Random number used to commit the curve function revealCurve(uint256 _limit, uint256 _slopeFactor, uint256 _collectMinimum, bool _last, bytes32 _salt) public { require(!allRevealed); require(curves[revealedCurves].hash == calculateHash(_limit, _slopeFactor, _collectMinimum, _last, _salt)); require(_limit != 0 && _slopeFactor != 0 && _collectMinimum != 0); if (revealedCurves > 0) { require(_limit >= curves[revealedCurves.sub(1)].limit); } curves[revealedCurves].limit = _limit; curves[revealedCurves].slopeFactor = _slopeFactor; curves[revealedCurves].collectMinimum = _collectMinimum; revealedCurves = revealedCurves.add(1); if (_last) allRevealed = true; } /// @notice Reveal multiple curves at once function revealMulti(uint256[] _limits, uint256[] _slopeFactors, uint256[] _collectMinimums, bool[] _lasts, bytes32[] _salts) public { // Do not allow none and needs to be same length for all parameters require(_limits.length != 0 && _limits.length == _slopeFactors.length && _limits.length == _collectMinimums.length && _limits.length == _lasts.length && _limits.length == _salts.length); for (uint256 i = 0; i < _limits.length; i = i.add(1)) { revealCurve(_limits[i], _slopeFactors[i], _collectMinimums[i], _lasts[i], _salts[i]); } } /// @notice Move to curve, used as a failsafe function moveTo(uint256 _index) public onlyOwner { require(_index < revealedCurves && // No more curves _index == currentIndex.add(1)); // Only move one index at a time currentIndex = _index; } /// @return Return the funds to collect for the current point on the curve /// (or 0 if no curves revealed yet) function toCollect(uint256 collected) public onlyContribution returns (uint256) { if (revealedCurves == 0) return 0; // Move to the next curve if (collected >= curves[currentIndex].limit) { // Catches `limit == 0` uint256 nextIndex = currentIndex.add(1); if (nextIndex >= revealedCurves) return 0; // No more curves currentIndex = nextIndex; if (collected >= curves[currentIndex].limit) return 0; // Catches `limit == 0` } // Everything left to collect from this limit uint256 difference = curves[currentIndex].limit.sub(collected); // Current point on the curve uint256 collect = difference.div(curves[currentIndex].slopeFactor); // Prevents paying too much fees vs to be collected; breaks long tail if (collect <= curves[currentIndex].collectMinimum) { if (difference > curves[currentIndex].collectMinimum) { return curves[currentIndex].collectMinimum; } else { return difference; } } else { return collect; } } /// @notice Calculates the hash of a curve. /// @param _limit Ceiling cap. /// @param _last `true` if it's the last curve. /// @param _salt Random number that will be needed to reveal this curve. /// @return The calculated hash of this curve to be used in the `setHiddenCurves` method function calculateHash(uint256 _limit, uint256 _slopeFactor, uint256 _collectMinimum, bool _last, bytes32 _salt) public constant returns (bytes32) { return keccak256(_limit, _slopeFactor, _collectMinimum, _last, _salt); } /// @return Return the total number of curves committed /// (can be larger than the number of actual curves on the curve to hide /// the real number of curves) function nCurves() public constant returns (uint256) { return curves.length; } } ================================================ FILE: contracts/ERC20Token.sol ================================================ // Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20 pragma solidity ^0.4.11; contract ERC20Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance); /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } ================================================ FILE: contracts/MiniMeToken.sol ================================================ pragma solidity ^0.4.11; import "./ERC20Token.sol"; /* Copyright 2016, Jordi Baylina This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /// @title MiniMeToken Contract /// @author Jordi Baylina /// @dev This token contract's goal is to make it easy for anyone to clone this /// token using the token distribution at a given block, this will allow DAO's /// and DApps to upgrade their features in a decentralized manner without /// affecting the original token /// @dev It is ERC20 compliant, but still needs to under go further testing. /// @dev The token controller contract must implement these functions contract TokenController { /// @notice Called when `_owner` sends ether to the MiniMe Token contract /// @param _owner The address that sent the ether to create tokens /// @return True if the ether is accepted, false if it throws function proxyPayment(address _owner) payable returns(bool); /// @notice Notifies the controller about a token transfer allowing the /// controller to react if desired /// @param _from The origin of the transfer /// @param _to The destination of the transfer /// @param _amount The amount of the transfer /// @return False if the controller does not authorize the transfer function onTransfer(address _from, address _to, uint _amount) returns(bool); /// @notice Notifies the controller about an approval allowing the /// controller to react if desired /// @param _owner The address that calls `approve()` /// @param _spender The spender in the `approve()` call /// @param _amount The amount in the `approve()` call /// @return False if the controller does not authorize the approval function onApprove(address _owner, address _spender, uint _amount) returns(bool); } contract Controlled { /// @notice The address of the controller is the only address that can call /// a function with this modifier modifier onlyController { if (msg.sender != controller) throw; _; } address public controller; function Controlled() { controller = msg.sender;} /// @notice Changes the controller of the contract /// @param _newController The new controller of the contract function changeController(address _newController) onlyController { controller = _newController; } } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 _amount, address _token, bytes _data); } /// @dev The actual token contract, the default controller is the msg.sender /// that deploys the contract, so usually this token will be deployed by a /// token controller contract, which Giveth will call a "Campaign" contract MiniMeToken is Controlled { string public name; //The Token's name: e.g. DigixDAO Tokens uint8 public decimals; //Number of decimals of the smallest unit string public symbol; //An identifier: e.g. REP string public version = 'MMT_0.1'; //An arbitrary versioning scheme /// @dev `Checkpoint` is the structure that attaches a block number to a /// given value, the block number attached is the one that last changed the /// value struct Checkpoint { // `fromBlock` is the block number that the value was generated from uint128 fromBlock; // `value` is the amount of tokens at a specific block number uint128 value; } // `parentToken` is the Token address that was cloned to produce this token; // it will be 0x0 for a token that was not cloned MiniMeToken public parentToken; // `parentSnapShotBlock` is the block number from the Parent Token that was // used to determine the initial distribution of the Clone Token uint public parentSnapShotBlock; // `creationBlock` is the block number that the Clone Token was created uint public creationBlock; // `balances` is the map that tracks the balance of each address, in this // contract when the balance changes the block number that the change // occurred is also included in the map mapping (address => Checkpoint[]) balances; // `allowed` tracks any extra transfer rights as in all ERC20 tokens mapping (address => mapping (address => uint256)) allowed; // Tracks the history of the `totalSupply` of the token Checkpoint[] totalSupplyHistory; // Flag that determines if the token is transferable or not. bool public transfersEnabled; // The factory used to create new clone tokens MiniMeTokenFactory public tokenFactory; //////////////// // Constructor //////////////// /// @notice Constructor to create a MiniMeToken /// @param _tokenFactory The address of the MiniMeTokenFactory contract that /// will create the Clone token contracts, the token factory needs to be /// deployed first /// @param _parentToken Address of the parent token, set to 0x0 if it is a /// new token /// @param _parentSnapShotBlock Block of the parent token that will /// determine the initial distribution of the clone token, set to 0 if it /// is a new token /// @param _tokenName Name of the new token /// @param _decimalUnits Number of decimals of the new token /// @param _tokenSymbol Token Symbol for the new token /// @param _transfersEnabled If true, tokens will be able to be transferred function MiniMeToken( address _tokenFactory, address _parentToken, uint _parentSnapShotBlock, string _tokenName, uint8 _decimalUnits, string _tokenSymbol, bool _transfersEnabled ) { tokenFactory = MiniMeTokenFactory(_tokenFactory); name = _tokenName; // Set the name decimals = _decimalUnits; // Set the decimals symbol = _tokenSymbol; // Set the symbol parentToken = MiniMeToken(_parentToken); parentSnapShotBlock = _parentSnapShotBlock; transfersEnabled = _transfersEnabled; creationBlock = getBlockNumber(); } /////////////////// // ERC20 Methods /////////////////// /// @notice Send `_amount` tokens to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _amount The amount of tokens to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _amount) returns (bool success) { if (!transfersEnabled) throw; return doTransfer(msg.sender, _to, _amount); } /// @notice Send `_amount` tokens to `_to` from `_from` on the condition it /// is approved by `_from` /// @param _from The address holding the tokens being transferred /// @param _to The address of the recipient /// @param _amount The amount of tokens to be transferred /// @return True if the transfer was successful function transferFrom(address _from, address _to, uint256 _amount ) returns (bool success) { // The controller of this contract can move tokens around at will, // this is important to recognize! Confirm that you trust the // controller of this contract, which in most situations should be // another open source smart contract or 0x0 if (msg.sender != controller) { if (!transfersEnabled) throw; // The standard ERC 20 transferFrom functionality if (allowed[_from][msg.sender] < _amount) return false; allowed[_from][msg.sender] -= _amount; } return doTransfer(_from, _to, _amount); } /// @dev This is the actual transfer function in the token contract, it can /// only be called by other functions in this contract. /// @param _from The address holding the tokens being transferred /// @param _to The address of the recipient /// @param _amount The amount of tokens to be transferred /// @return True if the transfer was successful function doTransfer(address _from, address _to, uint _amount ) internal returns(bool) { if (_amount == 0) { return true; } if (parentSnapShotBlock >= getBlockNumber()) throw; // Do not allow transfer to 0x0 or the token contract itself if ((_to == 0) || (_to == address(this))) throw; // If the amount being transfered is more than the balance of the // account the transfer returns false var previousBalanceFrom = balanceOfAt(_from, getBlockNumber()); if (previousBalanceFrom < _amount) { return false; } // Alerts the token controller of the transfer if (isContract(controller)) { if (!TokenController(controller).onTransfer(_from, _to, _amount)) throw; } // First update the balance array with the new value for the address // sending the tokens updateValueAtNow(balances[_from], previousBalanceFrom - _amount); // Then update the balance array with the new value for the address // receiving the tokens var previousBalanceTo = balanceOfAt(_to, getBlockNumber()); if (previousBalanceTo + _amount < previousBalanceTo) throw; // Check for overflow updateValueAtNow(balances[_to], previousBalanceTo + _amount); // An event to make the transfer easy to find on the blockchain Transfer(_from, _to, _amount); return true; } /// @param _owner The address that's balance is being requested /// @return The balance of `_owner` at the current block function balanceOf(address _owner) constant returns (uint256 balance) { return balanceOfAt(_owner, getBlockNumber()); } /// @notice `msg.sender` approves `_spender` to spend `_amount` tokens on /// its behalf. This is a modified version of the ERC20 approve function /// to be a little bit safer /// @param _spender The address of the account able to transfer the tokens /// @param _amount The amount of tokens to be approved for transfer /// @return True if the approval was successful function approve(address _spender, uint256 _amount) returns (bool success) { if (!transfersEnabled) throw; // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender,0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 if ((_amount!=0) && (allowed[msg.sender][_spender] !=0)) throw; // Alerts the token controller of the approve function call if (isContract(controller)) { if (!TokenController(controller).onApprove(msg.sender, _spender, _amount)) throw; } allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } /// @dev This function makes it easy to read the `allowed[]` map /// @param _owner The address of the account that owns the token /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens of _owner that _spender is allowed /// to spend function allowance(address _owner, address _spender ) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } /// @notice `msg.sender` approves `_spender` to send `_amount` tokens on /// its behalf, and then a function is triggered in the contract that is /// being approved, `_spender`. This allows users to use their tokens to /// interact with contracts in one function call instead of two /// @param _spender The address of the contract able to transfer the tokens /// @param _amount The amount of tokens to be approved for transfer /// @return True if the function call was successful function approveAndCall(address _spender, uint256 _amount, bytes _extraData ) returns (bool success) { if (!approve(_spender, _amount)) throw; ApproveAndCallFallBack(_spender).receiveApproval( msg.sender, _amount, this, _extraData ); return true; } /// @dev This function makes it easy to get the total number of tokens /// @return The total number of tokens function totalSupply() constant returns (uint) { return totalSupplyAt(getBlockNumber()); } //////////////// // Query balance and totalSupply in History //////////////// /// @dev Queries the balance of `_owner` at a specific `_blockNumber` /// @param _owner The address from which the balance will be retrieved /// @param _blockNumber The block number when the balance is queried /// @return The balance at `_blockNumber` function balanceOfAt(address _owner, uint _blockNumber) constant returns (uint) { // These next few lines are used when the balance of the token is // requested before a check point was ever created for this token, it // requires that the `parentToken.balanceOfAt` be queried at the // genesis block for that token as this contains initial balance of // this token if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) { if (address(parentToken) != 0) { return parentToken.balanceOfAt(_owner, min(_blockNumber, parentSnapShotBlock)); } else { // Has no parent return 0; } // This will return the expected balance during normal situations } else { return getValueAt(balances[_owner], _blockNumber); } } /// @notice Total amount of tokens at a specific `_blockNumber`. /// @param _blockNumber The block number when the totalSupply is queried /// @return The total amount of tokens at `_blockNumber` function totalSupplyAt(uint _blockNumber) constant returns(uint) { // These next few lines are used when the totalSupply of the token is // requested before a check point was ever created for this token, it // requires that the `parentToken.totalSupplyAt` be queried at the // genesis block for this token as that contains totalSupply of this // token at this block number. if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) { if (address(parentToken) != 0) { return parentToken.totalSupplyAt(min(_blockNumber, parentSnapShotBlock)); } else { return 0; } // This will return the expected totalSupply during normal situations } else { return getValueAt(totalSupplyHistory, _blockNumber); } } //////////////// // Clone Token Method //////////////// /// @notice Creates a new clone token with the initial distribution being /// this token at `_snapshotBlock` /// @param _cloneTokenName Name of the clone token /// @param _cloneDecimalUnits Number of decimals of the smallest unit /// @param _cloneTokenSymbol Symbol of the clone token /// @param _snapshotBlock Block when the distribution of the parent token is /// copied to set the initial distribution of the new clone token; /// if the block is zero than the actual block, the current block is used /// @param _transfersEnabled True if transfers are allowed in the clone /// @return The address of the new MiniMeToken Contract function createCloneToken( string _cloneTokenName, uint8 _cloneDecimalUnits, string _cloneTokenSymbol, uint _snapshotBlock, bool _transfersEnabled ) returns(address) { if (_snapshotBlock == 0) _snapshotBlock = getBlockNumber(); MiniMeToken cloneToken = tokenFactory.createCloneToken( this, _snapshotBlock, _cloneTokenName, _cloneDecimalUnits, _cloneTokenSymbol, _transfersEnabled ); cloneToken.changeController(msg.sender); // An event to make the token easy to find on the blockchain NewCloneToken(address(cloneToken), _snapshotBlock); return address(cloneToken); } //////////////// // Generate and destroy tokens //////////////// /// @notice Generates `_amount` tokens that are assigned to `_owner` /// @param _owner The address that will be assigned the new tokens /// @param _amount The quantity of tokens generated /// @return True if the tokens are generated correctly function generateTokens(address _owner, uint _amount ) onlyController returns (bool) { uint curTotalSupply = getValueAt(totalSupplyHistory, getBlockNumber()); if (curTotalSupply + _amount < curTotalSupply) throw; // Check for overflow updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount); var previousBalanceTo = balanceOf(_owner); if (previousBalanceTo + _amount < previousBalanceTo) throw; // Check for overflow updateValueAtNow(balances[_owner], previousBalanceTo + _amount); Transfer(0, _owner, _amount); return true; } /// @notice Burns `_amount` tokens from `_owner` /// @param _owner The address that will lose the tokens /// @param _amount The quantity of tokens to burn /// @return True if the tokens are burned correctly function destroyTokens(address _owner, uint _amount ) onlyController returns (bool) { uint curTotalSupply = getValueAt(totalSupplyHistory, getBlockNumber()); if (curTotalSupply < _amount) throw; updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount); var previousBalanceFrom = balanceOf(_owner); if (previousBalanceFrom < _amount) throw; updateValueAtNow(balances[_owner], previousBalanceFrom - _amount); Transfer(_owner, 0, _amount); return true; } //////////////// // Enable tokens transfers //////////////// /// @notice Enables token holders to transfer their tokens freely if true /// @param _transfersEnabled True if transfers are allowed in the clone function enableTransfers(bool _transfersEnabled) onlyController { transfersEnabled = _transfersEnabled; } //////////////// // Internal helper functions to query and set a value in a snapshot array //////////////// /// @dev `getValueAt` retrieves the number of tokens at a given block number /// @param checkpoints The history of values being queried /// @param _block The block number to retrieve the value at /// @return The number of tokens being queried function getValueAt(Checkpoint[] storage checkpoints, uint _block ) constant internal returns (uint) { if (checkpoints.length == 0) return 0; // Shortcut for the actual value if (_block >= checkpoints[checkpoints.length-1].fromBlock) return checkpoints[checkpoints.length-1].value; if (_block < checkpoints[0].fromBlock) return 0; // Binary search of the value in the array uint min = 0; uint max = checkpoints.length-1; while (max > min) { uint mid = (max + min + 1)/ 2; if (checkpoints[mid].fromBlock<=_block) { min = mid; } else { max = mid-1; } } return checkpoints[min].value; } /// @dev `updateValueAtNow` used to update the `balances` map and the /// `totalSupplyHistory` /// @param checkpoints The history of data being updated /// @param _value The new number of tokens function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value ) internal { if ((checkpoints.length == 0) || (checkpoints[checkpoints.length -1].fromBlock < getBlockNumber())) { Checkpoint newCheckPoint = checkpoints[ checkpoints.length++ ]; newCheckPoint.fromBlock = uint128(getBlockNumber()); newCheckPoint.value = uint128(_value); } else { Checkpoint oldCheckPoint = checkpoints[checkpoints.length-1]; oldCheckPoint.value = uint128(_value); } } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns(bool) { uint size; if (_addr == 0) return false; assembly { size := extcodesize(_addr) } return size>0; } /// @dev Helper function to return a min betwen the two uints function min(uint a, uint b) internal returns (uint) { return a < b ? a : b; } /// @notice The fallback function: If the contract's controller has not been /// set to 0, then the `proxyPayment` method is called which relays the /// ether and creates tokens as described in the token controller contract function () payable { if (isContract(controller)) { if (! TokenController(controller).proxyPayment.value(msg.value)(msg.sender)) throw; } else { throw; } } ////////// // Testing specific methods ////////// /// @notice This function is overridden by the test Mocks. function getBlockNumber() internal constant returns (uint256) { return block.number; } ////////// // Safety Methods ////////// /// @notice This method can be used by the controller to extract mistakenly /// sent tokens to this contract. /// @param _token The address of the token contract that you want to recover /// set to 0 in case you want to extract ether. function claimTokens(address _token) onlyController { if (_token == 0x0) { controller.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint balance = token.balanceOf(this); token.transfer(controller, balance); ClaimedTokens(_token, controller, balance); } //////////////// // Events //////////////// event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); event Transfer(address indexed _from, address indexed _to, uint256 _amount); event NewCloneToken(address indexed _cloneToken, uint _snapshotBlock); event Approval( address indexed _owner, address indexed _spender, uint256 _amount ); } //////////////// // MiniMeTokenFactory //////////////// /// @dev This contract is used to generate clone contracts from a contract. /// In solidity this is the way to create a contract from a contract of the /// same class contract MiniMeTokenFactory { /// @notice Update the DApp by creating a new token with new functionalities /// the msg.sender becomes the controller of this clone token /// @param _parentToken Address of the token being cloned /// @param _snapshotBlock Block of the parent token that will /// determine the initial distribution of the clone token /// @param _tokenName Name of the new token /// @param _decimalUnits Number of decimals of the new token /// @param _tokenSymbol Token Symbol for the new token /// @param _transfersEnabled If true, tokens will be able to be transferred /// @return The address of the new token contract function createCloneToken( address _parentToken, uint _snapshotBlock, string _tokenName, uint8 _decimalUnits, string _tokenSymbol, bool _transfersEnabled ) returns (MiniMeToken) { MiniMeToken newToken = new MiniMeToken( this, _parentToken, _snapshotBlock, _tokenName, _decimalUnits, _tokenSymbol, _transfersEnabled ); newToken.changeController(msg.sender); return newToken; } } ================================================ FILE: contracts/MultiSigWallet.sol ================================================ pragma solidity ^0.4.11; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - contract MultiSigWallet { uint constant public MAX_OWNER_COUNT = 50; event Confirmation(address indexed _sender, uint indexed _transactionId); event Revocation(address indexed _sender, uint indexed _transactionId); event Submission(uint indexed _transactionId); event Execution(uint indexed _transactionId); event ExecutionFailure(uint indexed _transactionId); event Deposit(address indexed _sender, uint _value); event OwnerAddition(address indexed _owner); event OwnerRemoval(address indexed _owner); event RequirementChange(uint _required); mapping (uint => Transaction) public transactions; mapping (uint => mapping (address => bool)) public confirmations; mapping (address => bool) public isOwner; address[] public owners; uint public required; uint public transactionCount; struct Transaction { address destination; uint value; bytes data; bool executed; } modifier onlyWallet() { if (msg.sender != address(this)) throw; _; } modifier ownerDoesNotExist(address owner) { if (isOwner[owner]) throw; _; } modifier ownerExists(address owner) { if (!isOwner[owner]) throw; _; } modifier transactionExists(uint transactionId) { if (transactions[transactionId].destination == 0) throw; _; } modifier confirmed(uint transactionId, address owner) { if (!confirmations[transactionId][owner]) throw; _; } modifier notConfirmed(uint transactionId, address owner) { if (confirmations[transactionId][owner]) throw; _; } modifier notExecuted(uint transactionId) { if (transactions[transactionId].executed) throw; _; } modifier notNull(address _address) { if (_address == 0) throw; _; } modifier validRequirement(uint ownerCount, uint _required) { if ( ownerCount > MAX_OWNER_COUNT || _required > ownerCount || _required == 0 || ownerCount == 0) throw; _; } /// @dev Fallback function allows to deposit ether. function() payable { if (msg.value > 0) Deposit(msg.sender, msg.value); } /* * Public functions */ /// @dev Contract constructor sets initial owners and required number of confirmations. /// @param _owners List of initial owners. /// @param _required Number of required confirmations. function MultiSigWallet(address[] _owners, uint _required) public validRequirement(_owners.length, _required) { for (uint i=0; i<_owners.length; i++) { if (isOwner[_owners[i]] || _owners[i] == 0) throw; isOwner[_owners[i]] = true; } owners = _owners; required = _required; } /// @dev Allows to add a new owner. Transaction has to be sent by wallet. /// @param owner Address of new owner. function addOwner(address owner) public onlyWallet ownerDoesNotExist(owner) notNull(owner) validRequirement(owners.length + 1, required) { isOwner[owner] = true; owners.push(owner); OwnerAddition(owner); } /// @dev Allows to remove an owner. Transaction has to be sent by wallet. /// @param owner Address of owner. function removeOwner(address owner) public onlyWallet ownerExists(owner) { isOwner[owner] = false; for (uint i=0; i owners.length) changeRequirement(owners.length); OwnerRemoval(owner); } /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet. /// @param owner Address of owner to be replaced. /// @param owner Address of new owner. function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) { for (uint i=0; i. */ /// @title SGTExchanger Contract /// @author Jordi Baylina /// @dev This contract will be used to distribute SNT between SGT holders. /// SGT token is not transferable, and we just keep an accounting between all tokens /// deposited and the tokens collected. /// The controllerShip of SGT should be transferred to this contract before the /// contribution period starts. import "./MiniMeToken.sol"; import "./SafeMath.sol"; import "./Owned.sol"; import "./StatusContribution.sol"; import "./ERC20Token.sol"; contract SGTExchanger is TokenController, Owned { using SafeMath for uint256; mapping (address => uint256) public collected; uint256 public totalCollected; MiniMeToken public sgt; MiniMeToken public snt; StatusContribution public statusContribution; function SGTExchanger(address _sgt, address _snt, address _statusContribution) { sgt = MiniMeToken(_sgt); snt = MiniMeToken(_snt); statusContribution = StatusContribution(_statusContribution); } /// @notice This method should be called by the SGT holders to collect their /// corresponding SNTs function collect() public { uint256 finalizedBlock = statusContribution.finalizedBlock(); require(finalizedBlock != 0); require(getBlockNumber() > finalizedBlock); uint256 total = totalCollected.add(snt.balanceOf(address(this))); uint256 balance = sgt.balanceOfAt(msg.sender, finalizedBlock); // First calculate how much correspond to him uint256 amount = total.mul(balance).div(sgt.totalSupplyAt(finalizedBlock)); // And then subtract the amount already collected amount = amount.sub(collected[msg.sender]); require(amount > 0); // Notify the user that there are no tokens to exchange totalCollected = totalCollected.add(amount); collected[msg.sender] = collected[msg.sender].add(amount); assert(snt.transfer(msg.sender, amount)); TokensCollected(msg.sender, amount); } function proxyPayment(address) public payable returns (bool) { throw; } function onTransfer(address, address, uint256) public returns (bool) { return false; } function onApprove(address, address, uint256) public returns (bool) { return false; } ////////// // Testing specific methods ////////// /// @notice This function is overridden by the test Mocks. function getBlockNumber() internal constant returns (uint256) { return block.number; } ////////// // Safety Method ////////// /// @notice This method can be used by the controller to extract mistakenly /// sent tokens to this contract. /// @param _token The address of the token contract that you want to recover /// set to 0 in case you want to extract ether. function claimTokens(address _token) public onlyOwner { require(_token != address(snt)); if (_token == 0x0) { owner.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint256 balance = token.balanceOf(this); token.transfer(owner, balance); ClaimedTokens(_token, owner, balance); } event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); event TokensCollected(address indexed _holder, uint256 _amount); } ================================================ FILE: contracts/SNT.sol ================================================ pragma solidity ^0.4.11; /* Copyright 2017, Jarrad Hope (Status Research & Development GmbH) */ import "./MiniMeToken.sol"; contract SNT is MiniMeToken { // @dev SNT constructor just parametrizes the MiniMeIrrevocableVestedToken constructor function SNT(address _tokenFactory) MiniMeToken( _tokenFactory, 0x0, // no parent token 0, // no snapshot block number from parent "Status Network Token", // Token name 18, // Decimals "SNT", // Symbol true // Enable transfers ) {} } ================================================ FILE: contracts/SNTPlaceHolder.sol ================================================ pragma solidity ^0.4.11; /* Copyright 2017, Jordi Baylina This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /// @title SNTPlaceholder Contract /// @author Jordi Baylina /// @dev The SNTPlaceholder contract will take control over the SNT after the contribution /// is finalized and before the Status Network is deployed. /// The contract allows for SNT transfers and transferFrom and implements the /// logic for transferring control of the token to the network when the offering /// asks it to do so. import "./MiniMeToken.sol"; import "./StatusContribution.sol"; import "./SafeMath.sol"; import "./Owned.sol"; import "./ERC20Token.sol"; contract SNTPlaceHolder is TokenController, Owned { using SafeMath for uint256; MiniMeToken public snt; StatusContribution public contribution; uint256 public activationTime; address public sgtExchanger; /// @notice Constructor /// @param _owner Trusted owner for this contract. /// @param _snt SNT token contract address /// @param _contribution StatusContribution contract address /// @param _sgtExchanger SGT-SNT Exchange address. (During the first week /// only this exchanger will be able to move tokens) function SNTPlaceHolder(address _owner, address _snt, address _contribution, address _sgtExchanger) { owner = _owner; snt = MiniMeToken(_snt); contribution = StatusContribution(_contribution); sgtExchanger = _sgtExchanger; } /// @notice The owner of this contract can change the controller of the SNT token /// Please, be sure that the owner is a trusted agent or 0x0 address. /// @param _newController The address of the new controller function changeController(address _newController) public onlyOwner { snt.changeController(_newController); ControllerChanged(_newController); } ////////// // MiniMe Controller Interface functions ////////// // In between the offering and the network. Default settings for allowing token transfers. function proxyPayment(address) public payable returns (bool) { return false; } function onTransfer(address _from, address, uint256) public returns (bool) { return transferable(_from); } function onApprove(address _from, address, uint256) public returns (bool) { return transferable(_from); } function transferable(address _from) internal returns (bool) { // Allow the exchanger to work from the beginning if (activationTime == 0) { uint256 f = contribution.finalizedTime(); if (f > 0) { activationTime = f.add(1 weeks); } else { return false; } } return (getTime() > activationTime) || (_from == sgtExchanger); } ////////// // Testing specific methods ////////// /// @notice This function is overrided by the test Mocks. function getTime() internal returns (uint256) { return now; } ////////// // Safety Methods ////////// /// @notice This method can be used by the controller to extract mistakenly /// sent tokens to this contract. /// @param _token The address of the token contract that you want to recover /// set to 0 in case you want to extract ether. function claimTokens(address _token) public onlyOwner { if (snt.controller() == address(this)) { snt.claimTokens(_token); } if (_token == 0x0) { owner.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint256 balance = token.balanceOf(this); token.transfer(owner, balance); ClaimedTokens(_token, owner, balance); } event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); event ControllerChanged(address indexed _newController); } ================================================ FILE: contracts/SafeMath.sol ================================================ pragma solidity ^0.4.11; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal returns (uint) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } function add(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c >= a); return c; } function max64(uint64 a, uint64 b) internal constant returns (uint64) { return a >= b ? a : b; } function min64(uint64 a, uint64 b) internal constant returns (uint64) { return a < b ? a : b; } function max256(uint256 a, uint256 b) internal constant returns (uint256) { return a >= b ? a : b; } function min256(uint256 a, uint256 b) internal constant returns (uint256) { return a < b ? a : b; } } ================================================ FILE: contracts/StatusContribution.sol ================================================ pragma solidity ^0.4.11; /* Copyright 2017, Jordi Baylina This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /// @title StatusContribution Contract /// @author Jordi Baylina /// @dev This contract will be the SNT controller during the contribution period. /// This contract will determine the rules during this period. /// Final users will generally not interact directly with this contract. ETH will /// be sent to the SNT token contract. The ETH is sent to this contract and from here, /// ETH is sent to the contribution walled and SNTs are mined according to the defined /// rules. import "./Owned.sol"; import "./MiniMeToken.sol"; import "./DynamicCeiling.sol"; import "./SafeMath.sol"; import "./ERC20Token.sol"; contract StatusContribution is Owned, TokenController { using SafeMath for uint256; uint256 constant public failSafeLimit = 300000 ether; uint256 constant public maxGuaranteedLimit = 30000 ether; uint256 constant public exchangeRate = 10000; uint256 constant public maxGasPrice = 50000000000; uint256 constant public maxCallFrequency = 100; MiniMeToken public SGT; MiniMeToken public SNT; uint256 public startBlock; uint256 public endBlock; address public destEthDevs; address public destTokensDevs; address public destTokensReserve; uint256 public maxSGTSupply; address public destTokensSgt; DynamicCeiling public dynamicCeiling; address public sntController; mapping (address => uint256) public guaranteedBuyersLimit; mapping (address => uint256) public guaranteedBuyersBought; uint256 public totalGuaranteedCollected; uint256 public totalNormalCollected; uint256 public finalizedBlock; uint256 public finalizedTime; mapping (address => uint256) public lastCallBlock; bool public paused; modifier initialized() { require(address(SNT) != 0x0); _; } modifier contributionOpen() { require(getBlockNumber() >= startBlock && getBlockNumber() <= endBlock && finalizedBlock == 0 && address(SNT) != 0x0); _; } modifier notPaused() { require(!paused); _; } function StatusContribution() { paused = false; } /// @notice This method should be called by the owner before the contribution /// period starts This initializes most of the parameters /// @param _snt Address of the SNT token contract /// @param _sntController Token controller for the SNT that will be transferred after /// the contribution finalizes. /// @param _startBlock Block when the contribution period starts /// @param _endBlock The last block that the contribution period is active /// @param _dynamicCeiling Address of the contract that controls the ceiling /// @param _destEthDevs Destination address where the contribution ether is sent /// @param _destTokensReserve Address where the tokens for the reserve are sent /// @param _destTokensSgt Address of the exchanger SGT-SNT where the SNT are sent /// to be distributed to the SGT holders. /// @param _destTokensDevs Address where the tokens for the dev are sent /// @param _sgt Address of the SGT token contract /// @param _maxSGTSupply Quantity of SGT tokens that would represent 10% of status. function initialize( address _snt, address _sntController, uint256 _startBlock, uint256 _endBlock, address _dynamicCeiling, address _destEthDevs, address _destTokensReserve, address _destTokensSgt, address _destTokensDevs, address _sgt, uint256 _maxSGTSupply ) public onlyOwner { // Initialize only once require(address(SNT) == 0x0); SNT = MiniMeToken(_snt); require(SNT.totalSupply() == 0); require(SNT.controller() == address(this)); require(SNT.decimals() == 18); // Same amount of decimals as ETH require(_sntController != 0x0); sntController = _sntController; require(_startBlock >= getBlockNumber()); require(_startBlock < _endBlock); startBlock = _startBlock; endBlock = _endBlock; require(_dynamicCeiling != 0x0); dynamicCeiling = DynamicCeiling(_dynamicCeiling); require(_destEthDevs != 0x0); destEthDevs = _destEthDevs; require(_destTokensReserve != 0x0); destTokensReserve = _destTokensReserve; require(_destTokensSgt != 0x0); destTokensSgt = _destTokensSgt; require(_destTokensDevs != 0x0); destTokensDevs = _destTokensDevs; require(_sgt != 0x0); SGT = MiniMeToken(_sgt); require(_maxSGTSupply >= MiniMeToken(SGT).totalSupply()); maxSGTSupply = _maxSGTSupply; } /// @notice Sets the limit for a guaranteed address. All the guaranteed addresses /// will be able to get SNTs during the contribution period with his own /// specific limit. /// This method should be called by the owner after the initialization /// and before the contribution starts. /// @param _th Guaranteed address /// @param _limit Limit for the guaranteed address. function setGuaranteedAddress(address _th, uint256 _limit) public initialized onlyOwner { require(getBlockNumber() < startBlock); require(_limit > 0 && _limit <= maxGuaranteedLimit); guaranteedBuyersLimit[_th] = _limit; GuaranteedAddress(_th, _limit); } /// @notice If anybody sends Ether directly to this contract, consider he is /// getting SNTs. function () public payable notPaused { proxyPayment(msg.sender); } ////////// // MiniMe Controller functions ////////// /// @notice This method will generally be called by the SNT token contract to /// acquire SNTs. Or directly from third parties that want to acquire SNTs in /// behalf of a token holder. /// @param _th SNT holder where the SNTs will be minted. function proxyPayment(address _th) public payable notPaused initialized contributionOpen returns (bool) { require(_th != 0x0); if (guaranteedBuyersLimit[_th] > 0) { buyGuaranteed(_th); } else { buyNormal(_th); } return true; } function onTransfer(address, address, uint256) public returns (bool) { return false; } function onApprove(address, address, uint256) public returns (bool) { return false; } function buyNormal(address _th) internal { require(tx.gasprice <= maxGasPrice); // Antispam mechanism address caller; if (msg.sender == address(SNT)) { caller = _th; } else { caller = msg.sender; } // Do not allow contracts to game the system require(!isContract(caller)); require(getBlockNumber().sub(lastCallBlock[caller]) >= maxCallFrequency); lastCallBlock[caller] = getBlockNumber(); uint256 toCollect = dynamicCeiling.toCollect(totalNormalCollected); uint256 toFund; if (msg.value <= toCollect) { toFund = msg.value; } else { toFund = toCollect; } totalNormalCollected = totalNormalCollected.add(toFund); doBuy(_th, toFund, false); } function buyGuaranteed(address _th) internal { uint256 toCollect = guaranteedBuyersLimit[_th]; uint256 toFund; if (guaranteedBuyersBought[_th].add(msg.value) > toCollect) { toFund = toCollect.sub(guaranteedBuyersBought[_th]); } else { toFund = msg.value; } guaranteedBuyersBought[_th] = guaranteedBuyersBought[_th].add(toFund); totalGuaranteedCollected = totalGuaranteedCollected.add(toFund); doBuy(_th, toFund, true); } function doBuy(address _th, uint256 _toFund, bool _guaranteed) internal { assert(msg.value >= _toFund); // Not needed, but double check. assert(totalCollected() <= failSafeLimit); if (_toFund > 0) { uint256 tokensGenerated = _toFund.mul(exchangeRate); assert(SNT.generateTokens(_th, tokensGenerated)); destEthDevs.transfer(_toFund); NewSale(_th, _toFund, tokensGenerated, _guaranteed); } uint256 toReturn = msg.value.sub(_toFund); if (toReturn > 0) { // If the call comes from the Token controller, // then we return it to the token Holder. // Otherwise we return to the sender. if (msg.sender == address(SNT)) { _th.transfer(toReturn); } else { msg.sender.transfer(toReturn); } } } // NOTE on Percentage format // Right now, Solidity does not support decimal numbers. (This will change very soon) // So in this contract we use a representation of a percentage that consist in // expressing the percentage in "x per 10**18" // This format has a precision of 16 digits for a percent. // Examples: // 3% = 3*(10**16) // 100% = 100*(10**16) = 10**18 // // To get a percentage of a value we do it by first multiplying it by the percentage in (x per 10^18) // and then divide it by 10**18 // // Y * X(in x per 10**18) // X% of Y = ------------------------- // 100(in x per 10**18) // /// @notice This method will can be called by the owner before the contribution period /// end or by anybody after the `endBlock`. This method finalizes the contribution period /// by creating the remaining tokens and transferring the controller to the configured /// controller. function finalize() public initialized { require(getBlockNumber() >= startBlock); require(msg.sender == owner || getBlockNumber() > endBlock); require(finalizedBlock == 0); // Do not allow termination until all curves revealed. require(dynamicCeiling.allRevealed()); // Allow premature finalization if final limit is reached if (getBlockNumber() <= endBlock) { var (,lastLimit,,) = dynamicCeiling.curves(dynamicCeiling.revealedCurves().sub(1)); require(totalNormalCollected >= lastLimit); } finalizedBlock = getBlockNumber(); finalizedTime = now; uint256 percentageToSgt; if (SGT.totalSupply() >= maxSGTSupply) { percentageToSgt = percent(10); // 10% } else { // // SGT.totalSupply() // percentageToSgt = 10% * ------------------- // maxSGTSupply // percentageToSgt = percent(10).mul(SGT.totalSupply()).div(maxSGTSupply); } uint256 percentageToDevs = percent(20); // 20% // // % To Contributors = 41% + (10% - % to SGT holders) // uint256 percentageToContributors = percent(41).add(percent(10).sub(percentageToSgt)); uint256 percentageToReserve = percent(29); // SNT.totalSupply() -> Tokens minted during the contribution // totalTokens -> Total tokens that should be after the allocation // of devTokens, sgtTokens and reserve // percentageToContributors -> Which percentage should go to the // contribution participants // (x per 10**18 format) // percent(100) -> 100% in (x per 10**18 format) // // percentageToContributors // SNT.totalSupply() = -------------------------- * totalTokens => // percent(100) // // // percent(100) // => totalTokens = ---------------------------- * SNT.totalSupply() // percentageToContributors // uint256 totalTokens = SNT.totalSupply().mul(percent(100)).div(percentageToContributors); // Generate tokens for SGT Holders. // // percentageToReserve // reserveTokens = ----------------------- * totalTokens // percentage(100) // assert(SNT.generateTokens( destTokensReserve, totalTokens.mul(percentageToReserve).div(percent(100)))); // // percentageToSgt // sgtTokens = ----------------------- * totalTokens // percentage(100) // assert(SNT.generateTokens( destTokensSgt, totalTokens.mul(percentageToSgt).div(percent(100)))); // // percentageToDevs // devTokens = ----------------------- * totalTokens // percentage(100) // assert(SNT.generateTokens( destTokensDevs, totalTokens.mul(percentageToDevs).div(percent(100)))); SNT.changeController(sntController); Finalized(); } function percent(uint256 p) internal returns (uint256) { return p.mul(10**16); } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) return false; uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } ////////// // Constant functions ////////// /// @return Total tokens issued in weis. function tokensIssued() public constant returns (uint256) { return SNT.totalSupply(); } /// @return Total Ether collected. function totalCollected() public constant returns (uint256) { return totalNormalCollected.add(totalGuaranteedCollected); } ////////// // Testing specific methods ////////// /// @notice This function is overridden by the test Mocks. function getBlockNumber() internal constant returns (uint256) { return block.number; } ////////// // Safety Methods ////////// /// @notice This method can be used by the controller to extract mistakenly /// sent tokens to this contract. /// @param _token The address of the token contract that you want to recover /// set to 0 in case you want to extract ether. function claimTokens(address _token) public onlyOwner { if (SNT.controller() == address(this)) { SNT.claimTokens(_token); } if (_token == 0x0) { owner.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint256 balance = token.balanceOf(this); token.transfer(owner, balance); ClaimedTokens(_token, owner, balance); } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyOwner { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyOwner { paused = false; } event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); event NewSale(address indexed _th, uint256 _amount, uint256 _tokens, bool _guaranteed); event GuaranteedAddress(address indexed _th, uint256 _limit); event Finalized(); } ================================================ FILE: contracts/test/DevTokensHolderMock.sol ================================================ pragma solidity ^0.4.11; import '../DevTokensHolder.sol'; // @dev DevTokensHolderMock mocks current block number contract DevTokensHolderMock is DevTokensHolder { uint mock_time; function DevTokensHolderMock(address _owner, address _contribution, address _snt) DevTokensHolder(_owner, _contribution, _snt) { mock_time = now; } function getTime() internal returns (uint) { return mock_time; } function setMockedTime(uint _t) { mock_time = _t; } } ================================================ FILE: contracts/test/ExternalToken.sol ================================================ pragma solidity ^0.4.11; import "../MiniMeToken.sol"; contract ExternalToken is MiniMeToken { function ExternalToken(address _tokenFactory) MiniMeToken( _tokenFactory, 0x0, // no parent token 0, // no snapshot block number from parent "External Token for testing", // Token name 1, // Decimals "EXT", // Symbol true // Enable transfers ) {} } ================================================ FILE: contracts/test/Migrations.sol ================================================ pragma solidity ^0.4.11; contract Migrations { address public owner; uint public last_completed_migration; modifier restricted() { if (msg.sender == owner) _; } function Migrations() { owner = msg.sender; } function setCompleted(uint completed) restricted { last_completed_migration = completed; } function upgrade(address new_address) restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } } ================================================ FILE: contracts/test/SGTExchangerMock.sol ================================================ pragma solidity ^0.4.11; import '../SGTExchanger.sol'; // @dev SGTExchangerMock mocks current block number contract SGTExchangerMock is SGTExchanger { function SGTExchangerMock(address _sgt, address _snt, address _statusContribution) SGTExchanger(_sgt, _snt, _statusContribution) {} function getBlockNumber() internal constant returns (uint) { return mock_blockNumber; } function setMockedBlockNumber(uint _b) public { mock_blockNumber = _b; } uint public mock_blockNumber = 1; } ================================================ FILE: contracts/test/SGTMock.sol ================================================ pragma solidity ^0.4.11; import '../SGT.sol'; // @dev SGTMock mocks current block number contract SGTMock is SGT { function SGTMock(address _tokenFactory) SGT(_tokenFactory) {} function getBlockNumber() internal constant returns (uint) { return mock_blockNumber; } function setMockedBlockNumber(uint _b) public { mock_blockNumber = _b; } uint mock_blockNumber = 1; } ================================================ FILE: contracts/test/SNTMock.sol ================================================ pragma solidity ^0.4.11; import '../SNT.sol'; // @dev SNTMock mocks current block number contract SNTMock is SNT { function SNTMock(address _tokenFactory) SNT(_tokenFactory) {} function getBlockNumber() internal constant returns (uint) { return mock_blockNumber; } function setMockedBlockNumber(uint _b) public { mock_blockNumber = _b; } uint mock_blockNumber = 1; } ================================================ FILE: contracts/test/SNTPlaceHolderMock.sol ================================================ pragma solidity ^0.4.11; import '../SNTPlaceHolder.sol'; // @dev SNTPlaceHolderMock mocks current block number contract SNTPlaceHolderMock is SNTPlaceHolder { uint mock_time; function SNTPlaceHolderMock(address _owner, address _snt, address _contribution, address _sgtExchanger) SNTPlaceHolder(_owner, _snt, _contribution, _sgtExchanger) { mock_time = now; } function getTime() internal returns (uint) { return mock_time; } function setMockedTime(uint _t) public { mock_time = _t; } } ================================================ FILE: contracts/test/StatusContributionMock.sol ================================================ pragma solidity ^0.4.11; import '../StatusContribution.sol'; // @dev StatusContributionMock mocks current block number contract StatusContributionMock is StatusContribution { function StatusContributionMock() StatusContribution() {} function getBlockNumber() internal constant returns (uint) { return mock_blockNumber; } function setMockedBlockNumber(uint _b) public { mock_blockNumber = _b; } uint mock_blockNumber = 1; } ================================================ FILE: migrations/1_initial_migration.js ================================================ var Migrations = artifacts.require("./Migrations.sol"); module.exports = function(deployer) { deployer.deploy(Migrations); }; ================================================ FILE: migrations/2_deploy_contracts.js ================================================ const randomBytes = require("random-bytes"); const MultiSigWallet = artifacts.require("MultiSigWallet"); const MiniMeTokenFactory = artifacts.require("MiniMeTokenFactory"); const SGT = artifacts.require("SGT"); const SNT = artifacts.require("SNT"); const StatusContribution= artifacts.require("StatusContribution"); const ContributionWallet = artifacts.require("ContributionWallet"); const DevTokensHolder = artifacts.require("DevTokensHolder"); const SGTExchanger = artifacts.require("SGTExchanger"); const DynamicCeiling = artifacts.require("DynamicCeiling"); const SNTPlaceHolder = artifacts.require("SNTPlaceHolder"); // Set hidden curves const setHiddenCurves = async function(dynamicCeiling, curves, nHiddenCurves) { let hashes = []; let i = 0; for (let c of curves) { let salt = await randomBytes(32); console.log(`Curve ${i} has salt: ${salt.toString("hex")}`); let h = await dynamicCeiling.calculateHash(c[0], c[1], c[2], i === curves.length - 1, salt); hashes.push(h); i += 1; } for (; i < nHiddenCurves; i += 1) { let salt = randomBytes(32); hashes.push(web3.sha3(salt)); } await dynamicCeiling.setHiddenCurves(hashes); console.log(`${i} curves set!`); }; // All of these constants need to be configured before deploy const addressOwner = "0xf93df8c288b9020e76583a6997362e89e0599e99"; const addressesStatus = [ "0x2ca9d4d0fd9622b08de76c1d484e69a6311db765", ]; const multisigStatusReqs = 1 const addressesCommunity = [ "0x166ddbcfe4d5849b0c62063747966a13706a4af7", ]; const multisigCommunityReqs = 1 const addressesReserve = [ "0x4781fee94e7257ffb6e3a3dcc5f8571ddcc02109", ]; const multisigReserveReqs = 1 const addressesDevs = [ "0xcee9f54a23324867d8537589ba8dc6c8a6e9d0b9", ]; const multisigDevsReqs = 1 const addressSGT = ""; const startBlock = 3800000; const endBlock = 3900000; const maxSGTSupply = 500000000; const curves = [ [web3.toWei(1000), 30, 10**12], [web3.toWei(21000), 30, 10**12], [web3.toWei(61000), 30, 10**12], ]; const nHiddenCurves = 7; module.exports = async function(deployer, network, accounts) { if (network === "development") return; // Don't deploy on tests // MultiSigWallet send let multisigStatusFuture = MultiSigWallet.new(addressesStatus, multisigStatusReqs); let multisigCommunityFuture = MultiSigWallet.new(addressesCommunity, multisigCommunityReqs); let multisigReserveFuture = MultiSigWallet.new(addressesReserve, multisigReserveReqs); let multisigDevsFuture = MultiSigWallet.new(addressesDevs, multisigDevsReqs); // MiniMeTokenFactory send let miniMeTokenFactoryFuture = MiniMeTokenFactory.new(); // MultiSigWallet wait let multisigStatus = await multisigStatusFuture; console.log("\nMultiSigWallet Status: " + multisigStatus.address); let multisigCommunity = await multisigCommunityFuture; console.log("MultiSigWallet Community: " + multisigCommunity.address); let multisigReserve = await multisigReserveFuture; console.log("MultiSigWallet Reserve: " + multisigReserve.address); let multisigDevs = await multisigDevsFuture; console.log("MultiSigWallet Devs: " + multisigDevs.address); // MiniMeTokenFactory wait let miniMeTokenFactory = await miniMeTokenFactoryFuture; console.log("MiniMeTokenFactory: " + miniMeTokenFactory.address); console.log(); // SGT send let sgtFuture; if (addressSGT.length === 0) { // Testnet sgtFuture = SGT.new(miniMeTokenFactory.address); } else { sgtFuture = SGT.at(addressSGT); } // SNT send let sntFuture = SNT.new(miniMeTokenFactory.address); // StatusContribution send let statusContributionFuture = StatusContribution.new(); // SGT wait let sgt = await sgtFuture; console.log("SGT: " + sgt.address); // SNT wait let snt = await sntFuture; console.log("SNT: " + snt.address); // StatusContribution wait let statusContribution = await statusContributionFuture; console.log("StatusContribution: " + statusContribution.address); console.log(); // SNT initialize checkpoints for 0th TX gas savings await snt.generateTokens('0x0', 1); await snt.destroyTokens('0x0', 1); // SNT changeController send let sntChangeControllerFuture = snt.changeController(statusContribution.address); // ContributionWallet send let contributionWalletFuture = ContributionWallet.new( multisigStatus.address, endBlock, statusContribution.address); // DevTokensHolder send let devTokensHolderFuture = DevTokensHolder.new( multisigDevs.address, statusContribution.address, snt.address); // SGTExchanger send let sgtExchangerFuture = SGTExchanger.new(sgt.address, snt.address, statusContribution.address); // DynamicCeiling send let dynamicCeilingFuture = DynamicCeiling.new(addressOwner, statusContribution.address); // SNT changeController wait await sntChangeControllerFuture; console.log("SNT changed controller!"); // ContributionWallet wait let contributionWallet = await contributionWalletFuture; console.log("ContributionWallet: " + contributionWallet.address); // DevTokensHolder wait let devTokensHolder = await devTokensHolderFuture; console.log("DevTokensHolder: " + devTokensHolder.address); // SGTExchanger wait let sgtExchanger = await sgtExchangerFuture; console.log("SGTExchanger: " + sgtExchanger.address); // DynamicCeiling wait let dynamicCeiling = await dynamicCeilingFuture; console.log("DynamicCeiling: " + dynamicCeiling.address); console.log(); // DynamicCeiling setHiddenCurves send let dynamicCeilingSetHiddenCurvesFuture = setHiddenCurves(dynamicCeiling, curves, nHiddenCurves); console.log(); // SNTPlaceHolder send let sntPlaceHolderFuture = SNTPlaceHolder.new( multisigCommunity.address, snt.address, statusContribution.address, sgtExchanger.address); // DynamicCeiling setHiddenCurves wait await dynamicCeilingSetHiddenCurvesFuture; console.log("DynamicCeiling hidden curves set!"); // SNTPlaceHolder wait let sntPlaceHolder = await sntPlaceHolderFuture; console.log("SNTPlaceHolder: " + sntPlaceHolder.address); console.log(); // StatusContribution initialize send/wait await statusContribution.initialize( snt.address, sntPlaceHolder.address, startBlock, endBlock, dynamicCeiling.address, contributionWallet.address, multisigReserve.address, sgtExchanger.address, devTokensHolder.address, sgt.address, maxSGTSupply); console.log("StatusContribution initialized!"); }; ================================================ FILE: mypy.ini ================================================ [mypy] warn_redundant_casts = True warn_unused_ignores = True strict_optional = True disallow_untyped_calls = True disallow_untyped_defs = True disallow_subclassing_any = True check_untyped_defs = True warn_return_any = True ================================================ FILE: package.json ================================================ { "name": "status-network-token", "version": "0.1.0", "description": "Status network token", "repository": { "type": "git", "url": "git+https://github.com/status-im/status-network-token.git" }, "license": "GPL-3.0", "bugs": { "url": "https://github.com/status-im/status-network-token/issues" }, "homepage": "https://github.com/status-im/status-network-token", "devDependencies": { "async": "^2.4.0", "bignumber.js": "^4.0.2", "ethereumjs-testrpc": "^3.0.5", "random-bytes": "^1.0.0", "truffle": "3.2.4", "truffle-hdwallet-provider": "0.0.3", "web3": "^0.18.4" }, "dependencies": {}, "main": "truffle.js", "directories": { "test": "test" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Status Research & Development" } ================================================ FILE: scripts/ceiling_curve_calc.py ================================================ #!/usr/bin/env python3 ''' Calculate ceiling characteristics based on curve parameters ''' import argparse import decimal from decimal import Decimal import math import statistics import sys from typing import List, Sequence decimal.getcontext().rounding = decimal.ROUND_DOWN def args_parse(arguments: Sequence[str] = None) -> argparse.Namespace: ''' Parse arguments ''' par0 = argparse.ArgumentParser( description='Calculate ceiling characteristics based on curve parameters') # Required par0.add_argument('--limit', metavar='LIMIT', required=True, type=Decimal, help='Ceiling limit') par0.add_argument('--curve-factor', metavar='FACTOR', required=True, type=Decimal, help='Curve factor') # Optional par0.add_argument('--collected-start', metavar='WEI', type=Decimal, default=Decimal('0'), help='Amount collected at start of curve') par0.add_argument('--gas-per-tx-1st', metavar='AMOUNT', type=Decimal, default=Decimal('151070'), help='Gas used per 1st transaction') par0.add_argument('--gas-per-tx-2nd', metavar='AMOUNT', type=Decimal, default=Decimal('123765'), help='Gas used for all subsequent transactions') par0.add_argument('--gas-price', metavar='WEI', type=Decimal, default=Decimal('50000000000'), help='Gas price') par0.add_argument('--fee-token', metavar='FRACTION', type=Decimal, default=Decimal('0.1'), help='Max fee cost as fraction of token value') par0.add_argument('--collect-min', metavar='WEI', type=Decimal, help='Minimum collection amount') par0.add_argument('--gas-limit', metavar='AMOUNT', type=Decimal, default=Decimal('4700000'), help='Gas limit per block') par0.add_argument('--secs-per-block', metavar='SECONDS', type=Decimal, default=Decimal('16.07'), help='Average seconds per block') par0.add_argument('--print-txs', action='store_true', default=False, help='Print every individual transaction') par0.add_argument('--txs-per-address', metavar='NUMBER', type=Decimal, default=Decimal('1'), help='Average number of TXs per address') par0.add_argument( '--congestion', metavar='FRACTION', type=Decimal, default=Decimal('0.8'), help='Chance of contribution TXs being confirmed due to network congestion' ) par0.add_argument('--collect-mean', metavar='FRACTION', type=Decimal, default=Decimal('0.9'), help='Collected of TX from amount possible') args0 = par0.parse_args(arguments) if args0.txs_per_address < 1: print('--txs-per-address can\'t be less than 1', file=sys.stderr) sys.exit(1) return args0 def transactions_calc( limit: Decimal, curve_factor: Decimal, collect_minimum: Decimal, collect_mean: Decimal, collected_start: Decimal = Decimal(0), ) -> List[Decimal]: ''' Calculate transactions ''' collected = collected_start transactions = [] while True: difference = limit - collected to_collect = difference / curve_factor if to_collect <= collect_minimum: if difference > collect_minimum: to_collect = collect_minimum to_collect *= collect_mean else: to_collect = difference else: to_collect *= collect_mean collected += to_collect transactions.append(to_collect) if collected >= limit: break return transactions def fmt_wei(value: Decimal, shift: bool = True) -> str: ''' Format wei value ''' fmt_val = f'{value:.0f}' if shift: return f'{"w" + fmt_val: >26}' # type: ignore return f'{"w" + fmt_val}' # type: ignore def fmt_eth(value: Decimal, shift: bool = True) -> str: ''' Format wei value into ether ''' fmt_val = f'{value / 10**18:.18f}' if shift: return f'{"Ξ" + fmt_val: >26}' # type: ignore return f'{"Ξ" + fmt_val}' # type: ignore def main() -> None: # pylint: disable=too-many-locals ''' Main ''' if ARGS.txs_per_address == 1: gas_per_tx = ARGS.gas_per_tx_1st else: gas_per_tx = ((ARGS.gas_per_tx_1st + (ARGS.gas_per_tx_2nd * (ARGS.txs_per_address - 1))) / ARGS.txs_per_address).to_integral_value(rounding=decimal.ROUND_HALF_EVEN) tx_fee = gas_per_tx * ARGS.gas_price tx_fee_token_limit = tx_fee / ARGS.fee_token collect_min = ARGS.collect_min if ARGS.collect_min is not None else tx_fee_token_limit transactions = transactions_calc( ARGS.limit, ARGS.curve_factor, collect_min, ARGS.collect_mean, collected_start=ARGS.collected_start, ) collect_fee_total = 0 collect_minimum_total = 0 for n, transaction in enumerate(transactions): if transaction <= collect_min: collect_minimum_total += 1 if transaction < tx_fee_token_limit: collect_fee_total += 1 if ARGS.print_txs: print(f'{(n + 1): >4}: {fmt_wei(transaction, shift=True)} ' f' {fmt_eth(transaction, shift=True)}') print() print( f'Average gas per TX: {gas_per_tx}\n' f'Average TX fee: {fmt_wei(tx_fee)} {fmt_eth(tx_fee)}\n' f'Token fee limit: {fmt_wei(tx_fee_token_limit)} {fmt_eth(tx_fee_token_limit)}\n' f'Minimum collect: {fmt_wei(collect_min)} {fmt_eth(collect_min)}' ) print() transactions_len = len(transactions) print( f'Number of TXs: {transactions_len}\n' f'Number of TXs <= minimum collect: {collect_minimum_total}\n' f'Number of TXs < token fee limit: {collect_fee_total}\n' f'Number of addresses: {transactions_len / ARGS.txs_per_address:.0f}' ) decimal.getcontext().rounding = decimal.ROUND_HALF_EVEN blocks = math.ceil((transactions_len * gas_per_tx) / (ARGS.gas_limit * ARGS.congestion)) print( f'Minimum blocks: {blocks}\n' f'Minimum time: {blocks * ARGS.secs_per_block:.2f}s' ) decimal.getcontext().rounding = decimal.ROUND_DOWN print() max_ = max(transactions) min_ = min(transactions) mean = statistics.mean(transactions) median = statistics.median(transactions) print( 'Collected:\n' f'Max: {fmt_wei(max_)} {fmt_eth(max_)}\n' f'Min: {fmt_wei(min_)} {fmt_eth(min_)}\n' f'Mean: {fmt_wei(mean)} {fmt_eth(mean)}\n' f'Median: {fmt_wei(median)} {fmt_eth(median)}' ) if transactions_len >= 2: stdev = statistics.stdev(transactions) print( f'Stdev: {fmt_wei(stdev)} {fmt_eth(stdev)}\n' ) if __name__ == '__main__': ARGS = args_parse() main() ================================================ FILE: scripts/sgtGeneration/deploy.js ================================================ var minimeFactoryAbi = [{"constant":false,"inputs":[{"name":"_parentToken","type":"address"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"}]; var minimeFactoryContract = web3.eth.contract(minimeFactoryAbi); var minimeFactory = minimeFactoryContract.new( { from: web3.eth.accounts[0], data: '0x6060604052341561000c57fe5b5b611e968061001c6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416635b7b72c1811461003a575bfe5b341561004257fe5b604080516020600460443581810135601f81018490048402850184019095528484526100e6948235600160a060020a031694602480359560649492939190920191819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a60ff8b35169a9099940197509195509182019350915081908401838280828437509496505050509135151591506101029050565b60408051600160a060020a039092168252519081900360200190f35b60006000308888888888886101156102db565b600160a060020a03808916825287166020808301919091526040820187905260ff8516608083015282151560c083015260e0606083018181528751918401919091528651909160a08401916101008501918901908083838215610193575b80518252602083111561019357601f199092019160209182019101610173565b505050905090810190601f1680156101bf5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156101fe575b8051825260208311156101fe57601f1990920191602091820191016101de565b505050905090810190601f16801561022a5780820380516001836020036101000a031916815260200191505b509950505050505050505050604051809103906000f080151561024957fe5b905080600160a060020a0316633cebb823336040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15156102bb57fe5b6102c65a03f115156102c957fe5b5050508091505b509695505050505050565b604051611b7f806102ec83390190560060a0604052600760608190527f4d4d545f302e3100000000000000000000000000000000000000000000000000608090815262000040916004919062000146565b5034156200004a57fe5b60405162001b7f38038062001b7f83398101604090815281516020830151918301516060840151608085015160a086015160c0870151949693949284019391929101905b5b60008054600160a060020a03191633600160a060020a03161790555b600b805461010060a860020a031916610100600160a060020a038a16021790558351620000e090600190602087019062000146565b506002805460ff191660ff851617905581516200010590600390602085019062000146565b5060058054600160a060020a031916600160a060020a0388161790556006859055600b805460ff1916821515179055436007555b50505050505050620001f0565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200018957805160ff1916838001178555620001b9565b82800160010185558215620001b9579182015b82811115620001b95782518255916020019190600101906200019c565b5b50620001c8929150620001cc565b5090565b620001ed91905b80821115620001c85760008155600101620001d3565b5090565b90565b61197f80620002006000396000f300606060405236156101225763ffffffff60e060020a60003504166306fdde0381146101e1578063095ea7b31461027157806317634514146102a457806318160ddd146102c657806323b872dd146102e8578063313ce567146103215780633cebb823146103475780634ee2cd7e1461036557806354fd4d50146103965780636638c0871461042657806370a08231146104e657806380a5400114610514578063827f32c01461054057806395d89b4114610573578063981b24d014610603578063a9059cbb14610628578063bef97c871461065b578063c5bcc4f11461067f578063cae9ca51146106a1578063d3ce77fe14610718578063dd62ed3e1461074b578063e77772fe1461077f578063f41e60c5146107ab578063f77c4791146107c2575b6101df5b60005461013b90600160a060020a03166107ee565b156101d657600080546040805160209081019390935280517ff48c3054000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301529151919092169263f48c30549234926024808301939282900301818588803b15156101ad57fe5b6125ee5a03f115156101bb57fe5b505060405151151591506101d190505760006000fd5b6101dc565b60006000fd5b5b565b005b34156101e957fe5b6101f161081b565b604080516020808252835181830152835191928392908301918501908083838215610237575b80518252602083111561023757601f199092019160209182019101610217565b505050905090810190601f1680156102635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561027957fe5b610290600160a060020a03600435166024356108a8565b604080519115158252519081900360200190f35b34156102ac57fe5b6102b4610a1a565b60408051918252519081900360200190f35b34156102ce57fe5b6102b4610a20565b60408051918252519081900360200190f35b34156102f057fe5b610290600160a060020a0360043581169060243516604435610a31565b604080519115158252519081900360200190f35b341561032957fe5b610331610ad4565b6040805160ff9092168252519081900360200190f35b341561034f57fe5b6101df600160a060020a0360043516610add565b005b341561036d57fe5b6102b4600160a060020a0360043516602435610b26565b60408051918252519081900360200190f35b341561039e57fe5b6101f1610c72565b604080516020808252835181830152835191928392908301918501908083838215610237575b80518252602083111561023757601f199092019160209182019101610217565b505050905090810190601f1680156102635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561042e57fe5b6104ca600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a60ff8b35169a909994019750919550918201935091508190840183828082843750949650508435946020013515159350610d0092505050565b60408051600160a060020a039092168252519081900360200190f35b34156104ee57fe5b6102b4600160a060020a0360043516610f60565b60408051918252519081900360200190f35b341561051c57fe5b6104ca610f74565b60408051600160a060020a039092168252519081900360200190f35b341561054857fe5b610290600160a060020a0360043516602435610f83565b604080519115158252519081900360200190f35b341561057b57fe5b6101f161105c565b604080516020808252835181830152835191928392908301918501908083838215610237575b80518252602083111561023757601f199092019160209182019101610217565b505050905090810190601f1680156102635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561060b57fe5b6102b46004356110ea565b60408051918252519081900360200190f35b341561063057fe5b610290600160a060020a03600435166024356111dc565b604080519115158252519081900360200190f35b341561066357fe5b610290611205565b604080519115158252519081900360200190f35b341561068757fe5b6102b461120e565b60408051918252519081900360200190f35b34156106a957fe5b604080516020600460443581810135601f8101849004840285018401909552848452610290948235600160a060020a031694602480359560649492939190920191819084018382808284375094965061121495505050505050565b604080519115158252519081900360200190f35b341561072057fe5b610290600160a060020a0360043516602435611339565b604080519115158252519081900360200190f35b341561075357fe5b6102b4600160a060020a036004358116906024351661140e565b60408051918252519081900360200190f35b341561078757fe5b6104ca61143b565b60408051600160a060020a039092168252519081900360200190f35b34156107b357fe5b6101df600435151561144f565b005b34156107ca57fe5b6104ca61147e565b60408051600160a060020a039092168252519081900360200190f35b600080600160a060020a038316151561080a5760009150610815565b823b90506000811191505b50919050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a05780601f10610875576101008083540402835291602001916108a0565b820191906000526020600020905b81548152906001019060200180831161088357829003601f168201915b505050505081565b600b5460009060ff1615156108bd5760006000fd5b81158015906108f05750600160a060020a0333811660009081526009602090815260408083209387168352929052205415155b156108fb5760006000fd5b60005461091090600160a060020a03166107ee565b156109b2576000805460408051602090810184905281517fda682aeb000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301528881166024830152604482018890529251929093169363da682aeb9360648082019492918390030190829087803b151561099057fe5b6102c65a03f1151561099e57fe5b505060405151151590506109b25760006000fd5b5b600160a060020a03338116600081815260096020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b60075481565b6000610a2b436110ea565b90505b90565b6000805433600160a060020a03908116911614610abf57600b5460ff161515610a5a5760006000fd5b600160a060020a038085166000908152600960209081526040808320339094168352929052205482901015610a9157506000610acd565b600160a060020a03808516600090815260096020908152604080832033909416835292905220805483900390555b610aca84848461148d565b90505b9392505050565b60025460ff1681565b60005433600160a060020a03908116911614610af95760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a0382166000908152600860205260408120541580610b865750600160a060020a038316600090815260086020526040812080548492908110610b6b57fe5b906000526020600020900160005b50546001608060020a0316115b15610c4257600554600160a060020a031615610c3557600554600654600160a060020a0390911690634ee2cd7e908590610bc1908690611675565b6000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1515610c1857fe5b6102c65a03f11515610c2657fe5b5050604051519150610a149050565b506000610a14565b610a14565b600160a060020a0383166000908152600860205260409020610c64908361168f565b9050610a14565b5b92915050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a05780601f10610875576101008083540402835291602001916108a0565b820191906000526020600020905b81548152906001019060200180831161088357829003601f168201915b505050505081565b600080831515610d0e574393505b600b60019054906101000a9004600160a060020a0316600160a060020a0316635b7b72c130868a8a8a896000604051602001526040518763ffffffff1660e060020a0281526004018087600160a060020a0316600160a060020a03168152602001868152602001806020018560ff1660ff1681526020018060200184151515158152602001838103835287818151815260200191508051906020019080838360008314610dd6575b805182526020831115610dd657601f199092019160209182019101610db6565b505050905090810190601f168015610e025780820380516001836020036101000a031916815260200191505b5083810382528551815285516020918201918701908083838215610e41575b805182526020831115610e4157601f199092019160209182019101610e21565b505050905090810190601f168015610e6d5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b1515610e8e57fe5b6102c65a03f11515610e9c57fe5b50506040805180517f3cebb823000000000000000000000000000000000000000000000000000000008252600160a060020a03338116600484015292519094509184169250633cebb82391602480830192600092919082900301818387803b1515610f0357fe5b6102c65a03f11515610f1157fe5b5050604080518681529051600160a060020a03841692507f086c875b377f900b07ce03575813022f05dd10ed7640b5282cf6d3c3fc352ade9181900360200190a28091505b5095945050505050565b6000610f6c8243610b26565b90505b919050565b600554600160a060020a031681565b600080548190819033600160a060020a03908116911614610fa45760006000fd5b610faf600a4361168f565b9150818483011015610fc15760006000fd5b610fce600a858401611805565b610fd785610f60565b9050808482011015610fe95760006000fd5b600160a060020a038516600090815260086020526040902061100d90828601611805565b604080518581529051600160a060020a038716916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a05780601f10610875576101008083540402835291602001916108a0565b820191906000526020600020905b81548152906001019060200180831161088357829003601f168201915b505050505081565b600a546000901580611123575081600a600081548110151561110857fe5b906000526020600020900160005b50546001608060020a0316115b156111c457600554600160a060020a0316156111b757600554600654600160a060020a039091169063981b24d09061115c908590611675565b6000604051602001526040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b151561119a57fe5b6102c65a03f115156111a857fe5b5050604051519150610f6f9050565b506000610f6f565b610f6f565b6111cf600a8361168f565b9050610f6f565b5b919050565b600b5460009060ff1615156111f15760006000fd5b6111fc33848461148d565b90505b92915050565b600b5460ff1681565b60065481565b600061122084846108a8565b151561122c5760006000fd5b83600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001806020018281038252838181518152602001915080519060200190808383600083146112d2575b8051825260208311156112d257601f1990920191602091820191016112b2565b505050905090810190601f1680156112fe5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561131c57fe5b6102c65a03f1151561132a57fe5b505050600190505b9392505050565b600080548190819033600160a060020a0390811691161461135a5760006000fd5b611365600a4361168f565b9150838210156113755760006000fd5b611382600a858403611805565b61138b85610f60565b90508381101561139b5760006000fd5b600160a060020a03851660009081526008602052604090206113bf90858303611805565b604080518581529051600091600160a060020a038816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b600160a060020a038083166000908152600960209081526040808320938516835292905220545b92915050565b600b546101009004600160a060020a031681565b60005433600160a060020a0390811691161461146b5760006000fd5b600b805460ff19168215151790555b5b50565b600054600160a060020a031681565b600080808315156114a1576001925061166c565b6006544390106114b15760006000fd5b600160a060020a03851615806114d8575030600160a060020a031685600160a060020a0316145b156114e35760006000fd5b6114ed8643610b26565b915083821015611500576000925061166c565b60005461151590600160a060020a03166107ee565b156115b7576000805460408051602090810184905281517f4a393149000000000000000000000000000000000000000000000000000000008152600160a060020a038b811660048301528a81166024830152604482018a905292519290931693634a3931499360648082019492918390030190829087803b151561159557fe5b6102c65a03f115156115a357fe5b505060405151151590506115b75760006000fd5b5b600160a060020a03861660009081526008602052604090206115dc90858403611805565b6115e68543610b26565b90508084820110156115f85760006000fd5b600160a060020a038516600090815260086020526040902061161c90828601611805565b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600192505b50509392505050565b600081831061168457816111fc565b825b90505b92915050565b60006000600060008580549050600014156116ad57600093506117fc565b8554869060001981019081106116bf57fe5b906000526020600020900160005b50546001608060020a03168510611724578554869060001981019081106116f057fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a031693506117fc565b85600081548110151561173357fe5b906000526020600020900160005b50546001608060020a031685101561175c57600093506117fc565b8554600093506000190191505b828211156117be5760026001838501015b04905084868281548110151561178c57fe5b906000526020600020900160005b50546001608060020a0316116117b2578092506117b9565b6001810391505b611769565b85838154811015156117cc57fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a031693505b50505092915050565b8154600090819015806118425750835443908590600019810190811061182757fe5b906000526020600020900160005b50546001608060020a0316105b156118b857835484906118588260018301611908565b8154811061186257fe5b906000526020600020900160005b5080546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff1990931692909217161781559150611901565b8354849060001981019081106118ca57fe5b906000526020600020900160005b5080546001608060020a0380861670010000000000000000000000000000000002911617815590505b5b50505050565b81548183558181151161192c5760008381526020902061192c918101908301611932565b5b505050565b610a2e91905b8082111561194c5760008155600101611938565b5090565b905600a165627a7a7230582057348ca0297970bb01202ce8022511ab041096fc938e17a211f6de719789f54e0029a165627a7a723058207f08e59b3da88e7db6ae63182ac584f5a56ccbe53f3a10d2ca155d5729ede5540029', gas: '3900000', gasPrice: eth.gasPrice.mul(1.1).floor() }, function (e, contract){ console.log(e, contract); if (typeof contract.address !== 'undefined') { console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash); } }); var _tokenFactory = minimeFactory.address ; var sgtAbi = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"creationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newController","type":"address"}],"name":"changeController","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_blockNumber","type":"uint256"}],"name":"balanceOfAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_cloneTokenName","type":"string"},{"name":"_cloneDecimalUnits","type":"uint8"},{"name":"_cloneTokenSymbol","type":"string"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"generateTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_blockNumber","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"data","type":"uint256[]"}],"name":"multiMint","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"transfersEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentSnapShotBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroyTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenFactory","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_transfersEnabled","type":"bool"}],"name":"enableTransfers","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_tokenFactory","type":"address"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_cloneToken","type":"address"},{"indexed":false,"name":"_snapshotBlock","type":"uint256"}],"name":"NewCloneToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Approval","type":"event"}]; var sgtContract = web3.eth.contract(sgtAbi); var sgt = sgtContract.new( _tokenFactory, { from: web3.eth.accounts[0], data: '0x60a0604052600760608190527f4d4d545f302e310000000000000000000000000000000000000000000000000060809081526200004091600491906200018f565b5034156200004a57fe5b60405160208062001cdf83398101604052515b8060006000604060405190810160405280601481526020017f5374617475732047656e6573697320546f6b656e0000000000000000000000008152506001604060405190810160405280600381526020017f534754000000000000000000000000000000000000000000000000000000000081525060005b5b60008054600160a060020a03191633600160a060020a03161790555b600b805461010060a860020a031916610100600160a060020a038a16021790558351620001279060019060208701906200018f565b506002805460ff191660ff851617905581516200014c9060039060208501906200018f565b5060058054600160a060020a031916600160a060020a0388161790556006859055600b805460ff1916821515179055436007555b505050505050505b5062000239565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620001d257805160ff191683800117855562000202565b8280016001018555821562000202579182015b8281111562000202578251825591602001919060010190620001e5565b5b506200021192915062000215565b5090565b6200023691905b808211156200021157600081556001016200021c565b5090565b90565b611a9680620002496000396000f3006060604052361561012d5763ffffffff60e060020a60003504166306fdde0381146101ec578063095ea7b31461027c57806317634514146102af57806318160ddd146102d157806323b872dd146102f3578063313ce5671461032c5780633cebb823146103525780634ee2cd7e1461037057806354fd4d50146103a15780636638c0871461043157806370a08231146104f157806380a540011461051f578063827f32c01461054b57806395d89b411461057e578063981b24d01461060e5780639a0e4ebb14610633578063a9059cbb14610688578063bef97c87146106bb578063c5bcc4f1146106df578063cae9ca5114610701578063d3ce77fe14610778578063dd62ed3e146107ab578063e77772fe146107df578063f41e60c51461080b578063f77c479114610822575b6101ea5b60005461014690600160a060020a031661084e565b156101e157600080546040805160209081019390935280517ff48c3054000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301529151919092169263f48c30549234926024808301939282900301818588803b15156101b857fe5b6125ee5a03f115156101c657fe5b505060405151151591506101dc90505760006000fd5b6101e7565b60006000fd5b5b565b005b34156101f457fe5b6101fc61087b565b604080516020808252835181830152835191928392908301918501908083838215610242575b80518252602083111561024257601f199092019160209182019101610222565b505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561028457fe5b61029b600160a060020a0360043516602435610908565b604080519115158252519081900360200190f35b34156102b757fe5b6102bf610a7a565b60408051918252519081900360200190f35b34156102d957fe5b6102bf610a80565b60408051918252519081900360200190f35b34156102fb57fe5b61029b600160a060020a0360043581169060243516604435610a91565b604080519115158252519081900360200190f35b341561033457fe5b61033c610b34565b6040805160ff9092168252519081900360200190f35b341561035a57fe5b6101ea600160a060020a0360043516610b3d565b005b341561037857fe5b6102bf600160a060020a0360043516602435610b86565b60408051918252519081900360200190f35b34156103a957fe5b6101fc610cd2565b604080516020808252835181830152835191928392908301918501908083838215610242575b80518252602083111561024257601f199092019160209182019101610222565b505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561043957fe5b6104d5600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a60ff8b35169a909994019750919550918201935091508190840183828082843750949650508435946020013515159350610d6092505050565b60408051600160a060020a039092168252519081900360200190f35b34156104f957fe5b6102bf600160a060020a0360043516610fc0565b60408051918252519081900360200190f35b341561052757fe5b6104d5610fd4565b60408051600160a060020a039092168252519081900360200190f35b341561055357fe5b61029b600160a060020a0360043516602435610fe3565b604080519115158252519081900360200190f35b341561058657fe5b6101fc6110bc565b604080516020808252835181830152835191928392908301918501908083838215610242575b80518252602083111561024257601f199092019160209182019101610222565b505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561061657fe5b6102bf60043561114a565b60408051918252519081900360200190f35b341561063b57fe5b6101ea60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061123c95505050505050565b005b341561069057fe5b61029b600160a060020a03600435166024356112f3565b604080519115158252519081900360200190f35b34156106c357fe5b61029b61131c565b604080519115158252519081900360200190f35b34156106e757fe5b6102bf611325565b60408051918252519081900360200190f35b341561070957fe5b604080516020600460443581810135601f810184900484028501840190955284845261029b948235600160a060020a031694602480359560649492939190920191819084018382808284375094965061132b95505050505050565b604080519115158252519081900360200190f35b341561078057fe5b61029b600160a060020a0360043516602435611450565b604080519115158252519081900360200190f35b34156107b357fe5b6102bf600160a060020a0360043581169060243516611525565b60408051918252519081900360200190f35b34156107e757fe5b6104d5611552565b60408051600160a060020a039092168252519081900360200190f35b341561081357fe5b6101ea6004351515611566565b005b341561082a57fe5b6104d5611595565b60408051600160a060020a039092168252519081900360200190f35b600080600160a060020a038316151561086a5760009150610875565b823b90506000811191505b50919050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109005780601f106108d557610100808354040283529160200191610900565b820191906000526020600020905b8154815290600101906020018083116108e357829003601f168201915b505050505081565b600b5460009060ff16151561091d5760006000fd5b81158015906109505750600160a060020a0333811660009081526009602090815260408083209387168352929052205415155b1561095b5760006000fd5b60005461097090600160a060020a031661084e565b15610a12576000805460408051602090810184905281517fda682aeb000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301528881166024830152604482018890529251929093169363da682aeb9360648082019492918390030190829087803b15156109f057fe5b6102c65a03f115156109fe57fe5b50506040515115159050610a125760006000fd5b5b600160a060020a03338116600081815260096020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b60075481565b6000610a8b4361114a565b90505b90565b6000805433600160a060020a03908116911614610b1f57600b5460ff161515610aba5760006000fd5b600160a060020a038085166000908152600960209081526040808320339094168352929052205482901015610af157506000610b2d565b600160a060020a03808516600090815260096020908152604080832033909416835292905220805483900390555b610b2a8484846115a4565b90505b9392505050565b60025460ff1681565b60005433600160a060020a03908116911614610b595760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a0382166000908152600860205260408120541580610be65750600160a060020a038316600090815260086020526040812080548492908110610bcb57fe5b906000526020600020900160005b50546001608060020a0316115b15610ca257600554600160a060020a031615610c9557600554600654600160a060020a0390911690634ee2cd7e908590610c2190869061178c565b6000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1515610c7857fe5b6102c65a03f11515610c8657fe5b5050604051519150610a749050565b506000610a74565b610a74565b600160a060020a0383166000908152600860205260409020610cc490836117a6565b9050610a74565b5b92915050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109005780601f106108d557610100808354040283529160200191610900565b820191906000526020600020905b8154815290600101906020018083116108e357829003601f168201915b505050505081565b600080831515610d6e574393505b600b60019054906101000a9004600160a060020a0316600160a060020a0316635b7b72c130868a8a8a896000604051602001526040518763ffffffff1660e060020a0281526004018087600160a060020a0316600160a060020a03168152602001868152602001806020018560ff1660ff1681526020018060200184151515158152602001838103835287818151815260200191508051906020019080838360008314610e36575b805182526020831115610e3657601f199092019160209182019101610e16565b505050905090810190601f168015610e625780820380516001836020036101000a031916815260200191505b5083810382528551815285516020918201918701908083838215610ea1575b805182526020831115610ea157601f199092019160209182019101610e81565b505050905090810190601f168015610ecd5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b1515610eee57fe5b6102c65a03f11515610efc57fe5b50506040805180517f3cebb823000000000000000000000000000000000000000000000000000000008252600160a060020a03338116600484015292519094509184169250633cebb82391602480830192600092919082900301818387803b1515610f6357fe5b6102c65a03f11515610f7157fe5b5050604080518681529051600160a060020a03841692507f086c875b377f900b07ce03575813022f05dd10ed7640b5282cf6d3c3fc352ade9181900360200190a28091505b5095945050505050565b6000610fcc8243610b86565b90505b919050565b600554600160a060020a031681565b600080548190819033600160a060020a039081169116146110045760006000fd5b61100f600a436117a6565b91508184830110156110215760006000fd5b61102e600a85840161191c565b61103785610fc0565b90508084820110156110495760006000fd5b600160a060020a038516600090815260086020526040902061106d9082860161191c565b604080518581529051600160a060020a038716916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109005780601f106108d557610100808354040283529160200191610900565b820191906000526020600020905b8154815290600101906020018083116108e357829003601f168201915b505050505081565b600a546000901580611183575081600a600081548110151561116857fe5b906000526020600020900160005b50546001608060020a0316115b1561122457600554600160a060020a03161561121757600554600654600160a060020a039091169063981b24d0906111bc90859061178c565b6000604051602001526040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15156111fa57fe5b6102c65a03f1151561120857fe5b5050604051519150610fcf9050565b506000610fcf565b610fcf565b61122f600a836117a6565b9050610fcf565b5b919050565b600080548190819033600160a060020a0390811691161461125d5760006000fd5b600092505b83518310156112eb578351600160a060020a039085908590811061128257fe5b906020019060200201511691507401000000000000000000000000000000000000000084848151811015156112b357fe5b906020019060200201518115156112c657fe5b0490506112d38282610fe3565b15156112df5760006000fd5b5b600190920191611262565b5b5b50505050565b600b5460009060ff1615156113085760006000fd5b6113133384846115a4565b90505b92915050565b600b5460ff1681565b60065481565b60006113378484610908565b15156113435760006000fd5b83600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001806020018281038252838181518152602001915080519060200190808383600083146113e9575b8051825260208311156113e957601f1990920191602091820191016113c9565b505050905090810190601f1680156114155780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561143357fe5b6102c65a03f1151561144157fe5b505050600190505b9392505050565b600080548190819033600160a060020a039081169116146114715760006000fd5b61147c600a436117a6565b91508382101561148c5760006000fd5b611499600a85840361191c565b6114a285610fc0565b9050838110156114b25760006000fd5b600160a060020a03851660009081526008602052604090206114d69085830361191c565b604080518581529051600091600160a060020a038816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b600160a060020a038083166000908152600960209081526040808320938516835292905220545b92915050565b600b546101009004600160a060020a031681565b60005433600160a060020a039081169116146115825760006000fd5b600b805460ff19168215151790555b5b50565b600054600160a060020a031681565b600080808315156115b85760019250611783565b6006544390106115c85760006000fd5b600160a060020a03851615806115ef575030600160a060020a031685600160a060020a0316145b156115fa5760006000fd5b6116048643610b86565b9150838210156116175760009250611783565b60005461162c90600160a060020a031661084e565b156116ce576000805460408051602090810184905281517f4a393149000000000000000000000000000000000000000000000000000000008152600160a060020a038b811660048301528a81166024830152604482018a905292519290931693634a3931499360648082019492918390030190829087803b15156116ac57fe5b6102c65a03f115156116ba57fe5b505060405151151590506116ce5760006000fd5b5b600160a060020a03861660009081526008602052604090206116f39085840361191c565b6116fd8543610b86565b905080848201101561170f5760006000fd5b600160a060020a03851660009081526008602052604090206117339082860161191c565b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600192505b50509392505050565b600081831061179b5781611313565b825b90505b92915050565b60006000600060008580549050600014156117c45760009350611913565b8554869060001981019081106117d657fe5b906000526020600020900160005b50546001608060020a0316851061183b5785548690600019810190811061180757fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a03169350611913565b85600081548110151561184a57fe5b906000526020600020900160005b50546001608060020a03168510156118735760009350611913565b8554600093506000190191505b828211156118d55760026001838501015b0490508486828154811015156118a357fe5b906000526020600020900160005b50546001608060020a0316116118c9578092506118d0565b6001810391505b611880565b85838154811015156118e357fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a031693505b50505092915050565b8154600090819015806119595750835443908590600019810190811061193e57fe5b906000526020600020900160005b50546001608060020a0316105b156119cf578354849061196f8260018301611a1f565b8154811061197957fe5b906000526020600020900160005b5080546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff19909316929092171617815591506112eb565b8354849060001981019081106119e157fe5b906000526020600020900160005b5080546001608060020a0380861670010000000000000000000000000000000002911617815590505b5b50505050565b815481835581811511611a4357600083815260209020611a43918101908301611a49565b5b505050565b610a8e91905b80821115611a635760008155600101611a4f565b5090565b905600a165627a7a7230582089f20df28756d7605d82438014b8d7a74992c4df8692e8aec73af24dbc1fffa80029', gas: '3900000', gasPrice: eth.gasPrice.mul(1.1).floor() }, function (e, contract){ console.log(e, contract); if (typeof contract.address !== 'undefined') { console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash); } }); //////// var minimeFactoryAbi = [{"constant":false,"inputs":[{"name":"_parentToken","type":"address"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"}]; var minimeFactory = eth.contract(minimeFactoryAbi).at("0x1308a7ec3e82bcd3b63ada5f5dc27586ad8605ba"); var sgtAbi = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"creationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newController","type":"address"}],"name":"changeController","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_blockNumber","type":"uint256"}],"name":"balanceOfAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_cloneTokenName","type":"string"},{"name":"_cloneDecimalUnits","type":"uint8"},{"name":"_cloneTokenSymbol","type":"string"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"generateTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_blockNumber","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"data","type":"uint256[]"}],"name":"multiMint","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"transfersEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentSnapShotBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroyTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenFactory","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_transfersEnabled","type":"bool"}],"name":"enableTransfers","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_tokenFactory","type":"address"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_cloneToken","type":"address"},{"indexed":false,"name":"_snapshotBlock","type":"uint256"}],"name":"NewCloneToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Approval","type":"event"}]; var sgt = eth.contract(sgtAbi).at("0xd248b0d48e44aaf9c49aea0312be7e13a6dc1468") ================================================ FILE: scripts/sgtGeneration/deploy_test.js ================================================ var minimeFactoryAbi = [{"constant":false,"inputs":[{"name":"_parentToken","type":"address"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"}]; var minimeFactoryContract = web3.eth.contract(minimeFactoryAbi); var minimeFactory = minimeFactoryContract.new( { from: web3.eth.accounts[0], data: '0x6060604052341561000c57fe5b5b611e968061001c6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416635b7b72c1811461003a575bfe5b341561004257fe5b604080516020600460443581810135601f81018490048402850184019095528484526100e6948235600160a060020a031694602480359560649492939190920191819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a60ff8b35169a9099940197509195509182019350915081908401838280828437509496505050509135151591506101029050565b60408051600160a060020a039092168252519081900360200190f35b60006000308888888888886101156102db565b600160a060020a03808916825287166020808301919091526040820187905260ff8516608083015282151560c083015260e0606083018181528751918401919091528651909160a08401916101008501918901908083838215610193575b80518252602083111561019357601f199092019160209182019101610173565b505050905090810190601f1680156101bf5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156101fe575b8051825260208311156101fe57601f1990920191602091820191016101de565b505050905090810190601f16801561022a5780820380516001836020036101000a031916815260200191505b509950505050505050505050604051809103906000f080151561024957fe5b905080600160a060020a0316633cebb823336040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15156102bb57fe5b6102c65a03f115156102c957fe5b5050508091505b509695505050505050565b604051611b7f806102ec83390190560060a0604052600760608190527f4d4d545f302e3100000000000000000000000000000000000000000000000000608090815262000040916004919062000146565b5034156200004a57fe5b60405162001b7f38038062001b7f83398101604090815281516020830151918301516060840151608085015160a086015160c0870151949693949284019391929101905b5b60008054600160a060020a03191633600160a060020a03161790555b600b805461010060a860020a031916610100600160a060020a038a16021790558351620000e090600190602087019062000146565b506002805460ff191660ff851617905581516200010590600390602085019062000146565b5060058054600160a060020a031916600160a060020a0388161790556006859055600b805460ff1916821515179055436007555b50505050505050620001f0565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200018957805160ff1916838001178555620001b9565b82800160010185558215620001b9579182015b82811115620001b95782518255916020019190600101906200019c565b5b50620001c8929150620001cc565b5090565b620001ed91905b80821115620001c85760008155600101620001d3565b5090565b90565b61197f80620002006000396000f300606060405236156101225763ffffffff60e060020a60003504166306fdde0381146101e1578063095ea7b31461027157806317634514146102a457806318160ddd146102c657806323b872dd146102e8578063313ce567146103215780633cebb823146103475780634ee2cd7e1461036557806354fd4d50146103965780636638c0871461042657806370a08231146104e657806380a5400114610514578063827f32c01461054057806395d89b4114610573578063981b24d014610603578063a9059cbb14610628578063bef97c871461065b578063c5bcc4f11461067f578063cae9ca51146106a1578063d3ce77fe14610718578063dd62ed3e1461074b578063e77772fe1461077f578063f41e60c5146107ab578063f77c4791146107c2575b6101df5b60005461013b90600160a060020a03166107ee565b156101d657600080546040805160209081019390935280517ff48c3054000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301529151919092169263f48c30549234926024808301939282900301818588803b15156101ad57fe5b6125ee5a03f115156101bb57fe5b505060405151151591506101d190505760006000fd5b6101dc565b60006000fd5b5b565b005b34156101e957fe5b6101f161081b565b604080516020808252835181830152835191928392908301918501908083838215610237575b80518252602083111561023757601f199092019160209182019101610217565b505050905090810190601f1680156102635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561027957fe5b610290600160a060020a03600435166024356108a8565b604080519115158252519081900360200190f35b34156102ac57fe5b6102b4610a1a565b60408051918252519081900360200190f35b34156102ce57fe5b6102b4610a20565b60408051918252519081900360200190f35b34156102f057fe5b610290600160a060020a0360043581169060243516604435610a31565b604080519115158252519081900360200190f35b341561032957fe5b610331610ad4565b6040805160ff9092168252519081900360200190f35b341561034f57fe5b6101df600160a060020a0360043516610add565b005b341561036d57fe5b6102b4600160a060020a0360043516602435610b26565b60408051918252519081900360200190f35b341561039e57fe5b6101f1610c72565b604080516020808252835181830152835191928392908301918501908083838215610237575b80518252602083111561023757601f199092019160209182019101610217565b505050905090810190601f1680156102635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561042e57fe5b6104ca600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a60ff8b35169a909994019750919550918201935091508190840183828082843750949650508435946020013515159350610d0092505050565b60408051600160a060020a039092168252519081900360200190f35b34156104ee57fe5b6102b4600160a060020a0360043516610f60565b60408051918252519081900360200190f35b341561051c57fe5b6104ca610f74565b60408051600160a060020a039092168252519081900360200190f35b341561054857fe5b610290600160a060020a0360043516602435610f83565b604080519115158252519081900360200190f35b341561057b57fe5b6101f161105c565b604080516020808252835181830152835191928392908301918501908083838215610237575b80518252602083111561023757601f199092019160209182019101610217565b505050905090810190601f1680156102635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561060b57fe5b6102b46004356110ea565b60408051918252519081900360200190f35b341561063057fe5b610290600160a060020a03600435166024356111dc565b604080519115158252519081900360200190f35b341561066357fe5b610290611205565b604080519115158252519081900360200190f35b341561068757fe5b6102b461120e565b60408051918252519081900360200190f35b34156106a957fe5b604080516020600460443581810135601f8101849004840285018401909552848452610290948235600160a060020a031694602480359560649492939190920191819084018382808284375094965061121495505050505050565b604080519115158252519081900360200190f35b341561072057fe5b610290600160a060020a0360043516602435611339565b604080519115158252519081900360200190f35b341561075357fe5b6102b4600160a060020a036004358116906024351661140e565b60408051918252519081900360200190f35b341561078757fe5b6104ca61143b565b60408051600160a060020a039092168252519081900360200190f35b34156107b357fe5b6101df600435151561144f565b005b34156107ca57fe5b6104ca61147e565b60408051600160a060020a039092168252519081900360200190f35b600080600160a060020a038316151561080a5760009150610815565b823b90506000811191505b50919050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a05780601f10610875576101008083540402835291602001916108a0565b820191906000526020600020905b81548152906001019060200180831161088357829003601f168201915b505050505081565b600b5460009060ff1615156108bd5760006000fd5b81158015906108f05750600160a060020a0333811660009081526009602090815260408083209387168352929052205415155b156108fb5760006000fd5b60005461091090600160a060020a03166107ee565b156109b2576000805460408051602090810184905281517fda682aeb000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301528881166024830152604482018890529251929093169363da682aeb9360648082019492918390030190829087803b151561099057fe5b6102c65a03f1151561099e57fe5b505060405151151590506109b25760006000fd5b5b600160a060020a03338116600081815260096020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b60075481565b6000610a2b436110ea565b90505b90565b6000805433600160a060020a03908116911614610abf57600b5460ff161515610a5a5760006000fd5b600160a060020a038085166000908152600960209081526040808320339094168352929052205482901015610a9157506000610acd565b600160a060020a03808516600090815260096020908152604080832033909416835292905220805483900390555b610aca84848461148d565b90505b9392505050565b60025460ff1681565b60005433600160a060020a03908116911614610af95760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a0382166000908152600860205260408120541580610b865750600160a060020a038316600090815260086020526040812080548492908110610b6b57fe5b906000526020600020900160005b50546001608060020a0316115b15610c4257600554600160a060020a031615610c3557600554600654600160a060020a0390911690634ee2cd7e908590610bc1908690611675565b6000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1515610c1857fe5b6102c65a03f11515610c2657fe5b5050604051519150610a149050565b506000610a14565b610a14565b600160a060020a0383166000908152600860205260409020610c64908361168f565b9050610a14565b5b92915050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a05780601f10610875576101008083540402835291602001916108a0565b820191906000526020600020905b81548152906001019060200180831161088357829003601f168201915b505050505081565b600080831515610d0e574393505b600b60019054906101000a9004600160a060020a0316600160a060020a0316635b7b72c130868a8a8a896000604051602001526040518763ffffffff1660e060020a0281526004018087600160a060020a0316600160a060020a03168152602001868152602001806020018560ff1660ff1681526020018060200184151515158152602001838103835287818151815260200191508051906020019080838360008314610dd6575b805182526020831115610dd657601f199092019160209182019101610db6565b505050905090810190601f168015610e025780820380516001836020036101000a031916815260200191505b5083810382528551815285516020918201918701908083838215610e41575b805182526020831115610e4157601f199092019160209182019101610e21565b505050905090810190601f168015610e6d5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b1515610e8e57fe5b6102c65a03f11515610e9c57fe5b50506040805180517f3cebb823000000000000000000000000000000000000000000000000000000008252600160a060020a03338116600484015292519094509184169250633cebb82391602480830192600092919082900301818387803b1515610f0357fe5b6102c65a03f11515610f1157fe5b5050604080518681529051600160a060020a03841692507f086c875b377f900b07ce03575813022f05dd10ed7640b5282cf6d3c3fc352ade9181900360200190a28091505b5095945050505050565b6000610f6c8243610b26565b90505b919050565b600554600160a060020a031681565b600080548190819033600160a060020a03908116911614610fa45760006000fd5b610faf600a4361168f565b9150818483011015610fc15760006000fd5b610fce600a858401611805565b610fd785610f60565b9050808482011015610fe95760006000fd5b600160a060020a038516600090815260086020526040902061100d90828601611805565b604080518581529051600160a060020a038716916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a05780601f10610875576101008083540402835291602001916108a0565b820191906000526020600020905b81548152906001019060200180831161088357829003601f168201915b505050505081565b600a546000901580611123575081600a600081548110151561110857fe5b906000526020600020900160005b50546001608060020a0316115b156111c457600554600160a060020a0316156111b757600554600654600160a060020a039091169063981b24d09061115c908590611675565b6000604051602001526040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b151561119a57fe5b6102c65a03f115156111a857fe5b5050604051519150610f6f9050565b506000610f6f565b610f6f565b6111cf600a8361168f565b9050610f6f565b5b919050565b600b5460009060ff1615156111f15760006000fd5b6111fc33848461148d565b90505b92915050565b600b5460ff1681565b60065481565b600061122084846108a8565b151561122c5760006000fd5b83600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001806020018281038252838181518152602001915080519060200190808383600083146112d2575b8051825260208311156112d257601f1990920191602091820191016112b2565b505050905090810190601f1680156112fe5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561131c57fe5b6102c65a03f1151561132a57fe5b505050600190505b9392505050565b600080548190819033600160a060020a0390811691161461135a5760006000fd5b611365600a4361168f565b9150838210156113755760006000fd5b611382600a858403611805565b61138b85610f60565b90508381101561139b5760006000fd5b600160a060020a03851660009081526008602052604090206113bf90858303611805565b604080518581529051600091600160a060020a038816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b600160a060020a038083166000908152600960209081526040808320938516835292905220545b92915050565b600b546101009004600160a060020a031681565b60005433600160a060020a0390811691161461146b5760006000fd5b600b805460ff19168215151790555b5b50565b600054600160a060020a031681565b600080808315156114a1576001925061166c565b6006544390106114b15760006000fd5b600160a060020a03851615806114d8575030600160a060020a031685600160a060020a0316145b156114e35760006000fd5b6114ed8643610b26565b915083821015611500576000925061166c565b60005461151590600160a060020a03166107ee565b156115b7576000805460408051602090810184905281517f4a393149000000000000000000000000000000000000000000000000000000008152600160a060020a038b811660048301528a81166024830152604482018a905292519290931693634a3931499360648082019492918390030190829087803b151561159557fe5b6102c65a03f115156115a357fe5b505060405151151590506115b75760006000fd5b5b600160a060020a03861660009081526008602052604090206115dc90858403611805565b6115e68543610b26565b90508084820110156115f85760006000fd5b600160a060020a038516600090815260086020526040902061161c90828601611805565b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600192505b50509392505050565b600081831061168457816111fc565b825b90505b92915050565b60006000600060008580549050600014156116ad57600093506117fc565b8554869060001981019081106116bf57fe5b906000526020600020900160005b50546001608060020a03168510611724578554869060001981019081106116f057fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a031693506117fc565b85600081548110151561173357fe5b906000526020600020900160005b50546001608060020a031685101561175c57600093506117fc565b8554600093506000190191505b828211156117be5760026001838501015b04905084868281548110151561178c57fe5b906000526020600020900160005b50546001608060020a0316116117b2578092506117b9565b6001810391505b611769565b85838154811015156117cc57fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a031693505b50505092915050565b8154600090819015806118425750835443908590600019810190811061182757fe5b906000526020600020900160005b50546001608060020a0316105b156118b857835484906118588260018301611908565b8154811061186257fe5b906000526020600020900160005b5080546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff1990931692909217161781559150611901565b8354849060001981019081106118ca57fe5b906000526020600020900160005b5080546001608060020a0380861670010000000000000000000000000000000002911617815590505b5b50505050565b81548183558181151161192c5760008381526020902061192c918101908301611932565b5b505050565b610a2e91905b8082111561194c5760008155600101611938565b5090565b905600a165627a7a7230582057348ca0297970bb01202ce8022511ab041096fc938e17a211f6de719789f54e0029a165627a7a723058207f08e59b3da88e7db6ae63182ac584f5a56ccbe53f3a10d2ca155d5729ede5540029', gas: '3900000', gasPrice: eth.gasPrice.mul(1.1).floor() }, function (e, contract){ console.log(e, contract); if (typeof contract.address !== 'undefined') { console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash); } }); var _tokenFactory = minimeFactory.address ; var sgtAbi = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"creationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newController","type":"address"}],"name":"changeController","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_blockNumber","type":"uint256"}],"name":"balanceOfAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_cloneTokenName","type":"string"},{"name":"_cloneDecimalUnits","type":"uint8"},{"name":"_cloneTokenSymbol","type":"string"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"generateTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_blockNumber","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"data","type":"uint256[]"}],"name":"multiMint","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"transfersEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentSnapShotBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroyTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenFactory","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_transfersEnabled","type":"bool"}],"name":"enableTransfers","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_tokenFactory","type":"address"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_cloneToken","type":"address"},{"indexed":false,"name":"_snapshotBlock","type":"uint256"}],"name":"NewCloneToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Approval","type":"event"}]; var sgtContract = web3.eth.contract(sgtAbi); var sgt = sgtContract.new( _tokenFactory, { from: web3.eth.accounts[0], data: '0x60a0604052600760608190527f4d4d545f302e310000000000000000000000000000000000000000000000000060809081526200004091600491906200018f565b5034156200004a57fe5b60405160208062001cdf83398101604052515b8060006000604060405190810160405280601481526020017f5374617475732047656e6573697320546f6b656e0000000000000000000000008152506001604060405190810160405280600381526020017f534754000000000000000000000000000000000000000000000000000000000081525060005b5b60008054600160a060020a03191633600160a060020a03161790555b600b805461010060a860020a031916610100600160a060020a038a16021790558351620001279060019060208701906200018f565b506002805460ff191660ff851617905581516200014c9060039060208501906200018f565b5060058054600160a060020a031916600160a060020a0388161790556006859055600b805460ff1916821515179055436007555b505050505050505b5062000239565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620001d257805160ff191683800117855562000202565b8280016001018555821562000202579182015b8281111562000202578251825591602001919060010190620001e5565b5b506200021192915062000215565b5090565b6200023691905b808211156200021157600081556001016200021c565b5090565b90565b611a9680620002496000396000f3006060604052361561012d5763ffffffff60e060020a60003504166306fdde0381146101ec578063095ea7b31461027c57806317634514146102af57806318160ddd146102d157806323b872dd146102f3578063313ce5671461032c5780633cebb823146103525780634ee2cd7e1461037057806354fd4d50146103a15780636638c0871461043157806370a08231146104f157806380a540011461051f578063827f32c01461054b57806395d89b411461057e578063981b24d01461060e5780639a0e4ebb14610633578063a9059cbb14610688578063bef97c87146106bb578063c5bcc4f1146106df578063cae9ca5114610701578063d3ce77fe14610778578063dd62ed3e146107ab578063e77772fe146107df578063f41e60c51461080b578063f77c479114610822575b6101ea5b60005461014690600160a060020a031661084e565b156101e157600080546040805160209081019390935280517ff48c3054000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301529151919092169263f48c30549234926024808301939282900301818588803b15156101b857fe5b6125ee5a03f115156101c657fe5b505060405151151591506101dc90505760006000fd5b6101e7565b60006000fd5b5b565b005b34156101f457fe5b6101fc61087b565b604080516020808252835181830152835191928392908301918501908083838215610242575b80518252602083111561024257601f199092019160209182019101610222565b505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561028457fe5b61029b600160a060020a0360043516602435610908565b604080519115158252519081900360200190f35b34156102b757fe5b6102bf610a7a565b60408051918252519081900360200190f35b34156102d957fe5b6102bf610a80565b60408051918252519081900360200190f35b34156102fb57fe5b61029b600160a060020a0360043581169060243516604435610a91565b604080519115158252519081900360200190f35b341561033457fe5b61033c610b34565b6040805160ff9092168252519081900360200190f35b341561035a57fe5b6101ea600160a060020a0360043516610b3d565b005b341561037857fe5b6102bf600160a060020a0360043516602435610b86565b60408051918252519081900360200190f35b34156103a957fe5b6101fc610cd2565b604080516020808252835181830152835191928392908301918501908083838215610242575b80518252602083111561024257601f199092019160209182019101610222565b505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561043957fe5b6104d5600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a60ff8b35169a909994019750919550918201935091508190840183828082843750949650508435946020013515159350610d6092505050565b60408051600160a060020a039092168252519081900360200190f35b34156104f957fe5b6102bf600160a060020a0360043516610fc0565b60408051918252519081900360200190f35b341561052757fe5b6104d5610fd4565b60408051600160a060020a039092168252519081900360200190f35b341561055357fe5b61029b600160a060020a0360043516602435610fe3565b604080519115158252519081900360200190f35b341561058657fe5b6101fc6110bc565b604080516020808252835181830152835191928392908301918501908083838215610242575b80518252602083111561024257601f199092019160209182019101610222565b505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561061657fe5b6102bf60043561114a565b60408051918252519081900360200190f35b341561063b57fe5b6101ea60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061123c95505050505050565b005b341561069057fe5b61029b600160a060020a03600435166024356112f3565b604080519115158252519081900360200190f35b34156106c357fe5b61029b61131c565b604080519115158252519081900360200190f35b34156106e757fe5b6102bf611325565b60408051918252519081900360200190f35b341561070957fe5b604080516020600460443581810135601f810184900484028501840190955284845261029b948235600160a060020a031694602480359560649492939190920191819084018382808284375094965061132b95505050505050565b604080519115158252519081900360200190f35b341561078057fe5b61029b600160a060020a0360043516602435611450565b604080519115158252519081900360200190f35b34156107b357fe5b6102bf600160a060020a0360043581169060243516611525565b60408051918252519081900360200190f35b34156107e757fe5b6104d5611552565b60408051600160a060020a039092168252519081900360200190f35b341561081357fe5b6101ea6004351515611566565b005b341561082a57fe5b6104d5611595565b60408051600160a060020a039092168252519081900360200190f35b600080600160a060020a038316151561086a5760009150610875565b823b90506000811191505b50919050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109005780601f106108d557610100808354040283529160200191610900565b820191906000526020600020905b8154815290600101906020018083116108e357829003601f168201915b505050505081565b600b5460009060ff16151561091d5760006000fd5b81158015906109505750600160a060020a0333811660009081526009602090815260408083209387168352929052205415155b1561095b5760006000fd5b60005461097090600160a060020a031661084e565b15610a12576000805460408051602090810184905281517fda682aeb000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301528881166024830152604482018890529251929093169363da682aeb9360648082019492918390030190829087803b15156109f057fe5b6102c65a03f115156109fe57fe5b50506040515115159050610a125760006000fd5b5b600160a060020a03338116600081815260096020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b60075481565b6000610a8b4361114a565b90505b90565b6000805433600160a060020a03908116911614610b1f57600b5460ff161515610aba5760006000fd5b600160a060020a038085166000908152600960209081526040808320339094168352929052205482901015610af157506000610b2d565b600160a060020a03808516600090815260096020908152604080832033909416835292905220805483900390555b610b2a8484846115a4565b90505b9392505050565b60025460ff1681565b60005433600160a060020a03908116911614610b595760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a0382166000908152600860205260408120541580610be65750600160a060020a038316600090815260086020526040812080548492908110610bcb57fe5b906000526020600020900160005b50546001608060020a0316115b15610ca257600554600160a060020a031615610c9557600554600654600160a060020a0390911690634ee2cd7e908590610c2190869061178c565b6000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1515610c7857fe5b6102c65a03f11515610c8657fe5b5050604051519150610a749050565b506000610a74565b610a74565b600160a060020a0383166000908152600860205260409020610cc490836117a6565b9050610a74565b5b92915050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109005780601f106108d557610100808354040283529160200191610900565b820191906000526020600020905b8154815290600101906020018083116108e357829003601f168201915b505050505081565b600080831515610d6e574393505b600b60019054906101000a9004600160a060020a0316600160a060020a0316635b7b72c130868a8a8a896000604051602001526040518763ffffffff1660e060020a0281526004018087600160a060020a0316600160a060020a03168152602001868152602001806020018560ff1660ff1681526020018060200184151515158152602001838103835287818151815260200191508051906020019080838360008314610e36575b805182526020831115610e3657601f199092019160209182019101610e16565b505050905090810190601f168015610e625780820380516001836020036101000a031916815260200191505b5083810382528551815285516020918201918701908083838215610ea1575b805182526020831115610ea157601f199092019160209182019101610e81565b505050905090810190601f168015610ecd5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b1515610eee57fe5b6102c65a03f11515610efc57fe5b50506040805180517f3cebb823000000000000000000000000000000000000000000000000000000008252600160a060020a03338116600484015292519094509184169250633cebb82391602480830192600092919082900301818387803b1515610f6357fe5b6102c65a03f11515610f7157fe5b5050604080518681529051600160a060020a03841692507f086c875b377f900b07ce03575813022f05dd10ed7640b5282cf6d3c3fc352ade9181900360200190a28091505b5095945050505050565b6000610fcc8243610b86565b90505b919050565b600554600160a060020a031681565b600080548190819033600160a060020a039081169116146110045760006000fd5b61100f600a436117a6565b91508184830110156110215760006000fd5b61102e600a85840161191c565b61103785610fc0565b90508084820110156110495760006000fd5b600160a060020a038516600090815260086020526040902061106d9082860161191c565b604080518581529051600160a060020a038716916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109005780601f106108d557610100808354040283529160200191610900565b820191906000526020600020905b8154815290600101906020018083116108e357829003601f168201915b505050505081565b600a546000901580611183575081600a600081548110151561116857fe5b906000526020600020900160005b50546001608060020a0316115b1561122457600554600160a060020a03161561121757600554600654600160a060020a039091169063981b24d0906111bc90859061178c565b6000604051602001526040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15156111fa57fe5b6102c65a03f1151561120857fe5b5050604051519150610fcf9050565b506000610fcf565b610fcf565b61122f600a836117a6565b9050610fcf565b5b919050565b600080548190819033600160a060020a0390811691161461125d5760006000fd5b600092505b83518310156112eb578351600160a060020a039085908590811061128257fe5b906020019060200201511691507401000000000000000000000000000000000000000084848151811015156112b357fe5b906020019060200201518115156112c657fe5b0490506112d38282610fe3565b15156112df5760006000fd5b5b600190920191611262565b5b5b50505050565b600b5460009060ff1615156113085760006000fd5b6113133384846115a4565b90505b92915050565b600b5460ff1681565b60065481565b60006113378484610908565b15156113435760006000fd5b83600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001806020018281038252838181518152602001915080519060200190808383600083146113e9575b8051825260208311156113e957601f1990920191602091820191016113c9565b505050905090810190601f1680156114155780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561143357fe5b6102c65a03f1151561144157fe5b505050600190505b9392505050565b600080548190819033600160a060020a039081169116146114715760006000fd5b61147c600a436117a6565b91508382101561148c5760006000fd5b611499600a85840361191c565b6114a285610fc0565b9050838110156114b25760006000fd5b600160a060020a03851660009081526008602052604090206114d69085830361191c565b604080518581529051600091600160a060020a038816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600192505b5b505092915050565b600160a060020a038083166000908152600960209081526040808320938516835292905220545b92915050565b600b546101009004600160a060020a031681565b60005433600160a060020a039081169116146115825760006000fd5b600b805460ff19168215151790555b5b50565b600054600160a060020a031681565b600080808315156115b85760019250611783565b6006544390106115c85760006000fd5b600160a060020a03851615806115ef575030600160a060020a031685600160a060020a0316145b156115fa5760006000fd5b6116048643610b86565b9150838210156116175760009250611783565b60005461162c90600160a060020a031661084e565b156116ce576000805460408051602090810184905281517f4a393149000000000000000000000000000000000000000000000000000000008152600160a060020a038b811660048301528a81166024830152604482018a905292519290931693634a3931499360648082019492918390030190829087803b15156116ac57fe5b6102c65a03f115156116ba57fe5b505060405151151590506116ce5760006000fd5b5b600160a060020a03861660009081526008602052604090206116f39085840361191c565b6116fd8543610b86565b905080848201101561170f5760006000fd5b600160a060020a03851660009081526008602052604090206117339082860161191c565b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600192505b50509392505050565b600081831061179b5781611313565b825b90505b92915050565b60006000600060008580549050600014156117c45760009350611913565b8554869060001981019081106117d657fe5b906000526020600020900160005b50546001608060020a0316851061183b5785548690600019810190811061180757fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a03169350611913565b85600081548110151561184a57fe5b906000526020600020900160005b50546001608060020a03168510156118735760009350611913565b8554600093506000190191505b828211156118d55760026001838501015b0490508486828154811015156118a357fe5b906000526020600020900160005b50546001608060020a0316116118c9578092506118d0565b6001810391505b611880565b85838154811015156118e357fe5b906000526020600020900160005b505470010000000000000000000000000000000090046001608060020a031693505b50505092915050565b8154600090819015806119595750835443908590600019810190811061193e57fe5b906000526020600020900160005b50546001608060020a0316105b156119cf578354849061196f8260018301611a1f565b8154811061197957fe5b906000526020600020900160005b5080546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff19909316929092171617815591506112eb565b8354849060001981019081106119e157fe5b906000526020600020900160005b5080546001608060020a0380861670010000000000000000000000000000000002911617815590505b5b50505050565b815481835581811511611a4357600083815260209020611a43918101908301611a49565b5b505050565b610a8e91905b80821115611a635760008155600101611a4f565b5090565b905600a165627a7a7230582089f20df28756d7605d82438014b8d7a74992c4df8692e8aec73af24dbc1fffa80029', gas: '3900000', gasPrice: eth.gasPrice.mul(1.1).floor() }, function (e, contract){ console.log(e, contract); if (typeof contract.address !== 'undefined') { console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash); } }); //////// var minimeFactoryAbi = [{"constant":false,"inputs":[{"name":"_parentToken","type":"address"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"}]; var minimeFactory = eth.contract(minimeFactoryAbi).at("0x94bda9e40d82a09b8965e2082e5d286593246927"); var sgtAbi = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"creationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newController","type":"address"}],"name":"changeController","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_blockNumber","type":"uint256"}],"name":"balanceOfAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_cloneTokenName","type":"string"},{"name":"_cloneDecimalUnits","type":"uint8"},{"name":"_cloneTokenSymbol","type":"string"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"generateTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_blockNumber","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"data","type":"uint256[]"}],"name":"multiMint","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"transfersEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentSnapShotBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroyTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenFactory","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_transfersEnabled","type":"bool"}],"name":"enableTransfers","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_tokenFactory","type":"address"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_cloneToken","type":"address"},{"indexed":false,"name":"_snapshotBlock","type":"uint256"}],"name":"NewCloneToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Approval","type":"event"}]; var sgt = eth.contract(sgtAbi).at("0x4bdA828F1fE628973c39366263B78B7cd9d6D8fe") ================================================ FILE: scripts/sgtGeneration/initialBalance.csv ================================================ 0xeD33259a056F4fb449FFB7B7E2eCB43a9B5685Bf,4166666 0x2962DE226076CCE421147b5268921eF88cF0069B,1666666 0x74748d441d2cF255a5EA6c032B08471b85D5218B,1041666 0xF2da5ADd7C6f8A47997EfA04049EE7888542744b,3333333 0xfF7b6a8D0EDe69158B0C6Ffc82942cD9C8E00FF1,16666666 0x1dc622a664505af72b5e6cc1be755335bfcc3834,5000000 0xa7Cfd581060EC66414790691681732dB249502BD,29166666 0x99AeF27CF577D599214C5e775D713aab2Bac5761,10416666 0x5276cb99f022398701b205ce97fc3e73e3379ffb,5000000 0x6068B12921e44A430fB6C5A0c9f7d72d836b5DBd,10416666 0x00a365457Ba80285C2D7208Fb0d04D50CfC1aC17,416666 0x88ECfD9B73858478C894FEecA993c960b19cDeB4,16666666 0x004769ac372a0c970522fe33c66d946863a52a8c,10416666 0x6e8276F4EDee6EEff01a25215770C326783d7147,104166 0x0071e681554a08aB1F1174D3746d16F2F4A43642,625000 0x283D0C13A8eFb35d0eCEbB9c71D9182102e663FA,291666 0x5d0C10Ebc713012f82F2859E2F47A9Ee8d1318a3,416666 0x00e18d54DB9d663d28f19eE139a94191410f9A4c,208333 0x6fD4E1Dbf05033A7C4290477D7448e9b0A25bABF,104166 0xf16CFD73Fe21E1d2ffdC68C6348489AD917e8546,208333 0xDaCC0fd259CE0DE2829B38A0765970e7ab65346C,104166 0x32d44db61df0b10Ccf0164Df3D9cbeE72E3dF02c,208333 0x0030B7B79D9F2A6b19D5b63f5e63D82678D94c24,104166 0x839395e20bbB182fa440d08F850E6c7A8f6F0780,416666 0xEc9cE6E59ce95248Ecef070408E7cF35bBc79989,104166 0xEe82DDb350f48dd5712d54072172AA1A97c677C8,41666 0x6Fe7DdeE460DF1511ccdC4F87140D3AA2A801a19,104166 0x9ea3baa124aeea99ce5cb980088d523625acd512,104166 0x2a2A57a98a07D3CA5a46A0e1d51dEFffBeF54E4F,104166 0x00C016c2BDe2f068142F0887889306fc2A447B39,416666 0x2d19FDE5B4Cac4e1AfA54ee749C368C68c18316c,208333 0x9A5E4d421d72bc1835E6a7b9658CA1924D12d0E0,416666 0x9FDcD86062Be5287A81B692Bd2793Fb1787f6197,20833 0xA47e5562f5264059D75C6BD2C1080D2736a1CDd5,833333 0x36a0488f0d80202c2a1b3eb2d83ba71fc62860da,104166 0x59795FccFBe2F166651c6B73d10a7a1522A0ed89,416666 0x2d9D60C2257e7F60c15e82912Fd72D2eC9B84Bb7,416666 0x00C4904FB17A6eCBfACb609273c89791aBA0a5cd,104166 0xcc7560eB40E336949b7d5e933D3744b49609de1B,104166 0x00D2C876544bcaF8761282f4c95F434763aCeF60,416666 0xb1a2b43a7433dd150bb82227ed519cd6b142d382,416666 0x9F4860c577C5D0928d9b38153db8cb69112E346b,416666 0x21F7DC526b2132BCC4772E1707FBc2E18a281ed9,416666 0x39F4662bF97200DBfA00ED05e3141c8959151cFa,250000 0x7155302F5534712A764E1D3c0b0F99dEFe4Ad1fe,416666 0x1cade0dd3da13883d73bac2385e46ba51d981156,625000 0x45E8ECA25654c21445d3e64886d552c6381fc621,208333 0x16893e10b99a59afd2c60331e0b49241d4d4d7cc,416666 0xe7414A2F1Aa6B34f01E8D631444F0f6886fBfc6E,416666 0x4ECC719aA2AF9498FaB3c2178391A85A9Ac914C7,104166 0x270B22Be16E84D1383c4F1A0B384089b492E88BC,104166 0xc8C281EDa1B79d1A385679b31dF3C918247FF04C,416666 0x5ce0B0D1A987F0f84CD2BBafbb36fb2339383b6f,104166 0x575AAfAFDdc1Dff3f4072532f5d580105b6835Cb,416666 0x518611649eE8fEFeD0A4DA3D47bAB213c79ce9b5,416666 0xAade95376d00c9e9cDc0d7049dE055f2df6114b5,208333 0x264E5e87C8Dae4D2b526e94Cb51B2665B20e76E1,104166 0x1dba1131000664b884a1ba238464159892252d3a,8333333 0xAb232434C1E6eFC8118D12DEA87F6457e47FAd5E,416666 0x8D8ED0BBB8C0DD8D14c8652DE6fE362DFdD401a9,416666 0x4b7d1cc8005dfd224bcbf71d83f35e9650418242,104166 0x25e1d410112AfC80691B85f3fFD0994A1e5Ea140,208333 0x00676ef58700aA3c0F2F0b7C935b31470e373Eb8,208333 0x719acb379d309cf8b0a020c4c94568b6016a840b,104166 0xE05268C92117CBA26852A387F4657E9578304059,83333 0x9c6f14119C5039AdE67e7383B1C89f53729C629f,1041666 0x37DD4e12E09CbF64FA8B1D2B1Ac37730ACDc7529,208333 0x78179dCAb7e906F02f3F172233B152E4A5178F13,416666 0xfB755331Bf33E9E8376a56054DdA19c47E4D0627,208333 0x80d63799b1e08a80f73fb7a83264b5c31600bf3a,416666 0x882aA9BA810892C606FC29E6DbA057e8A317A36C,416666 0x6Eee7B3E4e19518f31c009cC351bb3a6C0714AA5,416666 0x35bED8269Dd2De8389254Cc72De8DeDfa8298B17,104166 0xfDb33f8AC7ce72d7D4795Dd8610E323B4C122fbB,833333 0x02E816AFC1b5C0f39852131959D946eb3b07b5ad,833333 0x8EDDa5513D44aDF8e7C7541Ba0de80f8d7F2FC96,833333 0x0037A6B811ffeB6e072DA21179d11B1406371C63,416666 0x98D7cb23644eE749C2A5dc85b606ffc3Da749396,416666 0x1db3439a222c519ab44bb1144fc28167b4fa6ee6,833333 0x5ed8cee6b63b1c6afce3ad7c92f4fd7e1b8fad9f,4166666 0x8811FdF0F988f0CD1B7E9DE252ABfA5b18c1cDb1,416666 0x426ab035E8ae39f2a094f824A9e96B4152ed0c92,208333 0xA495A5fc30C3ea0b999a2d36A759fFf9fa5224d4,104166 0x24B139E561874594b738C2735A24B8ea52b82571,416666 0x00ec3b9e2e7ba7ffbd1d77d100a29f8055c258bb,1250000 0x6aBdC251e5e99B628EA4261d178e2661f59b90EA,833333 0x76dF436353Ae2266b0e45dbF5A6f7Ad47829098d,104166 0x0aba55c93cf7292f71067b0ba0d8b464592895ca,416666 0x5b1025b0c08bd9f8601139cc5fb5c392da31bb8e,416666 0x6edd429c77803606cBd6Bb501CC701a6CAD6be01,416666 0x71ce2aa5f171c89887101b2ee709d9138921a6ba,416666 0xf388A47e25495Bd3F1Ae276Bfbfdc4b29eD6161a,104166 0xe0eff9aace3d6e027fe063ab06149cc6a4a504c3,416666 0x04CB1AdE2Bd72aCD758d4f7abacbC633fC532857,208333 0x0AcE2fe8b189d069020b06DF341998FAc33e94Bb,20833 0xf4FdA67fA9B6e3829D41f01b9A710D2E2F6BA784,20833 0xb3990e73a2ddb005b11946fe00891518e0c65ab8,20833 0x7BE8dA14C273005B1186f3DeB5EA5BC1A18C1c4F,20833 0x8962a1EC854f95A1829EFB5D48fe2EC19aC24136,20833 0xBEc9c12c124bfCbf8546580cda997CA9c0042E4E,20833 0x964d220e848fb3e70898ec4c4bf8ac39c7350543,20833 0xc2059ee0e3cd4f440743972b2c1a120bc26581f4,20833 0xDDf8f475EE3b847117ED3df673e85c8b4593bBf3,20833 0x3FC90B9Ec3dEb1712aed78FA29ef304566aD42EC,20833 0x37F1D672c89671F886B9a6AF09E0144E7f470B05,20833 0x36e72fafa7a7b1a9ce0609ed057f8d104058e5b6,20833 0x9De7e51Db35Ad3898683A78712185ADBA1B2b163,20833 0xf1ceea80826a10c1c3d9460da60943662d29e7b3,20833 0xD74BaF7d6bbb294748394cf6bfD0A39872a76b79,20833 0x571ad50a227bc03d42e9565ee4bb002ef1fdb226,20833 0x0868c6a952e5c5b3b29263259ef98a8c53c05729,20833 0x66E8F875C6840aDEf012320Fb50C7e3264F321ec,20833 0xFDfBB121935e162834C27f64F1700198493d2c55,20833 0x3A9c4ab18aE51Bf3f342d4c8c3A6f54ac21A44C4,20833 0xa49b77305087d961612be78811c5d819928abef4,20833 0x0BdDc77c4d8fb1D3e0d8F41E0e5f8Bb6E59Ef579,20833 0xd1324ada7e026211d0cacd90cae5777e340de948,20833 0x6CCcbf48C39A387fb9265ED56Cb16ABF9d966411,20833 0x213B09561d0960B90E9A7eC7743317769F1c52b8,20833 0x6Dd9530b2Cb8B2d7d9f7D5D898b6456EC5D94f08,20833 0x004b8D39928b9318f7709599ac8d717A3E65e102,20833 0x9d23e95b11D0FDcff990F473179B66df259d8F4c,20833 0xa7739b58741e59f358d52ec6ec5f181866cc4cf6,20833 0x2D28996180b7A6e817bb0aEF6F7013c8c4a2Dfe6,20833 0xbF6F5e78E154799C7856f4Cf9F269cf7A7201310,20833 0x8B13796d142822d0CdC6f94Db402F05bB68DA0e6,20833 0xCC404633DEDf6eC890038e600fD9288Da8c6D143,20833 0x0008C3707f06Caf0AbF7e7aB296C844851610ccF,20833 0x6095929ef6bc1f458090d14fD700448CE0973E10,20833 0x77c5a7084B488A254e7e0643e4BfAB831f9239C2,20833 0x9BC47064057371a59d1c2A7c907cdC6D7568dB47,20833 0x0681e6274bd1D606E9D192B550Fb1d20DB47cA85,20833 0x72c28693308F423B142b755EB6828E51873AA5D2,20833 0xa9af49f28Fa939Aa6D7a9683DE9A4319D1D8eCBa,20833 0x7E30D3836a8844E308342ba2981ece5f9f4A1377,20833 0x3c32f264cc10a01b03c895858532b751748d22e7,20833 0x52bB24A71aAb5f2DC01Aa1C8730aa27d9548Cd3a,20833 0x333113fCcF6E55969d71257d8552d194147B160e,20833 0x62301720DBAcf7B1D9Cd724Adc599dd5a269130a,20833 0x337e47d72C03399a303ffBeAfB110537348A24f9,20833 0xc95f7d13e60bc7b916c3925dd74edc0be2189a7a,20833 0xcb33b5b3365e5A39d51d473D43A5dA783Dc23355,20833 0x008e04a1EFCBEDfe39F33bAB9bd7b584695fB5D9,20833 0x7a572856da6f9d19c7396a1c0174708cbb745203,20833 0xffeaf10d70651cd3112b1e97289433be2bc18f50,20833 0x7dAfD53AEE8982aB1D767830c2fe50f62E3a98E6,41666 0x6a8076e1b8fC43D5e07d03Ba090d7a19e1cdafd1,20833 0xe8c68e9a0b288bfc322f31da297e87af90ab7e83,20833 0xaF4F46e668Ff2eF4FcC4b34e0B80c4225894B6Cb,20833 0xd98b8BA6bEcf3694A8BDeBA0c9e9B1918E5C0CD8,20833 0x4EA888Bb919Df69d82F794012dC94106992b5E7D,20833 0xe51699E7483d6b51f37efe269048397B27D9FeDd,20833 0x60e63c2f43f8b5daf32e8f7f2dd2e370100e9432,20833 0xeb49f9553FA991e133fEa5C0c2724e4409aCAB4A,20833 0x6e8db8ccdC7F3bEC8AF245FfE7b829A48328AB49,20833 0xa572215Ba9d59Acb1dC6D3bb372125DE51868abd,20833 0x009C4632e1688e7a7fe96f4B6013d1DACA075238,20833 0x9D4428D8E0E2fD00dcBbE4D635AA2B2f75E51e56,20833 0x739E44719F1C8A439c0eb9F49d046c91D89900d6,20833 0x6ec1b4bafDA425598549940b96561c8Aa692227B,20833 0xa5C5720E94a7D19De8eAcB8D905FC862690c9b16,20833 0x00730Fe3aa6b1a1322933E6263f55FABabC17Eb9,20833 0x91B45bDcaE669471dDDb613DE2D0E6F50c5e05f3,20833 0xE0916528e3C5F0dABdF51cd00BDd364e014F48E8,20833 0xEB8664FCAc34e577D8A0C2FbF6d7AF68439FCC0C,20833 0xf2b314Dbecfdd47c247d1efcDd4Cf5EF847CD304,62500 0x003E66C8E6bDc69EcB672B2dACCb05f68851752f,20833 0x580346022a6a73592718034b905b38167431B71F,20833 0xf73947cE3d2482168C9F3819522d938DBD5b617b,20833 0x7D292d9A7fBFEc944f17147c9Eca36bbe8308530,20833 0x8C4164ea40029a09Aa20C404Ba5b7FD08a7e9777,20833 0x019EdcB493Bd91e2b25b70f26D5d9041Fd7EF946,20833 0xc7de06718bb4ae5c17e743781be6baf956c03357,20833 0x00E912b4080BEF232056E76d34c332dcBA4F1fcF,20833 0x9082e0eac4b7d13f6db1259dfc8829859ed90329,20833 0x2554eDB5D81EdAd07Be553090D230a403A4544fa,20833 0x4bef3eaa68f4ec276ab1e7ecaa96709e4d20b49e,20833 0x07Dae622630D1136381933D2aD6B22b839d82102,20833 0xdFB3c8fe62A90965A47a02aF0a34A9C8C78571D7,20833 0x18a1a57cEC0E8C05859d6a6Be589914ee1dF27B5,20833 0x6a85883FA4579C4F9A040206B6AfEDf36863cF9c,20833 0x5cb5F46a655C02889172323760d12d0e5D83CDAf,20833 0x00affc8138f1056249149a3dfa99fc305507df67,20833 0x8ad88087765f5e7d87350c31c4782d23dd96eb8a,20833 0x2628277359d9bDc3075A53654a3E1d9A178086Dc,20833 0x9d08F84787f26f1eFF9858B04aaF160491395e35,20833 0x422DD917816Ad1dE921293A9A0996cBAce3ab65E,20833 0x1608BD64c604379ba250532CB13f31A0e12FdBAf,20833 0x9e25a3E151323e0bd3dA61F446E2405EfF38Fb9A,20833 0x8b8Ce7E49669CAf6De14d202561B1b95BD09f6d0,20833 0xDA8775C5648A83b6BAc69c16E72106d10866e9E7,20833 0x08251D925C0CaFdc8669c4C4c54b2DEaaCc553A1,20833 0xc3cc847B10E8D6B95d6F835BbAd9D32F64ec160F,20833 0x12D9A38A8C34808ef406eb4d09ac2BCD56061112,20833 0x5D196b547c9A91208a89C6806Fc1A86cea998013,20833 0x00A10c4B072807B96fF309d32bB1e994c80c7e37,20833 0x6c0B6a5Ac81E07F89238dA658a9F0E61bE6A0076,20833 0xf5a61bBcBAba9d2a9a6D0443c84f3E258CeacbB2,20833 0xaAb37eA6871718F4eE5d499e15b55E9f61822A53,20833 0xd6988f0bbe339dd24f168d7ed4554751cfc0f8a9,20833 0x2f32263ef86eE0194689553BAE5F549B50b86B86,20833 0xa9d4a2bcbe5b9e0869d70f0fe2e1d6aacd45edc5,20833 0xDEAA2e18867c2c620E13C895d6200Ed096D01D6B,20833 0x632da81d534400f84c52d137d136a6ec89a59d77,20833 0x1b00Ffd60332c7B99e5B73f926001Fe4a5d1F6e6,20833 0x76d5c762Fe0aC7F3539e51e3Ff027Cdf8486CAf2,20833 0x00267bBA8584c0e2Ab8e8ac5154F42C94Dd7E5aF,20833 0x0067A53b3EebB967E2831Cf5F9E2B2310C5CA1c9,20833 0x0fa38abec02bd4dbb87f189df50b674b9db0b468,20833 0xcEfA4b3763186A6511485b3583560C01A767be7E,20833 0xbae7329a0d322919f3a4fc56886deeb5ae318faf,20833 0xFAb70d48021e72c449A6111Fc4F40A004a0E52cc,20833 0x8888889201803e468f55333B6b3992B262f61951,20833 0x149F3f7b862CA3711D4c3fAc466b82540C200aA1,20833 0xd76B2B4E25e7d028d79560ED3ad5f27396639FFc,20833 0x147af46ae9ccd18bb35ca01b353b51990e49dce1,20833 0x300Ce242a9101f2eE5e9E0c44784ED2a3d29aE02,20833 0x4106cF2AB83C71663ADF109f88Ad8c229A92Efe2,20833 0x2feb16Dc7a240414188521418C9222A182Ee69Ae,20833 0x9c16a8fd56fe0602ba179543dcc4fdc945c5966a,20833 0x93AA7363E7fAaD169Af5f170a02faA71b4910C08,20833 0x8b0a7eE663Ff83E3d340880A6819a319DFaA69cB,20833 0x54E13ca8E3bE520A6858AcEE04C6e1f562Ddf443,20833 0x19af83a3dfca021df89eac36372175bebe5b6ff7,20833 0x3cddcb8cf10c4facfbf960309806d8a3a3f19a40,20833 0x2F60519a289e2723727b02F3e36C83E1FD512163,20833 0xB9BEE73ED54E77e76339a78438f148c0E51D482B,20833 0xf35c15B90A636342d999DBd23CfC23F46caFb636,20833 0x0c11fa6623df9ce654d9b7e75841cf9156ba99cc,20833 0x001C9d31A368f89519232335885AA1fd2c9C9b75,20833 0x620f5f2e0ef2FE140b4270A0C6B624F95d04cb77,20833 0xaCF0834B453E5418aF7C6801049e7bE592b35915,20833 0xe6054a228B6dA740684AA4b2eeB9ea790834d48a,20833 0x2a75853e0d1D896e6A2731Af885Ba27053D0775c,208333 0x84A6FC38d3F8370f00827409188400E979fC8BB4,20833 0xC677E066284FACe940584D274200aa73b3f5D0d7,20833 0x020aC951935B2D31bed8e7030590D63f24A490EE,20833 0xCa0B5E2ba748422CC4b42C51858247F1567AAE2A,20833 0xA5Ba162c959ea6a8FcC93aea45Dc2451EE689A76,20833 0x24Fc2259bEa33690Ff5fB78aDfC0f7549A43BBC7,20833 0x3316D59f0731Bf91A1170C030882fd24cED4a099,20833 0xb43f8AA1B9A5E589Cf2f56855d0740f1D4bcd856,20833 0x0711f7A38d71d343c22635eBA3Cd87E5295Dde5B,20833 0x7D1cD61f6153efd679963d101C5c49374989C7E7,20833 0x682a72BFc1b9D4a4fb8BC41A0d35f3Ed082A96dE,20833 0xfDE06Aa76d3bA3B4C2b61Da4553Fde21f83496e0,20833 0xa07a7a1907F3CBcB995088cA5D08B74596fe741b,20833 0xB2EA97F18717f7431dCbBCe468A77a37F4e5B31C,20833 0xCf743E8b5DC5AF37697cAF0F3c4dd5c3bEa81b2D,20833 0xabFFC14B3754F34f059facF5E7EC8019B96f765a,20833 0x30c415a95986011bAcf74b75d8454ea893032fAE,20833 0x09884aF62d26D21442f130a1fCa4915958D40E0f,20833 0x67bc21d3e53298d8e7f0b63fe48f4c606c877bfb,20833 0x1d118f04b63d423fbd257ff79218f1a16711c4da,20833 0x0CE60Eb7aDd9B9112c8b306816a86162482503f0,20833 0x0C65122FF927F5b8453D74d0bdfAb0aAE4c876eb,20833 0x0489076A0D17394835aF93cd62ACFf703B6814a9,20833 0x3221E683701E7b5683A4c0e768f0EE481c5B67Fb,104166 0x9CDc2ec2AadA2E397e9Ae9d64B0b11c40Acd7b31,20833 0x56A7E72942A25D07Ba05fA1A4F736Cd11830E171,20833 0xD7f264e5cB3373dCc79beAd89aF6E6DD5Bc695c6,20833 0x277E4b7F5DaB01C8E4389B930d3Bd1c9690CE1E8,20833 0xe33695f8c7c73ea161272a7d3be795e129dc3596,20833 0x320b5f61E5ce5f386149Dd2F1F65019657724650,20833 0x00E10D6e2f62E907B4D389DcfD3c168d1C7a06D3,20833 0xdEE942d5CAF5FAc11421D86B010b458E5c392990,20833 0xE718617391af09683CAA67B50F4E7C9Fd820765e,20833 0x8e65B5da5725a6dA0dbf5c886Fbe760d658Fbf61,20833 0x54E0741624DA089e94d3422A25DF1df59E814b3d,20833 0xFf651EAD42b8EeA0B9cB88EDc92704ef6af372Ce,20833 0x075c71a069a1fb42f5933f652703f1c30ef56020,20833 0x97E121ed83dA3BD26cc63BAEdDC58DA5f203cB24,20833 0xed50B8B0aDf6b37Ad15635dbC7e53F4a705014B9,20833 0xCf22CF10072d6BDe4118B99c4deaDd63b1d08512,20833 0x7B9598468f5eC899fD67CF365B1120be47A694Eb,20833 0x8B344b8f12099EAb0E8e1E2F91A093a035e8E9B3,20833 0x70c4eBe752ED72867fea4086d8510778C77E5b87,20833 0x41ff8F8f50AdFECdBA8e5C0d7D247D246964e931,20833 0x01984361979195894d8C5262cC9E8560644d5eA7,20833 0xf0fEb4DA647161c501C6fA06E1A15707796C4589,20833 0x8b2A834e537ba164cbA8Cb9E27630553F4d14ba3,20833 0x8e87CB675E0f1F5BA60E06446fAa3CFe4816b9E5,20833 0x8b5D370Ab5a50CBF6b6b007B09A2EAF22FA57A02,20833 0x151c662C25E3e7636fc949A88D957642Ff422B48,20833 0x2B981863A0FBf4e07c8508623De8Bd6d4b28419C,20833 0xdC7Aa225964267c7E0EfB35f4931426209E90312,20833 0xba7Fe76cCF1Be61e12CFF94d72C51ab31C6C47b8,20833 0x01C52d07FED773FC14b5025b41D1742031cD7c8D,20833 0xf43fcdf0697b31a5adff5343ce21d154d1410116,20833 0x1140188B7d1EB4001D0A9612152Ee8EAdc196a08,20833 0xEceF419A072bBc04437c2D77cDE5E0B70848B48F,20833 0x94337a2880725312bD24766894d375dcf6568556,20833 0xC118977A7E19076F609689EC8D56E2F16C6Ba90A,20833 0x2cF75011aad4693d89fcfF1dA50d4DDa145294ff,20833 0xFD6C5aC853391486D25dDD5cEfB1f7040ee31C2C,20833 0x1051E355Adf5C153F656c3E950f1a75FE180eF79,20833 0x760739f49Fc2936A59745644a94a5400c62a4B22,20833 0x7D98fa238C3bBF0f2BCD1bcE19eFA028474B4E07,20833 0x9fb63721bE0b1259c41F35BfeEFB8ad543bbDdD2,20833 0xD9459cc85E78e0336aDb349EAbF257Dbaf9d5a2B,20833 0x1Fd717A0AD0d3A163Fc7359c449A4a8490866Ce6,20833 0xeE2E0E56e11faE260f3DE0D6767fc1e970FC69D3,20833 0x568FcF35D04f92e341883597E14728a5695C2578,20833 0x3A66369a46F343886bbAcD130Fc2bDA51423aBA0,20833 0x279D4a00CB930dc6202c2c6153a2289A105831EC,20833 0x8C51e00804250EbD931211b5fafD048098cF90E2,20833 0x77Dfdf520a34bBcD87d907310A7cfEF7439CB044,20833 0x765a2CB437ebF35d0B1EFa79F57EB0C093C5b354,20833 0xa91A30500A60258dC83F08bD7E29086F19E75E10,20833 0x003e11FC88fc30C3048087D2BdFEfA2D48C6644c,20833 0xC761C1896e90D4a88Ab615B2683024974F6C2f26,20833 0xc30F3e11B4f34259ce948A5558F73f64fDc9Ed7B,20833 0xD57f6A60958B0D3EAFcD293E90F324De16C5F16b,20833 0x9b1b1E9e37Eb424daCe0d8Dd7218a8a661105b2d,20833 0x970A14730b476788B99e3fb706a4B5c6b1777808,20833 0xc99f67433019D1DA18C311e767FAa2b8EC250886,20833 0x83662146196a61050D29636b9F9C782750187AFa,20833 0x5e4cddf0b9d95d4e849Ed22BE228283a2485967D,20833 0x2d1f8cc4a77DBbDb6cD8B220Fa5B8bc70CC6afbe,20833 0x0093F93A884Da1D86c07fB6F7DF016957a16cc88,20833 0x793e06C5c7d23a97B452F90FCC37F54078c56b7B,20833 0x50d1b9a839270229d63953BCCE253b0C145F9A4a,20833 0x01a590a5bb729f9d50c70524ba1d1872ae805e2d,20833 0xEB803dD1bba222fdFE824b7356405b39FcCBFEcD,20833 0xdb1899Ee356001B97193BC7DEA8Da27dC661E365,20833 ================================================ FILE: scripts/sgtGeneration/loadBalances.js ================================================ // GENERAL PARAMS const sourceAccount = "0x1dba1131000664b884a1ba238464159892252d3a"; const tokenAddress = '0xd248b0d48e44aaf9c49aea0312be7e13a6dc1468'; const Web3 = require("web3"); const fs = require("fs"); const async = require("async"); const path = require("path"); // create an instance of web3 using the HTTP provider. // NOTE in mist web3 is already available, so check first if its available before instantiating const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); const BigNumber = require("bignumber.js"); const eth = web3.eth; var tokenAbi =[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"creationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newController","type":"address"}],"name":"changeController","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_blockNumber","type":"uint256"}],"name":"balanceOfAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_cloneTokenName","type":"string"},{"name":"_cloneDecimalUnits","type":"uint8"},{"name":"_cloneTokenSymbol","type":"string"},{"name":"_snapshotBlock","type":"uint256"},{"name":"_transfersEnabled","type":"bool"}],"name":"createCloneToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"generateTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_blockNumber","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"data","type":"uint256[]"}],"name":"multiMint","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"transfersEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"parentSnapShotBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroyTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenFactory","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_transfersEnabled","type":"bool"}],"name":"enableTransfers","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_tokenFactory","type":"address"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_cloneToken","type":"address"},{"indexed":false,"name":"_snapshotBlock","type":"uint256"}],"name":"NewCloneToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Approval","type":"event"}]; var token = web3.eth.contract(tokenAbi).at(tokenAddress); const multiple = 50; const D160 = new BigNumber("10000000000000000000000000000000000000000", 16); const loadCsv = (cb) => { const repeated = {}; const balances = []; fs.readFile(path.join(__dirname, "initialBalance.csv"), "utf8", (err, res) => { if (err) { cb(err); return; } const lines = res.split("\n"); for (let i = 0; i < lines.length; i += 1) { const line = lines[ i ].split(","); if (line.length === 2) { const addr = line[ 0 ].toLowerCase(); if (!web3.isAddress(addr)) { console.log("Invalid address: ", addr); cb(new Error(`Invalid address ${ addr }`)); return; } if (repeated[ addr ]) { console.log("Address is repeated: ", addr); cb(new Error(`Address is repeated: ${ addr }`)); return; } repeated[ addr ] = true; const amount = new BigNumber(line[ 1 ]); if (amount.isZero()) { console.log("Address with zero balance: ", addr); cb(new Error(`Address with zero balance ${ addr }`)); return; } balances.push({ address: line[ 0 ], amount: amount.toString(10), }); } } cb(null, balances); }); }; const multiSend = (balances, cb) => { let i; const packetbalances = []; for (i = 0; i < balances.length; i += 1) { packetbalances.push(pack(balances[ i ].address, balances[ i ].amount)); } let pos = 0; async.whilst( () => pos < packetbalances.length, (cb1) => { const sendBalances = packetbalances.slice(pos, pos + multiple); console.log("Transaction: " + pos + " Length: " + sendBalances.length); pos += multiple; token.multiMint( sendBalances, { from: sourceAccount, gas: 3700000, gasPrice: eth.gasPrice.mul(1.1).floor() }, (err, txHash) => { if (err) return cb(err); console.log("txHash: ", txHash); cb1(); }); }, cb); function pack(address, amount) { const addressNum = new BigNumber(address.substring(2), 16); const amountWei = new BigNumber(amount); const v = D160.mul(amountWei).add(addressNum); return v.toString(10); } }; loadCsv((err, balances) => { if (err) { console.log(err); } else { multiSend(balances, (err2) => { if (err2) { console.log(err2); } else { console.log("terminated succefully"); } }); } }); ================================================ FILE: test/claimExternal.js ================================================ // Simulate a an external claim const MultiSigWallet = artifacts.require("MultiSigWallet"); const MiniMeTokenFactory = artifacts.require("MiniMeTokenFactory"); const SGT = artifacts.require("SGT"); const SNT = artifacts.require("SNT"); const StatusContributionMock = artifacts.require("StatusContributionMock"); const ContributionWallet = artifacts.require("ContributionWallet"); const DevTokensHolder = artifacts.require("DevTokensHolderMock"); const SGTExchanger = artifacts.require("SGTExchanger"); const DynamicCeiling = artifacts.require("DynamicCeiling"); const SNTPlaceHolderMock = artifacts.require("SNTPlaceHolderMock"); const ExternalToken = artifacts.require("ExternalToken"); const setHiddenCurves = require("./helpers/hiddenCurves.js").setHiddenCurves; const assertFail = require("./helpers/assertFail"); contract("StatusContribution", function(accounts) { const addressStatus = accounts[0]; const addressCommunity = accounts[1]; const addressReserve = accounts[2]; const addressDevs = accounts[3]; const addressSGTHolder = accounts[4]; let multisigStatus; let multisigCommunity; let multisigReserve; let multisigDevs; let miniMeTokenFactory; let sgt; let snt; let statusContribution; let contributionWallet; let devTokensHolder; let sgtExchanger; let dynamicCeiling; let sntPlaceHolder; let externalToken; const curves = [ [web3.toWei(3), 30, 10**12], [web3.toWei(13), 30, 10**12], [web3.toWei(15), 30, 10**12], ]; const startBlock = 1000000; const endBlock = 1003000; const maxSGTSupply = 5000 * 2; it("Deploys all contracts", async function() { multisigStatus = await MultiSigWallet.new([addressStatus], 1); multisigCommunity = await MultiSigWallet.new([addressCommunity], 1); multisigReserve = await MultiSigWallet.new([addressReserve], 1); multisigDevs = await MultiSigWallet.new([addressDevs], 1); miniMeTokenFactory = await MiniMeTokenFactory.new(); sgt = await SGT.new(miniMeTokenFactory.address); await sgt.generateTokens(addressSGTHolder, 5000); snt = await SNT.new(miniMeTokenFactory.address); statusContribution = await StatusContributionMock.new(); contributionWallet = await ContributionWallet.new( multisigStatus.address, endBlock, statusContribution.address); devTokensHolder = await DevTokensHolder.new( multisigDevs.address, statusContribution.address, snt.address); sgtExchanger = await SGTExchanger.new(sgt.address, snt.address, statusContribution.address); dynamicCeiling = await DynamicCeiling.new(addressStatus, statusContribution.address); await setHiddenCurves(dynamicCeiling, curves); sntPlaceHolder = await SNTPlaceHolderMock.new( multisigCommunity.address, snt.address, statusContribution.address, sgtExchanger.address); await snt.changeController(statusContribution.address); await statusContribution.initialize( snt.address, sntPlaceHolder.address, startBlock, endBlock, dynamicCeiling.address, contributionWallet.address, multisigReserve.address, sgtExchanger.address, devTokensHolder.address, sgt.address, maxSGTSupply); externalToken = await ExternalToken.new(); await externalToken.generateTokens(addressStatus, 1000); }); it("Sends to and recover tokens from the StatusContribution", async function() { await externalToken.transfer(statusContribution.address, 100); const balanceBefore = await externalToken.balanceOf(addressStatus); assert.equal(balanceBefore.toNumber(), 900); await statusContribution.claimTokens(externalToken.address); const afterBefore = await externalToken.balanceOf(addressStatus); assert.equal(afterBefore.toNumber(), 1000); }); it("Recovers tokens sent to SNT", async function() { await externalToken.transfer(snt.address, 100); const balanceBefore = await externalToken.balanceOf(addressStatus); assert.equal(balanceBefore.toNumber(), 900); await statusContribution.claimTokens(externalToken.address); const afterBefore = await externalToken.balanceOf(addressStatus); assert.equal(afterBefore.toNumber(), 1000); }); }); ================================================ FILE: test/contribution.js ================================================ // Simulate a full contribution const MultiSigWallet = artifacts.require("MultiSigWallet"); const MiniMeTokenFactory = artifacts.require("MiniMeTokenFactory"); const SGT = artifacts.require("SGTMock"); const SNT = artifacts.require("SNTMock"); const StatusContributionMock = artifacts.require("StatusContributionMock"); const ContributionWallet = artifacts.require("ContributionWallet"); const DevTokensHolder = artifacts.require("DevTokensHolderMock"); const SGTExchangerMock = artifacts.require("SGTExchangerMock"); const DynamicCeiling = artifacts.require("DynamicCeiling"); const SNTPlaceHolderMock = artifacts.require("SNTPlaceHolderMock"); const setHiddenCurves = require("./helpers/hiddenCurves.js").setHiddenCurves; const assertFail = require("./helpers/assertFail"); contract("StatusContribution", function(accounts) { const addressStatus = accounts[0]; const addressCommunity = accounts[1]; const addressReserve = accounts[2]; const addressDevs = accounts[3]; const addressSGTHolder = accounts[4]; const addressGuaranteed0 = accounts[7]; const addressGuaranteed1 = accounts[8]; let multisigStatus; let multisigCommunity; let multisigReserve; let multisigDevs; let miniMeTokenFactory; let sgt; let snt; let statusContribution; let contributionWallet; let devTokensHolder; let sgtExchanger; let dynamicCeiling; let sntPlaceHolder; let lim; let cur; const divs = 30; const curves = [ [web3.toWei(3), 30, 10**12], [web3.toWei(8), 30, 10**12], [web3.toWei(15), 30, 10**12], ]; const startBlock = 1000000; const endBlock = 1040000; const maxSGTSupply = 5000 * 2; it("Deploys all contracts", async function() { multisigStatus = await MultiSigWallet.new([addressStatus], 1); multisigCommunity = await MultiSigWallet.new([addressCommunity], 1); multisigReserve = await MultiSigWallet.new([addressReserve], 1); multisigDevs = await MultiSigWallet.new([addressDevs], 1); miniMeTokenFactory = await MiniMeTokenFactory.new(); sgt = await SGT.new(miniMeTokenFactory.address); await sgt.generateTokens(addressSGTHolder, 2500); await sgt.generateTokens(addressStatus, 2500); snt = await SNT.new(miniMeTokenFactory.address); statusContribution = await StatusContributionMock.new(); contributionWallet = await ContributionWallet.new( multisigStatus.address, endBlock, statusContribution.address); devTokensHolder = await DevTokensHolder.new( multisigDevs.address, statusContribution.address, snt.address); sgtExchanger = await SGTExchangerMock.new(sgt.address, snt.address, statusContribution.address); dynamicCeiling = await DynamicCeiling.new(addressStatus, statusContribution.address); await setHiddenCurves(dynamicCeiling, curves); sntPlaceHolder = await SNTPlaceHolderMock.new( multisigCommunity.address, snt.address, statusContribution.address, sgtExchanger.address); await snt.changeController(statusContribution.address); await statusContribution.initialize( snt.address, sntPlaceHolder.address, startBlock, endBlock, dynamicCeiling.address, contributionWallet.address, multisigReserve.address, sgtExchanger.address, devTokensHolder.address, sgt.address, maxSGTSupply); }); it("Checks initial parameters", async function() { assert.equal(await snt.controller(), statusContribution.address); }); it("Checks that nobody can buy before the sale starts", async function() { await assertFail(async function() { await snt.send(web3.toWei(1)); }); }); it("Adds 2 guaranteed addresses ", async function() { await statusContribution.setGuaranteedAddress(addressGuaranteed0, web3.toWei(1)); await statusContribution.setGuaranteedAddress(addressGuaranteed1, web3.toWei(2)); const permited7 = await statusContribution.guaranteedBuyersLimit(addressGuaranteed0); const permited8 = await statusContribution.guaranteedBuyersLimit(addressGuaranteed1); assert.equal(web3.fromWei(permited7).toNumber(), 1); assert.equal(web3.fromWei(permited8).toNumber(), 2); }); it("Reveals a curve, moves time to start of the ICO, and does the first buy", async function() { await dynamicCeiling.revealCurve( curves[0][0], curves[0][1], curves[0][2], false, web3.sha3("pwd0")); await statusContribution.setMockedBlockNumber(1000000); await sgt.setMockedBlockNumber(1000000); await snt.setMockedBlockNumber(1000000); lim = 3; cur = 0; await snt.sendTransaction({value: web3.toWei(1), gas: 300000, gasPrice: "20000000000", from: addressStatus}); const b = Math.min(1, ((lim - cur) / divs)); cur += b; const balance = await snt.balanceOf(addressStatus); assert.equal(web3.fromWei(balance).toNumber(), b * 10000); }); it("Pauses and resumes the contribution ", async function() { await statusContribution.setMockedBlockNumber(1005000); await sgt.setMockedBlockNumber(1005000); await snt.setMockedBlockNumber(1005000); await statusContribution.pauseContribution(); await assertFail(async function() { await snt.sendTransaction({value: web3.toWei(5), gas: 300000, gasPrice: "20000000000"}); }); await statusContribution.resumeContribution(); }); it("Returns the remaining of the last transaction ", async function() { const initialBalance = await web3.eth.getBalance(addressStatus); await snt.sendTransaction({value: web3.toWei(5), gas: 300000, gasPrice: "20000000000"}); const finalBalance = await web3.eth.getBalance(addressStatus); const b = Math.min(5, ((lim - cur) / divs)); cur += b; const spent = web3.fromWei(initialBalance.sub(finalBalance)).toNumber(); assert.isAbove(spent, b); assert.isBelow(spent, b + 0.02); const totalCollected = await statusContribution.totalCollected(); assert.equal(web3.fromWei(totalCollected), cur); const balanceContributionWallet = await web3.eth.getBalance(contributionWallet.address); assert.equal(web3.fromWei(balanceContributionWallet), cur); }); it("Reveals second curve and checks that the limit is right", async function() { await dynamicCeiling.revealCurve( curves[1][0], curves[1][1], curves[1][2], false, web3.sha3("pwd1")); await dynamicCeiling.moveTo(1); await statusContribution.setMockedBlockNumber(1005200); await sgt.setMockedBlockNumber(1005200); await snt.setMockedBlockNumber(1005200); const initialBalance = await web3.eth.getBalance(addressStatus); await snt.sendTransaction({value: web3.toWei(10), gas: 300000, gasPrice: "20000000000"}); const finalBalance = await web3.eth.getBalance(addressStatus); lim = 8; const b = Math.min(5, ((lim - cur) / divs)); cur += b; const spent = web3.fromWei(initialBalance.sub(finalBalance)).toNumber(); assert.isAbove(spent, b); assert.isBelow(spent, b + 0.02); const totalCollected = await statusContribution.totalCollected(); assert.equal(web3.fromWei(totalCollected), cur); const balanceContributionWallet = await web3.eth.getBalance(contributionWallet.address); assert.equal(web3.fromWei(balanceContributionWallet), cur); }); it("Reveals last curve and fills the collaboration", async function() { await dynamicCeiling.revealCurve( curves[2][0], curves[2][1], curves[2][2], true, web3.sha3("pwd2")); await dynamicCeiling.moveTo(2); let blk = 1025100; await statusContribution.setMockedBlockNumber(blk); await sgt.setMockedBlockNumber(blk); await snt.setMockedBlockNumber(blk); blk += 100; const initialBalance = await web3.eth.getBalance(addressStatus); await statusContribution.proxyPayment( addressCommunity, {value: web3.toWei(15), gas: 300000, from: addressStatus, gasPrice: "20000000000"}); lim = 15; const b = Math.min(5, ((lim - cur) / divs)); cur += b; const finalBalance = await web3.eth.getBalance(addressStatus); const balance1 = await snt.balanceOf(addressCommunity); assert.equal(web3.fromWei(balance1).toNumber(), b * 10000); const spent = web3.fromWei(initialBalance.sub(finalBalance)).toNumber(); assert.isAbove(spent, b); assert.isBelow(spent, b + 0.02); const totalCollected = await statusContribution.totalCollected(); assert.equal(web3.fromWei(totalCollected), cur); const balanceContributionWallet = await web3.eth.getBalance(contributionWallet.address); assert.equal(web3.fromWei(balanceContributionWallet), cur); while (cur < 14) { await statusContribution.setMockedBlockNumber(blk); blk += 101; await statusContribution.proxyPayment( addressCommunity, {value: web3.toWei(15), gas: 300000, from: addressStatus, gasPrice: "20000000000"}); const b2 = Math.min(5, ((lim - cur) / divs)); cur += b2; const balanceContributionWallet2 = await web3.eth.getBalance(contributionWallet.address); assert.isBelow(Math.abs(web3.fromWei(balanceContributionWallet2).toNumber() - cur), 0.0001); } }); it("Doesn't allow transfers during contribution period", async function() { await assertFail(async function() { await snt.transfer(addressSGTHolder, web3.toWei(1000)); }); }); it("Checks that Guaranteed addresses are able to buy", async function() { await snt.sendTransaction({value: web3.toWei(3), gas: 300000, from: addressGuaranteed0}); await snt.sendTransaction({value: web3.toWei(3), gas: 300000, from: addressGuaranteed1}); const balance7 = await snt.balanceOf(addressGuaranteed0); const balance8 = await snt.balanceOf(addressGuaranteed1); assert.equal(web3.fromWei(balance7).toNumber(), 10000); assert.equal(web3.fromWei(balance8).toNumber(), 20000); }); it("Finalizes", async function() { await statusContribution.setMockedBlockNumber(endBlock + 1); await statusContribution.finalize(); const totalSupply = await snt.totalSupply(); assert.isBelow(web3.fromWei(totalSupply).toNumber() - (180000 / 0.46), 0.01); const balanceSGT = await snt.balanceOf(sgtExchanger.address); assert.equal(balanceSGT.toNumber(), totalSupply.mul(0.05).toNumber()); const balanceDevs = await snt.balanceOf(devTokensHolder.address); assert.equal(balanceDevs.toNumber(), totalSupply.mul(0.20).toNumber()); const balanceSecondary = await snt.balanceOf(multisigReserve.address); assert.equal(balanceSecondary.toNumber(), totalSupply.mul(0.29).toNumber()); }); it("Moves the Ether to the final multisig", async function() { await sgtExchanger.setMockedBlockNumber(endBlock + 5); await multisigStatus.submitTransaction( contributionWallet.address, 0, contributionWallet.contract.withdraw.getData()); const balance = await web3.eth.getBalance(multisigStatus.address); assert.isBelow(Math.abs(web3.fromWei(balance).toNumber() - (cur+3)), 0.00001); }); it("Exchanges SGT by SNT", async function() { await sgtExchanger.collect({from: addressSGTHolder}); const balance = await snt.balanceOf(addressSGTHolder); const totalSupply = await snt.totalSupply(); assert.equal(totalSupply.mul(0.025).toNumber(), balance.toNumber()); }); it("Doesn't allow transfers in the 1 week period", async function() { await assertFail(async function() { await snt.transfer(addressSGTHolder, web3.toWei(1000)); }); }); it("Allows transfers after 1 week period", async function() { const t = Math.floor(new Date().getTime() / 1000) + (86400 * 7) + 1000; await sntPlaceHolder.setMockedTime(t); await snt.transfer(accounts[5], web3.toWei(1000)); const balance2 = await snt.balanceOf(accounts[5]); assert.equal(web3.fromWei(balance2).toNumber(), 1000); }); it("Disallows devs from transfering before 6 months have past", async function() { const t = Math.floor(new Date().getTime() / 1000) + (86400 * 7) + 1000; await devTokensHolder.setMockedTime(t); // This function will fail in the multisig await multisigDevs.submitTransaction( devTokensHolder.address, 0, devTokensHolder.contract.collectTokens.getData(), {from: addressDevs, gas: 1000000}); const balance = await snt.balanceOf(multisigDevs.address); assert.equal(balance,0); }); it("Allows devs to extract after 6 months", async function() { const t = (await statusContribution.finalizedTime()).toNumber() + (86400 * 360); await devTokensHolder.setMockedTime(t); const totalSupply = await snt.totalSupply(); await multisigDevs.submitTransaction( devTokensHolder.address, 0, devTokensHolder.contract.collectTokens.getData(), {from: addressDevs}); const balance = await snt.balanceOf(multisigDevs.address); const calcTokens = web3.fromWei(totalSupply.mul(0.20).mul(0.5)).toNumber(); const realTokens = web3.fromWei(balance).toNumber(); assert.equal(realTokens, calcTokens); }); it("Allows devs to extract everything after 24 months", async function() { const t = Math.floor(new Date().getTime() / 1000) + (86400 * 360 * 2); await devTokensHolder.setMockedTime(t); const totalSupply = await snt.totalSupply(); await multisigDevs.submitTransaction( devTokensHolder.address, 0, devTokensHolder.contract.collectTokens.getData(), {from: addressDevs}); const balance = await snt.balanceOf(multisigDevs.address); const calcTokens = web3.fromWei(totalSupply.mul(0.20)).toNumber(); const realTokens = web3.fromWei(balance).toNumber(); assert.equal(calcTokens, realTokens); }); it("Checks that SNT's Controller is upgradeable", async function() { await multisigCommunity.submitTransaction( sntPlaceHolder.address, 0, sntPlaceHolder.contract.changeController.getData(accounts[6]), {from: addressCommunity}); const controller = await snt.controller(); assert.equal(controller, accounts[6]); }); }); ================================================ FILE: test/dynamicCeiling.js ================================================ // Simulate dynamic ceilings const DynamicCeiling = artifacts.require("DynamicCeiling"); const setHiddenCurves = require("./helpers/hiddenCurves.js").setHiddenCurves; contract("DynamicCeiling", function(accounts) { let dynamicCeiling; const curves = [ [web3.toWei(1000), 30, 10**12], [web3.toWei(21000), 30, 10**12], [web3.toWei(61000), 30, 10**12], ]; it("Deploys dynamicCeiling", async function() { dynamicCeiling = await DynamicCeiling.new(accounts[0], accounts[0]); assert.equal(await dynamicCeiling.currentIndex(), 0); }); it("Checks that toCollect is 0 before curves are set", async function() { assert.equal(await dynamicCeiling.toCollect.call(0), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(15)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(20)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(30)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(55)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(676)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(5555)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10**8)), 0); assert.equal(await dynamicCeiling.currentIndex(), 0); }); it("Sets the curves", async function() { await setHiddenCurves(dynamicCeiling, curves); assert.equal(await dynamicCeiling.nCurves(), 10); }); it("Checks that toCollect is 0 before curves are revealed", async function() { assert.equal(await dynamicCeiling.toCollect.call('0'), '0'); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(15)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(20)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(30)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(55)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(676)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(5555)), 0); assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10**8)), 0); assert.equal(await dynamicCeiling.currentIndex(), 0); }); it("Reveals 1st curve", async function() { await dynamicCeiling.revealCurve( curves[0][0], curves[0][1], curves[0][2], false, web3.sha3("pwd0")); assert.equal(await dynamicCeiling.revealedCurves(), 1); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0'); assert.equal(await dynamicCeiling.allRevealed(), false); }); it("Checks toCollect after 1st curve is revealed", async function() { assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0'); assert.equal((await dynamicCeiling.toCollect.call(0)).toFixed(), '33333333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(10))).toFixed(), '33000000000000000000'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(15))).toFixed(), '32833333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(20))).toFixed(), '32666666666666666666'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(30))).toFixed(), '32333333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(55))).toFixed(), '31500000000000000000'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(676))).toFixed(), '10800000000000000000'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(999))).toFixed(), '33333333333333333'); assert.equal((await dynamicCeiling.toCollect.call('999999999998999999999')).toFixed(), '1000000001'); assert.equal((await dynamicCeiling.toCollect.call('999999999999000000000')).toFixed(), '1000000000'); assert.equal((await dynamicCeiling.toCollect.call('999999999999999999999')).toFixed(), '1'); await dynamicCeiling.toCollect(curves[0][0]); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0'); assert.equal((await dynamicCeiling.toCollect.call(curves[0][0])).toFixed(), '0'); }); it("Reveals 2nd curve", async function() { await dynamicCeiling.revealCurve( curves[1][0], curves[1][1], curves[1][2], false, web3.sha3("pwd1")); assert.equal(await dynamicCeiling.revealedCurves(), 2); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0'); assert.equal(await dynamicCeiling.allRevealed(), false); }); it("Checks toCollect after 2nd curve is revealed", async function() { await dynamicCeiling.toCollect(curves[0][0]); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '1'); assert.equal((await dynamicCeiling.toCollect.call(curves[0][0])).toFixed(), '666666666666666666666') assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1010))).toFixed(), '666333333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1015))).toFixed(), '666166666666666666666'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1020))).toFixed(), '666000000000000000000'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1030))).toFixed(), '665666666666666666666'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1055))).toFixed(), '664833333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(10676))).toFixed(), '344133333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(10999))).toFixed(), '333366666666666666666'); assert.equal((await dynamicCeiling.toCollect.call('20999999999998999999999')).toFixed(), '1000000001'); assert.equal((await dynamicCeiling.toCollect.call('20999999999999000000000')).toFixed(), '1000000000'); assert.equal((await dynamicCeiling.toCollect.call('20999999999999999999999')).toFixed(), '1'); await dynamicCeiling.toCollect(curves[1][0]); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '1'); assert.equal((await dynamicCeiling.toCollect.call(curves[1][0])).toFixed(), '0'); }); it("Reveals last curve", async function() { await dynamicCeiling.revealCurve( curves[2][0], curves[2][1], curves[2][2], true, web3.sha3("pwd2")); assert.equal(await dynamicCeiling.revealedCurves(), 3); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '1'); assert.equal(await dynamicCeiling.allRevealed(), true); }); it("Checks toCollect after 3rd curve is revealed", async function() { await dynamicCeiling.toCollect(curves[1][0]); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '2'); assert.equal((await dynamicCeiling.toCollect.call(curves[1][0])).toFixed(), '1333333333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21010))).toFixed(), '1333000000000000000000'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21015))).toFixed(), '1332833333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21020))).toFixed(), '1332666666666666666666'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21030))).toFixed(), '1332333333333333333333'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21055))).toFixed(), '1331500000000000000000'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21676))).toFixed(), '1310800000000000000000'); assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21999))).toFixed(), '1300033333333333333333'); assert.equal((await dynamicCeiling.toCollect.call('60999999999998999999999')).toFixed(), '1000000001'); assert.equal((await dynamicCeiling.toCollect.call('60999999999999000000000')).toFixed(), '1000000000'); assert.equal((await dynamicCeiling.toCollect.call('60999999999999999999999')).toFixed(), '1'); await dynamicCeiling.toCollect(curves[2][0]); assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '2'); assert.equal((await dynamicCeiling.toCollect.call(curves[2][0])).toFixed(), '0'); }); it("Deploys dynamicCeiling", async function() { dynamicCeiling = await DynamicCeiling.new(accounts[0], accounts[0]); assert.equal(await dynamicCeiling.currentIndex(), 0); }); it("Sets the curves", async function() { await setHiddenCurves(dynamicCeiling, curves); assert.equal(await dynamicCeiling.nCurves(), 10); }); it("Reveals multiple curves", async function() { await dynamicCeiling.revealMulti( [ curves[0][0], curves[1][0], curves[2][0], ], [ curves[0][1], curves[1][1], curves[2][1], ], [ curves[0][2], curves[1][2], curves[2][2], ], [ false, false, true, ], [ web3.sha3("pwd0"), web3.sha3("pwd1"), web3.sha3("pwd2"), ] ); assert.equal(await dynamicCeiling.currentIndex(), 0); assert.equal(await dynamicCeiling.revealedCurves(), 3); assert.equal(await dynamicCeiling.allRevealed(), true); }); }); ================================================ FILE: test/helpers/assertFail.js ================================================ module.exports = async function(callback) { let web3_error_thrown = false; try { await callback(); } catch (error) { if (error.message.search("invalid opcode")) web3_error_thrown = true; } assert.ok(web3_error_thrown, "Transaction should fail"); }; ================================================ FILE: test/helpers/assertGas.js ================================================ module.exports = async function(error) { assert.isAbove(error.message.search('of gas'), -1, 'Out of gas error must be returned'); } ================================================ FILE: test/helpers/assertJump.js ================================================ module.exports = async function(error) { assert.isAbove(error.message.search('invalid JUMP'), -1, 'Invalid JUMP error must be returned'); } ================================================ FILE: test/helpers/hiddenCurves.js ================================================ exports.setHiddenCurves = async function(dynamicCeiling, curves) { const hashes = []; let i = 0; for (let c of curves) { const h = await dynamicCeiling.calculateHash( c[0], c[1], c[2], i === curves.length - 1, web3.sha3(`pwd${ i }`)); hashes.push(h); i += 1; } for (; i < 10; i += 1) { hashes.push(web3.sha3(`pwd${ i }`)); } await dynamicCeiling.setHiddenCurves(hashes); }; ================================================ FILE: truffle.js ================================================ const HDWalletProvider = require('truffle-hdwallet-provider'); const mnemonic = process.env.TEST_MNEMONIC || 'status mnemonic status mnemonic status mnemonic status mnemonic status mnemonic status mnemonic'; const providerRopsten = new HDWalletProvider(mnemonic, 'https://ropsten.infura.io/', 0); const providerKovan = new HDWalletProvider(mnemonic, 'https://kovan.infura.io', 0); module.exports = { networks: { development: { network_id: 15, host: "localhost", port: 8545, gas: 4000000, gasPrice: 20e9, }, development_migrate: { network_id: 15, host: "localhost", port: 8545, gas: 4000000, gasPrice: 20e9, from: "0xf93df8c288b9020e76583a6997362e89e0599e99", }, mainnet: { network_id: 1, host: "localhost", port: 8545, gas: 4000000, gasPrice: 20e9, from: "0xf93df8c288b9020e76583a6997362e89e0599e99", }, ropsten: { network_id: 3, provider: providerRopsten, gas: 4000000, gasPrice: 20e9, }, kovan: { network_id: 42, provider: providerKovan, gas: 4000000, gasPrice: 20e9, }, } };