Compare commits

..

25 Commits

Author SHA1 Message Date
nolash
cc877c2c44 Merge remote-tracking branch 'origin/master' into lash/declarator 2021-02-23 17:16:40 +01:00
nolash
9933979e14
Update transfer authorization interface 2021-02-16 14:07:44 +01:00
nolash
5fd512ac69
Update transfer authorization interface 2021-02-16 13:28:52 +01:00
nolash
da7c0ca79e Merge remote-tracking branch 'origin/master' into lash/declarator 2021-02-14 13:21:53 +01:00
nolash
0b2c79b4da
Add registry lister stub 2021-02-12 17:48:20 +01:00
nolash
698ef3a30f
Rename addressdeclarator to declarator 2021-01-13 12:05:36 +01:00
nolash
30c13366fa
Slight change in trasnfer approval json 2021-01-05 23:35:00 +01:00
nolash
bc29be7e6c
Start docs 2021-01-05 20:22:51 +01:00
nolash
4bd3dceaa6
Correct parameter name to requests mapping in transfer approval 2021-01-05 10:22:29 +01:00
nolash
17354e424e
Fix interface typos 2021-01-02 20:21:59 +01:00
nolash
e6612b2388
Add WIP interface calc material, documentation stub 2021-01-02 17:09:06 +01:00
nolash
82d37092c2
Update transferapproval interface 2021-01-02 08:49:32 +01:00
nolash
83eae00818
Add ERC165 calculator 2020-12-29 21:51:37 +01:00
nolash
e485d221a8
Rename TokenRegistry 2020-12-22 23:21:29 +01:00
nolash
8e1a27d8dc
Add version specifier 2020-12-22 08:23:23 +01:00
nolash
0e87469fe0
Add token endorser interface 2020-12-22 07:59:42 +01:00
nolash
9b42a393ea
Add addressOf to Registry 2020-12-16 13:18:08 +01:00
nolash
ad3be535ba
Revert alpine reset 2020-12-16 09:23:32 +01:00
nolash
26f0a2452d
Reset python alpine on docker image 2020-12-16 08:38:34 +01:00
nolash
015eb7b64e
Bump file version 2020-12-11 18:05:00 +01:00
nolash
75561cebfa
A lot better makefile 2020-12-11 18:04:32 +01:00
nolash
69bafdadcf
Rename accountsindex 2020-12-11 16:29:36 +01:00
nolash
d66b95dd1a
Add missing dockerfile, registry client sol 2020-12-11 16:11:27 +01:00
nolash
1fcef8a213
Add json to suffix 2020-12-11 16:09:35 +01:00
nolash
6b2a9286b2
Replace deprecated method in bancor registry 2020-12-11 12:51:37 +01:00
296 changed files with 502 additions and 7623 deletions

9
.gitignore vendored
View File

@ -1,9 +0,0 @@
__pycache__
gmon.out
dist
build
*.egg-info
.venv
solidity/*.json
solidity/*.interface
solidity/*.bin

19
AccountRegistry.sol Normal file
View File

@ -0,0 +1,19 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
interface AccountRegistry {
event AccountAdded(address indexed addedAccount, uint256 indexed accountIndex);
function accounts(uint256 _idx) external view returns (address);
function accountsIndex(address _account) external view returns (uint256);
function count() external view returns (uint256);
function addWriter(address _writer) external returns (bool);
function deleteWriter(address _writer) external returns (bool);
function add(address _account) external returns (bool);
function have(address _account) external view returns (bool);
}

15
AddressDeclarator.sol Normal file
View File

@ -0,0 +1,15 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
interface AddressDeclarator {
function addDeclaration(address _address, bytes32 _proof) external returns ( bytes32 );
function declaratorCount(address _objectAddress) external view returns ( uint256 );
function declaratorAddressAt(address _targetAddress, uint256 _idx) external view returns ( address );
function declaration(address _subjectAddress, address _objectAddress) external view returns ( bytes32[] memory );
function declarationCount(address _subjectAddress) external view returns ( uint256 );
function declarationAddressAt(address _subjectAddress, uint256 _idx) external view returns ( address );
}

View File

@ -1,9 +1,4 @@
- 0.2.0
- Bump chainlib-eth>=0.3.0,<0.4.0
- 0.0.3
- Update contracts to cic-base state 0.1.2-beta.5
- Add interface digest generator script
- 0.0.2
- Add token endorser contract
* Add token endorser contract
- 0.0.1
- Consolidate all existing contract interfaces
* Consolidate all existing contract interfaces

17
Converter.sol Normal file
View File

@ -0,0 +1,17 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface Converter {
function reserveBalance(address _reserveToken) external view returns (uint256);
function reserveWeight(address _reserveToken) external view returns (uint32);
function reserveTokens() external view returns (address[] memory);
function reserveRatio() external view returns (uint32);
function reserveTokenCount() external view returns (uint16);
function setConversionFee(uint32 _conversionFee) external;
function owner() external view returns (address);
function acceptOwnership() external;
}

12
ConverterRegistry.sol Normal file
View File

@ -0,0 +1,12 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface ConverterRegistry {
function getConvertibleTokens() external view returns (address[] memory);
function newConverter(uint16 _type, string memory _name, string memory _symbol, uint8 _decimals, uint32 _maxConversionFee, address[] memory _reserveTokens, uint32[] memory _reserveWeights) external returns(address);
function getConvertersByAnchors(address[] memory _anchors) external view returns (address[] memory);
}

15
Declarator.sol Normal file
View File

@ -0,0 +1,15 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
interface AddressDeclarator {
function addDeclaration(address _address, bytes32 _proof) external returns ( bytes32 );
function declaratorCount(address _objectAddress) external view returns ( uint256 );
function declaratorAddressAt(address _targetAddress, uint256 _idx) external view returns ( address );
function declaration(address _subjectAddress, address _objectAddress) external view returns ( bytes32[] memory );
function declarationCount(address _subjectAddress) external view returns ( uint256 );
function declarationAddressAt(address _subjectAddress, uint256 _idx) external view returns ( address );
}

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM ethereum/solc:0.6.12
# The solc image messes up the alpine environment, so we have to go all over again
FROM alpine
COPY --from=0 /usr/bin/solc /usr/bin/solc
RUN apk update && \
apk add make
WORKDIR /usr/src
COPY ./Makefile ./cic-contracts/Makefile
COPY ./*.sol ./cic-contracts/
RUN cd cic-contracts && \
make -B && make install -B
#RUN mkdir -vp /usr/local/share/cic/solidity && \
# cp -rv cic-contracts/abis
LABEL authors="Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746"
LABEL spdx-license-identifier="GPL-3.0-or-later"
LABEL description="Ethereum smart contract interfaces used by the CIC component suite"
LABEL version="3"

22
ERC20.sol Normal file
View File

@ -0,0 +1,22 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
interface ERC20 {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function name() external view returns(string memory);
function symbol() external view returns(string memory);
function decimals() external view returns(uint8);
function totalSupply() external view returns(uint256);
function balanceOf(address) external view returns(uint256);
function allowance(address _owner, address _spender) external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
}

6
ERC20.txt Normal file
View File

@ -0,0 +1,6 @@
totalSupply()
balanceOf(address)
allowance(address,address)
transfer(address,uint)
approve(address,uint)
transferFrom(address,address,uint)

18
Faucet.sol Normal file
View File

@ -0,0 +1,18 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 4
interface Faucet {
event FaucetUsed(address indexed _recipient, address indexed _token, uint256 _value);
event FaucetFail(address indexed _recipient, address indexed _token, uint256 _value);
event FaucetAmountChange(address indexed _token, uint256 _value);
function amount() external view returns (uint256);
function token() external view returns (address);
function setAmount(uint256 _amount) external returns (bool);
function giveTo(address _recipient) external returns (bool);
function cooldown(address _recipient) external returns (uint256);
}

View File

@ -1 +0,0 @@
LICENSE.GPL3

View File

@ -1,121 +0,0 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@ -1,235 +0,0 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are 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.
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.
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
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 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 work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 Affero 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 Affero 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 Affero 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 WARRANTY 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 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 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.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
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 AGPL, see <http://www.gnu.org/licenses/>.

View File

@ -1 +0,0 @@
include *requirements.txt python/cic/* python/cic/runnable/* LICENSE README*

View File

@ -2,58 +2,24 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# File-version: 5
INPUTS = $(wildcard solidity/*.sol)
OUTPUTS_JSON = $(patsubst %.sol, %.json, $(INPUTS))
OUTPUTS_INTERFACE = $(patsubst %.sol, %.interface, $(INPUTS))
OUTPUTS = $(OUTPUTS_JSON) $(OUTPUTS_INTERFACE)
PREFIX = $(DESTDIR)/usr/local/share/cic/solidity/abi
INPUTS = $(wildcard *.sol)
OUTPUTS = $(patsubst %.sol, %.json, $(INPUTS))
PREFIX = /usr/local/share/cic/solidity/abi
#%.abi.json: $(wildcard *.sol)
# install -vDm0644 $@ $(PREFIX)/$@
.SUFFIXES: .sol .json .interface
.SUFFIXES: .sol .json
.sol.json:
solc $(basename $@).sol --abi | awk 'NR>3' > $@
.sol.interface:
bash to_interface.sh $(basename $@).sol > $@
all: $(OUTPUTS)
all: outs doc
outs: $(OUTPUTS)
echo $(OUTPUTS)
install-code: $(OUTPUTS)
install: $(OUTPUTS)
install -vDm0644 -t $(PREFIX) $?
install-doc:
bash texify.sh
install: outs install-code install-doc doc
clean:
rm -vf solidity/*.json
rm -vf solidity/*.interface
doc:
bash texify.sh
make -C doc/texinfo
readme:
make -C doc/texinfo readme
pandoc -f docbook -t gfm doc/texinfo/build/docbook.xml > README.md
cp -v README.md python/README.md
python-contract: outs
mkdir -vp python-contract-interfaces/cic_contracts/data
cp -v solidity/*.interface python-contract-interfaces/cic_contracts/data
cp -v solidity/*.json python-contract-interfaces/cic_contracts/data
make -C python-contract-interfaces
python-cic: python
python setup.py sdist
python: python-cic python-contract
rm -vf *.json
.PHONY: clean install

19
Network.sol Normal file
View File

@ -0,0 +1,19 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface Network {
event Conversion(
address indexed _smartToken,
address indexed _fromToken,
address indexed _toToken,
uint256 _fromAmount,
uint256 _toAmount,
address _trader
);
function convert(address[] memory _path, uint256 _amount, uint256 _minReturn) external payable returns (uint256);
function rateByPath(address,uint256) external view returns (uint256);
}

983
README.md
View File

@ -1,983 +0,0 @@
# Smart contract interfaces
## Technology
CIC smart contracts are implemented using the *solidity* programming
language for the (Ethereum Virtual Machine (EVM).
## Adopted standards
### Signing
### ERC - Direct use
The following well-known solidity interfaces are used directly.
- [ERC20 - Token Standard](https://eips.ethereum.org/EIPS/eip-20)
- [ERC165 - Standard Interface
Detection](https://eips.ethereum.org/EIPS/eip-165)
- [ERC173 - Contract Ownership
Standard](https://eips.ethereum.org/EIPS/eip-173)
- [ERC191 - Signed Data
Standard](https://eips.ethereum.org/EIPS/eip-191)
- [ERC712 - Typed structured data hashing and
signing](https://eips.ethereum.org/EIPS/eip-712)
- [ERC721 - Non-Fungible Token
Standard](https://eips.ethereum.org/EIPS/eip-721)
- [ERC5007 - Time NFT (EIP-721 Time
Extension)](https://eips.ethereum.org/EIPS/eip-5007)
- [ERC5192 - Minimal Soulbound
NFTs](https://eips.ethereum.org/EIPS/eip-5192)
### ERCs Partial use
The following well-known solidity interfaces are partially implemented
in CIC native interfaces.
- [ERC5679 - Token Minting and
Burning](https://eips.ethereum.org/EIPS/eip-5679) (See `Minter`,
`Burner`)
## Native interfaces
### ACL
A simple Access Control List definition that returns true of false
depending on whether an signatory (address) is allowed to operate in a
given context.
#### ERC165 Interface identifier
3ef25013
#### Solidity interface definition
interface IACL {
// Returns true if the address has permission to operate in the given context.
function have(address _address) external view returns(bool);
}
#### Example implementation
<git://holbrook.no/eth-accounts-index.git>
### Accounts Index
Append-only list of addresses. Typically used for access control lists.
Addresses may be *added*, *removed*, aswell as *deactivated* and
*activated*. Deactivated accounts still count towards the `entryCount`.
The `entry` method is used to iterate the account list. The order of
which accounts are returned is not guaranteed. Any returned value
matching `address(0x00)` should be skipped, and not counted towards
`entryCount`.
May optionally record time when account was added.
#### ERC165 Interface identifier
b7bca625
#### Solidity interface definition
interface IAccountsIndex {
// Address added to store, index in array.
event AddressAdded(uint256 indexed _idx, address _account);
// Return number of entries in index.
function entryCount() external view returns (uint256);
// Return entry at the spceificed index.
// Will revert if index is beyond array length.
// An entry result of 0 means the entry should be skipped, and not count towards entry count.
function entry(uint256) external view returns (address);
// Add an entry to the index. Incresases the entry count.
function add(address) external returns (bool);
// Verify that the entry exists in the index.
// Implements ACL
function have(address) external view returns (bool);
// Retrieve the timestamp when account was added.
// If time is not being tracked, a value of 0 should be returned.
function time(address) external view returns (uint256);
}
#### Reference implementation
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
### Accounts Index Mutable
Extends the functionality of `Accounts Index` to allow changes to the
address list.
Addresses may be *added*, *removed*, aswell as *deactivated* and
*activated*. Deactivated accounts still count towards the `entryCount`.
#### ERC165 Interface identifier
9479f0ae
#### Solidity interface definition
interface IAccountsIndexMutable {
// Active status of address changed, and by whom changed.
event AddressActive(address indexed _account, bool _active);
// Address removed from store, and by whom removed.
event AddressRemoved(address _account);
// Remove an entry from the index. Reduces the entry count.
function remove(address) external returns (bool);
// Deactivate account but keep in index. Does not affect entry count.
function deactivate(address) external returns (bool);
// Activate previously deactivated account. Does not affect entry count.
function activate(address) external returns (bool);
// Check if account exists and is active;
function isActive(address) external view returns (bool);
}
#### Reference implementation
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
### Burner
Attached to `ERC20` and `ERC721` tokens that may be *burned*.
Implements the `burn(...)` part of `ERC5679` for interoperability.
#### ERC165 Interface identifier
b1110c1b
#### Solidity interface definition
interface IBurner {
// Token(s) successfully burned; by who and how much.
event Burn(address indexed _burner, uint256 _burned);
// Satisfies ERC 5679
function burn(address _from, uint256 _amount, bytes calldata _data) external;
// Burn given amount of tokens held by signer.
function burn(uint256 _amount) external returns (bool);
// Burn all tokens held by signer.
// Returns the amount of tokens burned.
function burn() external returns (uint256);
// Total amount of tokens that have been burned.
function totalBurned() external returns (uint256);
// Total amount of tokens ever minted.
// If totalSupply() is available (ERC20, ERC721 Enumerable), this equals totalSupply() + totalBurned().
function totalMinted() external returns (uint256);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Chrono
Define a creation time for a resource.
Complements `ERC5007`.
#### ERC165 Interface identifier
4db1ccd4
#### Solidity interface definition
interface IChrono {
// Returns the timestamp of when a resource corresponding to _idx was first created.
// int64 chosen as return value for simpler interoperability with ERC5007.
function createTime(uint256 _idx) external returns(int64);
}
#### Example implementation
<https://git.defalsify.org/eth-erc721> (BadgeToken contract)
### Declarator
Permissionless store of signed claims made by an address about other
addresses, or addresses about themselves.
It is used to declare or respond to certifications of vouchers, NFT,
voucher members.
Addresses may be Externally Owned Accounts or smart contracts.
Claims may be made with or without topics. A missing topic is synonymous
with a topic value of `bytes32(0x00)`.
Any number of claims can be made about an address under any number of
topics. All claims must be stored, and returned in the order which they
were added.
#### ERC165 Interface identifier
21b7493b
#### Solidity interface definition
interface IDeclarator {
event DeclarationAdded(address indexed _declarator, address indexed _subject, bytes32 indexed _topic, bytes32 _proof);
// Get all declarations for a subject (without topic) signed by a declarator
function declaration(address _declarator, address _subject) external view returns ( bytes32[] memory );
// Get all declarations for a subject for the given topic signed by a declarator
function declaration(address _declarator, address _subject, bytes32 _topic) external view returns ( bytes32[] memory );
// Get number of declarations the declarator has ever signed
function declarationCount(address _declarator) external view returns ( uint256 );
// Get the subject of a declarator's declarations at the specific index
function declarationAddressAt(address _declarator, uint256 _idx) external view returns ( address );
// Add a declaration for the subject
function addDeclaration(address _subject, bytes32 _proof) external returns ( bool );
// Add a declaration with topic for the subject
function addDeclaration(address _subject, bytes32 _proof, bytes32 _topic) external returns ( bool );
// Get the declarator that signed a declaration at the specificed index for a subject
function declaratorAddressAt(address _subject, uint256 _idx) external view returns ( address );
// Get the number of declarators that have signed for a subject
function declaratorCount(address _subject) external view returns ( uint256 );
}
#### Reference implementation
<git://holbrook.no/eth-address-index.git>
### Digest
Allows encoding of digests according to a specific encoding scheme.
Primary use-case is the abstraction of self-describing
[Multhash](https://multiformats.io/multihash/) encoding.
A default encoding *must* always be defined, and the encoding of a valid
digest *must* succeed with the default encoding.
#### ERC165 Interface identifier
982ab05d
#### Solidity interface definition
interface IDigest {
// Returns the default digest encoding used by the contract instance.
function defaultDigestEncoding() external view returns (uint256 _encoding);
// Check if the given encoding has been implemented in the contract instance.
function haveDigestEncoding(uint256 _codec) external view returns(bool);
// Verify and encode the given digest for a specific hashing algorithm.
// Returns a zero-length byte array if digest is invalid.
// Must succeed if called with the defaultDigestEncoding and a valid digest.
function encodeDigest(bytes memory _data, uint256 _encoding) external view returns (bytes memory);
// Encodes the digest using the default digest encoding.
// Returns a zero-length byte array if digest is invalid.
// Must succeed with a valid digest.
function encodeDigest(bytes memory _data) external view returns (bytes memory);
}
#### Example implementation
<git://holbrook.no/eth-event-msg.git>
### Expire
Defines an expiry time after which token balances and supply *cannot
change*.
A contract defining an expiry *must not* allow changing the expiration
time to a time in the past.
#### ERC165 Interface identifier
841a0e94
#### Solidity interface definition
interface IExpire {
// Contract has expired.
event Expired(uint256 _timestamp);
// Expiry time has changed.
event ExpiryChange(uint256 indexed _oldTimestamp, uint256 _newTimestamp);
// The current expiration timestamp.
function expires() external returns (uint256);
// Check expiry and apply expiration if expired.
// Return values must be:
// 0: not yet expired.
// 1: already expired.
// >1: expiry executed.
function applyExpiry() external returns(uint8);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Faucet
Used for dispensing tokens to any address.
It can be used for gas tokens and *ERC20* alike.
The interface is the same whether the faucet is dispensing from existing
balance or minting new tokens.
The value dispersed *must* be the same for all addresses.
In general, four criteria are expected to exist in any combination for
limiting access to the faucet:
Time
A recipient may only use the faucet again after some time has passed.
Balance threshold
A recipient may only use the faucet after its balance is below a certain
amount.
Membership
A recipient may only use the faucet if it has been added to an access
control list.
Capacity
The contract has sufficient token funds to dispense the current defined
amount to dispense.
The *check(address)* contract call *must* evaluate all four criteria,
and *must* return `false` if any of the criteria are not met.
#### ERC165 Interface identifier
1a3ac634
#### Solidity interface definition
interface IFaucet {
// Tokens were given to an address
event Give(address indexed _recipient, address indexed _token, uint256 _value);
// The amount that the faucet disperses has changed
event FaucetAmountChange(uint256 _value);
// Address of token the faucet represents
// The faucet will return gas tokens with the zero-address is returned.
function token() external returns (address);
// Amount of tokens the faucet gives out
function tokenAmount() external returns (uint256);
// Give tokens to the given recipient. Returns amount of tokens given.
function giveTo(address _recipient) external returns (uint256);
// Give tokens to yourself. Returns amount of tokens given.
function gimme() external returns (uint256);
// Check if faucet may be used in the current contract state by _recipient
function check(address _recipient) external view returns (bool);
// Returns timestamp when faucet may be used again by _recipient
// If 0 is returned, the address has not yet been used.
// A return value of max(uint256) indicates that the faucet may not be used again.
function nextTime(address _recipient) external returns (uint256);
// Returns the token balance under which faucet may be used again by _recipient
// A return value of max(uint256) indicates that the faucet may be used regardless
// of the token balance of _recipient
function nextBalance(address _recipient) external returns (uint256);
}
#### Reference implementations
- <git://holbrook.no/erc20-faucet.git>
- <git://holbrook.no/eth-faucet.git>
### Locator
This interface supports `ERC721 Metadata`, in particular the
`tokenURI(uint256)` call.
Off-chain resources in the CIC network *must* be defined in terms of
content addressed strings.
It *must* be possible to refer to all off-chain resources directly by
the content address.
Furthermore, it *should* be possible to refer to a resource by a
fully-qualified location on the web or an overlay network (e.g. tor).
#### ERC165 Interface identifier
ed75b333
#### Solidity interface definition
interface ILocator {
// URI that may or may not point to a specific resource location.
function toURI(bytes memory _data) external view returns (string memory);
// URL pointing to a specific resource location.
function toURL(bytes memory _data) external view returns(string memory);
}
#### Example implementation
<git://holbrook.no/eth-event-msg.git>
#### Expressing locators in terms of numeric token id
Given the numeric token id `1234567890987654321` (`0x112210f4b16c1cb1`
hex), and a base url `https://contentgateway.grassecon.net`, the result
of the methods may be as follows:
`toURI(toHex(1234567890987654321))`
-\>
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
`toURL(toHex(1234567890987654321))`
-\>
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
`tokenURI(1234567890987654321)`
-\>
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
#### Expressing locators in terms of a digest
Given the data `foo`, the digest algorithm `sha256` and a base url
`https://contentgateway.grassecon.net`, the result of the methods may be
as follows:
`toURI(sha256(foo))`
-\>
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
`toURL(sha256(foo))`
-\>
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
`tokenURI(toUint(sha256(foo)))`
-\>
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
#### Locator without URL
Given the data `foo`, the digest algorithm `sha256` and no base url, the
result of the methods may be as follows:
`toURI(sha256(foo))`
-\>
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
`toURL(sha256(foo))`
-\> `""`
`tokenURI(toUint(sha256(foo)))`
-\>
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
### Minter
Attached to `ERC20` and `ERC721` tokens that may be minted.
Implements the `mint(...)` and `safeMint(...)` parts of `ERC5679` for
interoperability.
#### ERC165 Interface identifier
5878bcf4
#### Solidity interface definition
interface IMinter {
// Tokens are successfully minted; by who, to whom and how much
event Mint(address indexed _minter, address indexed _beneficiary, uint256 value);
// The given token has been successfully minted; by who, to whom and how much
event Mint(address indexed _minter, address indexed _beneficiary, address indexed _token, uint256 value);
// Mint the specified value of tokens to the specified recipient
function mintTo(address _beneficiary, uint256 value) external returns (bool);
// Satisfies ERC5679 for ERC20
function mint(address _beneficiary, uint256 value, bytes calldata _data) external;
// Satisfies ERC5679 for ERC721
function safeMint(address _beneficiary, uint256 value, bytes calldata _data) external;
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Msg
Enables a reference "message" to describe the contract using an
off-chain resource.
The reference may or may not be mutable.
The interface complements `Locator` and `MultiHash` to generate locators
for how to resolve the reference.
#### ERC165 Interface identifier
a3002595
#### Solidity interface definition
interface IMsg {
// Emitted when a new message digest has been set
// Should not be emitted if the digest set is identical to the previous
event Msg(bytes _msgDigest);
// Get the current message content hash
function getMsg() external view returns(bytes memory);
}
#### Example implementation
<git://holbrook.no/eth-event-msg.git>
### Registry
The Registry interface is a key-value store resolving well-known
contract identifier names to contract addresses.
It currently has two distinct uses in the CIC context:
1. Entry-point to discover all relevant contracts of CIC networks.
2. Unique (ERC20) token symbol resolver.
#### ERC165 Interface identifier
effbf671
#### Solidity interface definition
interface IRegistryClient {
// Address added to store with the given key
event AddressKey(bytes32 indexed _key, address _address);
// Return the address of the contract identified by the given byte string
function addressOf(bytes32) external view returns (address);
// Indexed accessor for the full list of registred identifiers
function identifier(uint256) external view returns (bytes32);
// Number of registered interfaces
function identifierCount() external view returns (uint256);
}
#### Contract registry implementation
<git://holbrook.no/eth-contract-registry.git>
#### Token index implementation
<git://holbrook.no/eth-contract-registry.git>
### Seal
Some smart contract parameters may need to be mutable over part of a
smart contracts lifetime.
This interface provides a method to explicitly signal when certain
parameters have been rendered immutable.
The value of `sealState()` *must not* decrease, and must not exceed
`maxSealState`.
`maxSealState` is used to define that *all mutable parameters* have been
rendered immutable. The practical implications of this will vary between
contracts.
The implementer is encouraged to use simple, descriptive names in the
source code to describe the applicable seal states.
Use cases of sealing include:
- Whether more tokens can be minted
- Allow ownership of a contract to be transferred
- The expiry time of a token (see `Expire`)
#### ERC165 Interface identifier
0d7491f8
#### Solidity interface definition
interface ISeal {
// Seal state has changed.
event SealStateChange(bool indexed _final, uint256 _sealState);
// The current seal state.
function sealState() external view returns(uint256);
// The numeric seal state in everything sealable has been sealed.
function maxSealState() external view returns(uint256);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Throttle
An backend contract to limit access to a resource by time.
The smart contract managing the resource calls `have(address)` on this
contract to check if it can be made use of at the current point in time.
This also implements [ACL](#acl).
When the resource is made use of, it calls `poke(address)` method to
register when it has been made use of.
The `next(address)` method returns the timestamp from which the resource
may be used again by the given address. The implementer is permitted to
change the value at any time.
#### ERC165 Interface identifier
242824a9
#### Solidity interface definition
interface IThrottle {
// Returns true if the given address is authorized to make use of the resource at the current moment.
// Implements ACL
function have(address _address) external view returns(bool);
// Returns the timestamp when the resource may next be used by the given address.
// A return value of 0 or a timestamp before the current timestamp indicates that the resource may used momentarily.
// A return value of max uint265 can be used to indicate that the resource may never be used again by the address.
function next(address _address) external returns(bool);
// Must be called when the resource is being used.
function poke(address _address) external returns(bool);
}
#### Reference implementation
<git://holbrook.no/eth-faucet.git> (PeriodSimple contract)
### TokenLimit
Define limits of value amounts of tokens that individual addresses can
hold.
Limits are inclusive; a limit for 42 means transfer resulting in a token
balance *higher* than 42 should be rejected.
A return value of 0 indicates that the token is categorically not
accepted by the holder.
#### ERC165 Interface identifier
23778613
#### Solidity interface definition
interface ITokenLimit {
// Returns limit of total value a holder will accept of a specific token.
// The value limit returned is inclusive; A limit of 42 means any operation resulting in a balance OVER 42 should be rejected.
// A value of 0 means that no value of the token is accepted.
function limitOf(address _token, address _holder) external view returns(uint256);
}
#### Reference implementations
- <git://holbrook.no/erc20-limiter.git>
### TokenQuote
Quote an output token value for a given value of input tokens.
Both input and output value is denominated in the smallest available
unit of respective tokens.
#### ERC165 Interface identifier
dbb21d40
#### Solidity interface definition
interface ITokenQuote {
// Returns, within a current context, what value of outTokens the given value of inTokens translates to.
// The values are given in smallest unit of each respective token.
function valueFor(address _outToken, address _inToken, uint256 value) external view returns (uint256);
}
#### Example implementation
- <git://holbrook.no/erc20-limiter.git>
### TokenRateChange
Enables detection of properties for CIC tokens that change value over
time, e.g. through demurrage.
It allows defining the granularity of the rate of change, aswell as a
frequency for which the rate of change is applied.
A method for canonical value change calculations is also provided.
#### ERC165 Interface identifier
b716af03
#### Solidity interface definition
interface ITokenChangeRate {
// Time unit resolution for rate of change.
// A value of 0 indicates no rate of change,
function changeTimeUnit() external view returns(uint256);
// Rate of change per changeTimeUnit(), signed integer.
// An effective value of 0 indicates no rate of change.
function changeRate() external view returns (int256);
// Number of decimals with which the changeRate is defined.
// changeRate() should be divided by 10 ** changeRateDecimals() to obtain effective value
function changeRateDecimals() external view returns(uint8);
// Timestamp from when rate of change should be applied.
// A value of 0 indicates no rate of change,
function changeStartTime() external view returns(uint256);
// Calculate value with change rate applied for given amount of time units.
// Will calculate compounded change over the given amount of time units
function applyChange(int256 _value, uint256 _changeTimeUnits) external view returns(int256);
}
#### Reference implementations
- <git://holbrook.no/erc20-demurrage-token.git>
### TokenSwap
Token swap interface that can fit token escrow purposes aswell as token
swap contracts.
Optionally may define a `defaultToken`, that may among other things be
used for `withdraw()` calls without an `inToken`.
An explicit *ERC20 approval* of the balance to be transacted will
usually be required for the implementing contract.
If the value 0 is passed as argument to `deposit` or `withdraw`,
implementers can choose one of two possible outcomes:
- Noop. 0 *must* be returned.
- Use *balance* or the max available *allowance*. The actual (spent)
value *must* be returned.
#### ERC165 Interface identifier
4146b765
#### Solidity interface definition
interface ITokenSwap {
// Emitted when a new deposit has been made.
event Deposit(address indexed _token, uint256 _value);
// Default token used to access the token swap.
// Returns zero-address if no default token is defined.
function defaultToken() external returns (address);
// Add inToken liquidity to the tune of given value.
// Requires token approval for the corresponding value.
// If value is 0, up to the full approval MAY be used for the transfer.
function deposit(address _inToken, uint256 _value) external returns (uint256);
// Withdraw pending outToken balance of given value in the pool for the sender.
// May require token approval for defaultToken if used by contract as exchange for the withdrawal.
// If value is 0, up to the full approval value MAY be used for the transfer.
function withdraw(address _outToken, uint256 _value) external returns (uint256);
// Exchange inToken equalling given value for outToken.
// Requires token approval for the value of inToken.
// If value is 0, up to the full approval value MAY be used for the transfer.
function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256);
}
#### Reference implementations
- <git://holbrook.no/erc20-pool.git>
#### Handling deposits
The implementation is free to decide whether deposits can be recovered
directly, or if they will be locked in the smart contract - temporarily
or permanently.
For the duration deposits are locked, they are part of the smart
contracts swap liquidity. During this time, locked deposits may only be
withdrawn in exchange for other tokens accepted by the contract.
Deposits that are not locked should be withdrawable using the
`withdraw(address,uint256)` (`0xf3fef3a3`) method signature.
Of course, as with most swap contracts, the tokens available for
withdrawal by the holder may not necessarily match the tokens that were
deposited by the holder.
### TokenVote
Execute elections with granular ERC20 token votes.
A proposal submitted for vote may or may not contain multiple options.
If multiple options are available, an ERC20 token holder may distribute
its vote among the options with the granularity of the token balance.
Voted tokens **SHOULD** be locked until the voting has finalized.
Finalization of voting should be callable by anyone.
#### ERC165 Interface identifier
f2e0bfeb
#### Solidity interface definition
interface ITokenVote {
// A new proposal has been created.
event ProposalAdded(uint256 indexed _blockDeadline, uint256 indexed voteTargetPpm, uint256 indexed _proposalIdx);
// A proposal vote has been completed.
// The proposal is identified by the serial number in _proposalIdx. It is up to the implementer to define how the proposal should be retrieved by index.
// The proposal result may be in one of three states:
// * Ratified (_cancelled == false, _insufficient == false)
// * Cancelled (_cancelled == true, _insufficient == false)
// * Not reached quorum (_cancelled == false, _insufficient == true)
event ProposalCompleted(uint256 indexed _proposalIdx, bool indexed _cancelled, bool indexed _insufficient, uint256 _totalVote);
// Propose a new vote.
// Voting is active until one of:
// * total cancel vote reach quorum (_targetVotePpm, ppm = parts-per-million).
// * _blockWait blocks from now.
function propose(bytes32 _description, uint256 _blockWait, uint24 _targetVotePpm) external returns (uint256);
// Add a voting option to a proposal
function addOption(uint256 _proposalIdx, bytes32 _description) external;
// Get number of options available for the proposal.
// This decides the boundary of the index that can be used with voteOptions(...)
// If the result is 0, vote(...) can be used aswell.
function optionCount(uint256 _proposalIdx) external view returns(uint256);
// Get proposal option. Assumes that proposal was created with proposeMulti(...)
function getOption(uint256 _proposalIdx, uint256 _optionIdx) external view returns (bytes32);
// Get vote count for the given option.
// If proposal has no options, it should be called with _optionIdx = 0
function voteCount(uint256 _proposalIdx, uint256 _optionIdx) external view returns(uint256);
// Vote on a proposal without options.
// Assumes that proposal was created with propose(...) and will fail otherwise.
function vote(uint256 _value) external returns (bool);
// Vote on a proposal option. Assumes that proposal was created with proposeMulti(...).
// Must work with a non-option proposal if _optionIndex is 0.
function voteOption(uint256 _optionIndex, uint256 _value) external returns (bool);
// Vote to cancel a proposal.
// If cancel has the majority:
// * A vote without options will have rejected the proposal description.
// * A vote with options will have rejected the proposal description as well as all option descriptions.
function voteCancel(uint256 _value) external returns (bool);
// Finalize the vote for a proposal.
// May be called if deadline has been passed, or if:
// * quorum has been reached with cancel votes.
// * quorum has been reached and proposal has no/only one option.
function finalize() external returns (bool);
}
#### Reference implementations
- <git://holbrook.no/evm-tokenvote.git>
### Writer
A complement to ERC173, which allows definition of a class of
super-users for a contract.
A super-user address may perform *more* actions than a "normal" address,
aswell as *some* actions normally limited to the *contract owner*.
If an *contract owner* is defined, No super-user should be able to
perform actions that *contract owner* cannot perform.
Typically, only the *contract owner*, if it is defined, can add or
remove a super-user.
Some use-case examples of super-user actions include:
- Mint new tokens.
- Change the amount dispensed by the faucet.
- Edit access control lists.
#### ERC165 Interface identifier
abe1f1f5
#### Solidity interface definition
interface IWriter {
// A writer has been added by _executor
event WriterAdded(address _writer);
// A writer has been removed by _executor
event WriterDeleted(address _writer);
// Add a new writer to the contract.
function addWriter(address _writer) external returns (bool);
// Remove existing writer from the contract.
function deleteWriter(address _writer) external returns (bool);
// Check whether the given address is a writer.
function isWriter(address _writer) external view returns (bool);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>

17
Registry.sol Normal file
View File

@ -0,0 +1,17 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface Registry {
function owner() external view returns (address);
function identifiers() external view returns (bytes32[] memory);
function chainOf(bytes32 _identifier) external view returns (bytes32);
function configSumOf(bytes32 _chain) external view returns (bytes32);
function set (bytes32 _identifier, address _address, bytes32 _chainDescriptor, bytes32 _chainConfig) external returns (bool);
function seal() external returns (bool);
// TODO: extend RegistryClient, but flatten files
function addressOf(bytes32) external view returns (address);
}

12
RegistryClient.sol Normal file
View File

@ -0,0 +1,12 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
interface RegistryClient {
function registryCount() external view returns (uint256);
function addressOf(bytes32) external view returns (address);
function entry(uint256) external view returns (address);
}

13
RegistryStandard.sol Normal file
View File

@ -0,0 +1,13 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface RegistryStandard {
function registryCount() external view returns (uint256);
function addressOf(bytes32) external view returns (address);
function register(bytes32,address) external view returns (bool);
function entry(uint256) external view returns (address);
}

3
RegistryStandard.txt Normal file
View File

@ -0,0 +1,3 @@
registryCount()
addressOf(bytes32)
register(bytes32,address)

3
TokenEndorsement.sol Normal file
View File

@ -0,0 +1,3 @@
interface TokenEndorser {
function getBySymbol(address _tokenAddress) external view returns ( bytes32 );
}

18
TokenRegistry.sol Normal file
View File

@ -0,0 +1,18 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
// TODO: Rename everything to something more generic
interface TokenEndorser {
function endorsement(bytes32) external view returns ( bytes32 );
function tokenIndex(address) external view returns ( uint256 );
function endorser(address, uint256) external view returns ( uint256 );
function endorserTokenCount(address) external view returns ( uint256 );
function tokenSymbolIndex(string memory) external view returns ( address );
function tokens(uint256) external view returns ( address );
function add(address _token, bytes32 _data) external returns ( bool );
}

18
TokenRegistryClient.sol Normal file
View File

@ -0,0 +1,18 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
// TODO: Rename everything to something more generic
interface TokenEndorser {
function endorsement(bytes32) external view returns ( bytes32 );
function tokenIndex(address) external view returns ( uint256 );
function endorser(address, uint256) external view returns ( uint256 );
function endorserTokenCount(address) external view returns ( uint256 );
function tokenSymbolIndex(string memory) external view returns ( address );
function tokens(uint256) external view returns ( address );
function add(address _token, bytes32 _data) external returns ( bool );
}

48
TransferAuthorization.sol Normal file
View File

@ -0,0 +1,48 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
interface TransferAuthorization {
event NewRequest(address indexed _sender, address indexed _recipient, address indexed _token, uint256 _value, uint256 _serial);
event Executed(uint256 _serial);
event TransferFail(uint256 _serial);
event QuorumSet(uint256 _quorum, uint256 _vetoThreshold, uint256 _signerCount);
event SignerAdded(address _signer);
event SignerRemoved(address _signer);
event Vetoed(uint256 indexed _serial, uint256 _yays, uint256 _nays);
event Approved(uint256 indexed _serial, uint256 _yays, uint256 _nays);
event Rejected(uint256 indexed _serial, uint256 _yays, uint256 _nays);
struct Transaction {
uint256 serial;
address sender;
address recipient;
address token;
uint256 value;
uint256 yay;
uint256 nay;
uint256 blockNumber;
int8 result; // -1 rejected/vetoed, 0 = completed, 1 = voting, 2 = approved
}
function signers(address) external view returns (bool);
function vote(uint256, address) external view returns (int8);
function voters(uint256) external view returns (address);
function count() external view returns (uint256);
function quorum() external view returns (uint256);
function vetoThreshold() external view returns (uint256);
function signerCount() external view returns (uint256);
function lastSerial() external view returns (uint256);
function nextSerial() external view returns (uint256);
function getSerialAt(uint256 _idx) external view returns (uint256);
function requests(uint256 _serial) external view returns (Transaction memory);
function requestSenderIndex(address _sender, uint256 _idx) external view returns (uint256);
function requestRecipientIndex(address _recipient, uint256 _idx) external view returns (uint256);
function createRequest(address _sender, address _recipient, address _token, uint256 _value) external returns (uint256);
function yay(uint256 _serial) external returns (bool);
function nay(uint256 _serial) external returns (bool);
}

View File

@ -1 +1 @@
0.2.0
0.0.2

View File

@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AccountAdded","type":"event"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"accounts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"accountsIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32","name":"_proof","type":"bytes32"}],"name":"addDeclaration","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_subjectAddress","type":"address"},{"internalType":"address","name":"_objectAddress","type":"address"}],"name":"declaration","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subjectAddress","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declarationAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subjectAddress","type":"address"}],"name":"declarationCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_targetAddress","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declaratorAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_objectAddress","type":"address"}],"name":"declaratorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

1
abis/Converter.json Normal file
View File

@ -0,0 +1 @@
[{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reserveToken","type":"address"}],"name":"reserveBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveRatio","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveTokenCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reserveToken","type":"address"}],"name":"reserveWeight","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_conversionFee","type":"uint32"}],"name":"setConversionFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"address[]","name":"_anchors","type":"address[]"}],"name":"getConvertersByAnchors","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConvertibleTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_type","type":"uint16"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint32","name":"_maxConversionFee","type":"uint32"},{"internalType":"address[]","name":"_reserveTokens","type":"address[]"},{"internalType":"uint32[]","name":"_reserveWeights","type":"uint32[]"}],"name":"newConverter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}]

1
abis/Declarator.json Normal file
View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32","name":"_proof","type":"bytes32"}],"name":"addDeclaration","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_subjectAddress","type":"address"},{"internalType":"address","name":"_objectAddress","type":"address"}],"name":"declaration","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subjectAddress","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declarationAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subjectAddress","type":"address"}],"name":"declarationCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_targetAddress","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declaratorAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_objectAddress","type":"address"}],"name":"declaratorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

1
abis/ERC20.json Normal file
View File

@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

1
abis/Faucet.json Normal file
View File

@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"inputs":[],"name":"amount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

1
abis/Minter.json Normal file
View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

1
abis/Network.json Normal file
View File

@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_smartToken","type":"address"},{"indexed":true,"internalType":"address","name":"_fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"_toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_trader","type":"address"}],"name":"Conversion","type":"event"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minReturn","type":"uint256"}],"name":"convert","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rateByPath","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

1
abis/Registry.json Normal file
View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"}],"name":"chainOf","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_chain","type":"bytes32"}],"name":"configSumOf","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"identifiers","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"seal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32","name":"_chainDescriptor","type":"bytes32"},{"internalType":"bytes32","name":"_chainConfig","type":"bytes32"}],"name":"set","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

1
abis/RegistryClient.json Normal file
View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"getBySymbol","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]

1
abis/TokenRegistry.json Normal file
View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"endorsement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"endorser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"endorserTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"tokenSymbolIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

View File

@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"endorsement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"endorser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"endorserTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"tokenSymbolIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

File diff suppressed because one or more lines are too long

16
calculate_erc165.py Normal file
View File

@ -0,0 +1,16 @@
import sys
import web3
f = open(sys.argv[1], 'r')
z = b''
for i in range(32):
z += b'\x00'
while True:
l = f.readline()
if l == '':
break
print('line {}'.format(l))
h = web3.Web3.keccak(text=l)
z = bytes([a ^ b for a, b in zip(h, z)])
print(h.hex(), z.hex())
f.close()

View File

View File

@ -1,41 +0,0 @@
# standard imports
import json
import sys
# external imports
import sha3
def main():
f = open(sys.argv[1], 'r')
o = json.load(f)
f.close()
ks = []
r = {}
for v in o:
if v['type'] != "function":
continue
name = ''
try:
name = v['name']
except KeyError:
continue
args = []
for vv in v['inputs']:
args.append(vv['type'])
sig = '{}({})'.format(name, ','.join(args))
h = sha3.keccak_256()
h.update(sig.encode('utf-8'))
z = h.digest()
k = z[:4].hex()
#ks.append(k)
r[k] = sig
ks = list(r.keys())
ks.sort()
for k in ks:
print("{}\t{}".format(k, r[k]))
if __name__ == '__main__':
main()

View File

@ -1,34 +0,0 @@
# standard imports
import logging
import sys
# external imports
import sha3
logging.basicConfig(level=logging.WARNING)
#logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
def main():
if __name__ == '__main__':
f = open(sys.argv[1], 'r')
z = b''
for i in range(32):
z += b'\x00'
while True:
l = f.readline().rstrip()
if l == '':
break
logg.debug('line {}'.format(l))
h = sha3.keccak_256()
h.update(l.encode('utf-8'))
r = h.digest()
z = bytes([a ^ b for a, b in zip(r, z)])
logg.debug('{} -> {}'.format(r.hex(), z.hex()))
f.close()
print(z[:4].hex())
if __name__ == '__main__':
main()

View File

@ -1,16 +0,0 @@
# standard imports
import sys
import json
def main():
merged = []
for a in sys.argv[1:]:
f = open(a, 'r')
j = json.load(f)
f.close()
merged += j
print(json.dumps(merged))
if __name__ == '__main__':
main()

View File

@ -1,136 +0,0 @@
import sys
import logging
import ply.lex as lex
logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger()
tokens = (
'NUMBER',
# 'PLUS',
# 'MINUS',
# 'TIMES',
# 'DIVIDE',
'LPAREN',
'RPAREN',
)
methods = {}
contract = False
method = None
typ = None
function = False
signature = False
# Define a rule so we can track line numbers
def t_newline(t):
r'\n+'
t.lexer.lineno += len(t.value)
def t_comment(t):
r'//.+'
pass
def t_item(t):
r';'
global function, signature, method, typ
signature = False
function = False
method = None
typ = None
def t_contract(t):
r'(interface|contract).+\{'
global contract
if contract:
raise SyntaxError('this meagre parser will only handle one interface/contract definition per file')
contract = True
def t_pragma(t):
r'pragma.+'
pass
def t_function(t):
r'function'
global function, contract
if not contract:
raise SyntaxError('functions must be within inteface/contract definitions')
function = True
def t_LPAREN(t):
r'\('
global function, signature
if not function:
return
signature = True
def t_RPAREN(t):
r'\)'
global signature
signature = None
def t_WORD(t):
r'([\w\d]+)'
global method, typ, signature
if typ and not signature:
return
if function and method == None:
method = t.value
methods[method] = []
elif typ == None and signature:
typ = t.value
methods[method].append(typ)
def t_COMMA(t):
r','
global typ
typ = None
# Error handling rule
def t_error(t):
print("Illegal character '%s'" % t.value[0])
t.lexer.skip(1)
# A string containing ignored characters (spaces and tabs)
t_ignore = ' \t}'
def main():
# Build the lexer
lexer = lex.lex()
# Tokenize
f = open(sys.argv[1], 'r')
while True:
l = f.readline()
if not l:
break
lexer.input(l)
tok = lexer.token()
logg.debug('token {}'.format(tok))
for k in methods.keys():
print('{}({})'.format(k, ','.join(methods[k])))
if __name__ == '__main__':
main()

47
contracts_overview.txt Normal file
View File

@ -0,0 +1,47 @@
Contract interfaces overview
AccountRegistry
* interface:
* append-only list of custodial addresses
* only writers may add addresses
* only owner may add and remove writers
AddressDeclarator
* interface:
* enables addresses to link one or more 32 byte entries to another address
* used for:
- kyc proofs to user account addresses
- token metadata (eg. tokenlists.org std), endorsements, warnings
* freely writable
Faucet
* interface:
* allows transfer of an amount of one particular token to a given address
* transfer amount can be changed at any time. invocation will used the transfer amount set at the time.
* anyone can invoke the function for anyone
* implements a function to provide cooldown info, max(uint256) means cooldown disabled (one-shot only)
Token Symbol Registry
* interface:
* simple key-value store to enforce unique token symbols
* only owner can write
* will check that token symbol reported by ERC20 interface matches provided key (case sensitive)
Transfer Approvals
* interface:
* counter-signing of transfers from custodial addresses invoked by third-party (staff)
* custodial address must create an allowance for contract
* only "approvers" may reject/execute transfers
* provides lists of open requests

View File

@ -1,5 +1,3 @@
all:
makeinfo --html index.texi
readme:
makeinfo --docbook --no-split -o build/docbook.xml index.texi

View File

@ -1,42 +0,0 @@
@subsection Accounts Index
Append-only list of addresses. Typically used for access control lists.
Addresses may be @emph{added}, @emph{removed}, aswell as @emph{deactivated} and @emph{activated}. Deactivated accounts still count towards the @code{entryCount}.
The @code{entry} method is used to iterate the account list. The order of which accounts are returned is not guaranteed. Any returned value matching @code{address(0x00)} should be skipped, and not counted towards @code{entryCount}.
May optionally record time when account was added.
@subsubsection ERC165 Interface identifier
@include ../../build/AccountsIndex.interface
@subsubsection Solidity interface definition
@include ../../build/contract_AccountsIndex.texi
@subsubsection Reference implementation
@uref{git://holbrook.no/eth-accounts-index.git,} (v0.5.1)
@subsection Accounts Index Mutable
Extends the functionality of @code{Accounts Index} to allow changes to the address list.
Addresses may be @emph{added}, @emph{removed}, aswell as @emph{deactivated} and @emph{activated}. Deactivated accounts still count towards the @code{entryCount}.
@subsubsection ERC165 Interface identifier
@include ../../build/AccountsIndexMutable.interface
@subsubsection Solidity interface definition
@include ../../build/contract_AccountsIndexMutable.texi
@subsubsection Reference implementation
@uref{git://holbrook.no/eth-accounts-index.git,} (v0.5.1)

View File

@ -1,18 +0,0 @@
@anchor{acl}
@subsection ACL
A simple Access Control List definition that returns true of false depending on whether an signatory (address) is allowed to operate in a given context.
@subsubsection ERC165 Interface identifier
@include ../../build/ACL.interface
@subsubsection Solidity interface definition
@include ../../build/contract_ACL.texi
@subsubsection Example implementation
@uref{git://holbrook.no/eth-accounts-index.git,}

View File

@ -1,17 +0,0 @@
@subsection Burner
Attached to @code{ERC20} and @code{ERC721} tokens that may be @emph{burned}.
Implements the @code{burn(...)} part of @code{ERC5679} for interoperability.
@subsubsection ERC165 Interface identifier
@include ../../build/Burner.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Burner.texi
@subsubsection Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}

View File

@ -1,18 +0,0 @@
@subsection Chrono
Define a creation time for a resource.
Complements @code{ERC5007}.
@subsubsection ERC165 Interface identifier
@include ../../build/Chrono.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Chrono.texi
@subsubsection Example implementation
@uref{https://git.defalsify.org/eth-erc721} (BadgeToken contract)

View File

@ -1,23 +0,0 @@
@subsection Declarator
Permissionless store of signed claims made by an address about other addresses, or addresses about themselves.
It is used to declare or respond to certifications of vouchers, NFT, voucher members.
Addresses may be Externally Owned Accounts or smart contracts.
Claims may be made with or without topics. A missing topic is synonymous with a topic value of @code{bytes32(0x00)}.
Any number of claims can be made about an address under any number of topics. All claims must be stored, and returned in the order which they were added.
@subsubsection ERC165 Interface identifier
@include ../../build/Declarator.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Declarator.texi
@subsubsection Reference implementation
@uref{git://holbrook.no/eth-address-index.git,}

View File

@ -1,20 +0,0 @@
@subsection Digest
Allows encoding of digests according to a specific encoding scheme.
Primary use-case is the abstraction of self-describing @uref{https://multiformats.io/multihash/,Multhash} encoding.
A default encoding @emph{must} always be defined, and the encoding of a valid digest @emph{must} succeed with the default encoding.
@subsubsection ERC165 Interface identifier
@include ../../build/Digest.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Digest.texi
@subsubsection Example implementation
@uref{git://holbrook.no/eth-event-msg.git}

View File

@ -1,18 +0,0 @@
@subsection Expire
Defines an expiry time after which token balances and supply @emph{cannot change}.
A contract defining an expiry @emph{must not} allow changing the expiration time to a time in the past.
@subsubsection ERC165 Interface identifier
@include ../../build/Expire.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Expire.texi
@subsubsection Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}

View File

@ -1,42 +0,0 @@
@subsection Faucet
Used for dispensing tokens to any address.
It can be used for gas tokens and @emph{ERC20} alike.
The interface is the same whether the faucet is dispensing from existing balance or minting new tokens.
The value dispersed @emph{must} be the same for all addresses.
In general, four criteria are expected to exist in any combination for limiting access to the faucet:
@table @dfn
@item Time
A recipient may only use the faucet again after some time has passed.
@item Balance threshold
A recipient may only use the faucet after its balance is below a certain amount.
@item Membership
A recipient may only use the faucet if it has been added to an access control list.
@item Capacity
The contract has sufficient token funds to dispense the current defined amount to dispense.
@end table
The @emph{check(address)} contract call @emph{must} evaluate all four criteria, and @emph{must} return @code{false} if any of the criteria are not met.
@subsubsection ERC165 Interface identifier
@include ../../build/Faucet.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Faucet.texi
@subsubsection Reference implementations
@itemize
@item
@uref{git://holbrook.no/erc20-faucet.git,}
@item
@uref{git://holbrook.no/eth-faucet.git,}
@end itemize

View File

@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Smart contract interfaces (Untitled Document)</title>
@ -10,16 +10,14 @@
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="#Smart-contract-interfaces" rel="start" title="Smart contract interfaces">
<style type="text/css">
<!--
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
@ -28,7 +26,6 @@ pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
span:hover a.copiable-anchor {visibility: visible}
ul.no-bullet {list-style: none}
-->
</style>
@ -37,77 +34,45 @@ ul.no-bullet {list-style: none}
</head>
<body lang="en">
<div class="chapter" id="Smart-contract-interfaces">
<span id="Smart-contract-interfaces-1"></span><h2 class="chapter">1 Smart contract interfaces</h2>
<span id="Smart-contract-interfaces"></span><span id="Smart-contract-interfaces-1"></span><h2 class="chapter">1 Smart contract interfaces</h2>
<ul class="section-toc">
<li><a href="#Smart-Contracts-in-the-CIC-Network" accesskey="1">Smart Contracts in the CIC Network</a></li>
</ul>
<div class="section" id="Smart-Contracts-in-the-CIC-Network">
<h3 class="section">1.1 Smart Contracts in the CIC Network</h3>
<span id="Smart-Contracts-in-the-CIC-Network"></span><h3 class="section">1.1 Smart Contracts in the CIC Network</h3>
<ul class="section-toc">
<li><a href="#Technology" accesskey="1">Technology</a></li>
<li><a href="#The-registry-contract" accesskey="2">The registry contract</a></li>
<li><a href="#Auxiliary-contracts" accesskey="3">Auxiliary contracts</a></li>
<li><a href="#Contract-interfaces" accesskey="4">Contract interfaces</a></li>
</ul>
<div class="subsection" id="Technology">
<h4 class="subsection">1.1.1 Technology</h4>
<span id="Technology"></span><h4 class="subsection">1.1.1 Technology</h4>
<p>The long-term aim of the CIC network is to be agnostic of consensus engines. However, since we have to start <em>somewhere</em>, the current state of development only deals with Smart Contracts on the (Ethereum Virtual Machine (EVM).
</p>
</div>
<div class="subsection" id="The-registry-contract">
<h4 class="subsection">1.1.2 The registry contract</h4>
<span id="The-registry-contract"></span><h4 class="subsection">1.1.2 The registry contract</h4>
<p>The CICRegistry contract defines the entry-point to the entire CIC network. All other CIC network resources can be discovered through this contract.
</p>
<p>Its implementation is contained in the <samp>cic-registry</samp> repository. Details about it are documented further in that section.
</p>
</div>
<div class="subsection" id="Auxiliary-contracts">
<h4 class="subsection">1.1.3 Auxiliary contracts</h4>
<span id="Auxiliary-contracts"></span><h4 class="subsection">1.1.3 Auxiliary contracts</h4>
<p>All other Smart Contracts in the network other than CICRegistry are essentially optional, and each applies <em>at least one</em> the interfaces defined in the <code>cic-contracts</code> repository.
</p>
</div>
<div class="subsection" id="Contract-interfaces">
<h4 class="subsection">1.1.4 Contract interfaces</h4>
<span id="Contract-interfaces"></span><h4 class="subsection">1.1.4 Contract interfaces</h4>
<p>All contracts interfaces also implement the <strong>EIP165</strong> Standard Interface Detection.
</p>
<ul class="section-toc">
<li><a href="#Registry" accesskey="1">Registry</a></li>
<li><a href="#Registry-Client" accesskey="2">Registry Client</a></li>
<li><a href="#Faucet" accesskey="3">Faucet</a></li>
<li><a href="#Transfer-approval" accesskey="4">Transfer approval</a></li>
<li><a href="#Declarator" accesskey="5">Declarator</a></li>
<li><a href="#Address-Index" accesskey="6">Address Index</a></li>
<li><a href="#DEX-Index" accesskey="7">DEX Index</a></li>
</ul>
<div class="subsubsection" id="Registry">
<h4 class="subsubsection">1.1.4.1 Registry</h4>
<span id="Registry"></span><h4 class="subsubsection">1.1.4.1 Registry</h4>
<p>A key-value store, which resolves arbitrary 32-byte pointers to Ethereum addresses. Typically, this is used to resolve an address from a well-known identifier, either as a UTF-8 value or a 256-bit hash.
</p>
<p>It also provides numerical index access to all registered values in order of insertion.
</p>
</div>
<div class="subsubsection" id="Registry-Client">
<h4 class="subsubsection">1.1.4.2 Registry Client</h4>
<span id="Registry-Client"></span><h4 class="subsubsection">1.1.4.2 Registry Client</h4>
<p>A subset of the <code>Registry</code> interface, which defines only the non-transactional methods of the contract. The <code>Registry Client</code> interface is implemented by the <code>CICRegistry</code> contract.
</p>
</div>
<div class="subsubsection" id="Faucet">
<h4 class="subsubsection">1.1.4.3 Faucet</h4>
<span id="Faucet"></span><h4 class="subsubsection">1.1.4.3 Faucet</h4>
<p>Enables disbursement of a set amount of tokens to a requesting address.
</p>
@ -116,9 +81,7 @@ ul.no-bullet {list-style: none}
<p>Can be implemented as a periodic or a one-time service per account.
</p>
</div>
<div class="subsubsection" id="Transfer-approval">
<h4 class="subsubsection">1.1.4.4 Transfer approval</h4>
<span id="Transfer-approval"></span><h4 class="subsubsection">1.1.4.4 Transfer approval</h4>
<p>Enables a third-party approval to spend an ERC20 token allowance.
</p>
@ -127,9 +90,7 @@ ul.no-bullet {list-style: none}
<p>The contract allows the third-party address to either allow or reject the transfer.
</p>
</div>
<div class="subsubsection" id="Declarator">
<h4 class="subsubsection">1.1.4.5 Declarator</h4>
<span id="Declarator"></span><h4 class="subsubsection">1.1.4.5 Declarator</h4>
<p>Stores one or more 32-byte entries as a description of an Ethereum address, <em>signed</em> by another Ethereum address.
</p>
@ -140,22 +101,15 @@ ul.no-bullet {list-style: none}
<p>Entries typically are text strings or content hashes.
</p>
</div>
<div class="subsubsection" id="Address-Index">
<h4 class="subsubsection">1.1.4.6 Address Index</h4>
<span id="Address-Index"></span><h4 class="subsubsection">1.1.4.6 Address Index</h4>
<p>A simple append-only list of addresses. Used to check whether an address is part of a particular group.
</p>
</div>
<div class="subsubsection" id="DEX-Index">
<h4 class="subsubsection">1.1.4.7 DEX Index</h4>
<span id="DEX-Index"></span><h4 class="subsubsection">1.1.4.7 DEX Index</h4>
<p>Methods required to convert between tokens.
</p><hr></div>
</div>
</div>
</div>
</p><hr>

View File

@ -1,63 +0,0 @@
@subsection Locator
This interface supports @code{ERC721 Metadata}, in particular the @code{tokenURI(uint256)} call.
Off-chain resources in the CIC network @emph{must} be defined in terms of content addressed strings.
It @emph{must} be possible to refer to all off-chain resources directly by the content address.
Furthermore, it @emph{should} be possible to refer to a resource by a fully-qualified location on the web or an overlay network (e.g. tor).
@subsubsection ERC165 Interface identifier
@include ../../build/Locator.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Locator.texi
@subsubsection Example implementation
@uref{git://holbrook.no/eth-event-msg.git}
@subsubsection Expressing locators in terms of numeric token id
Given the numeric token id @code{1234567890987654321} (@code{0x112210f4b16c1cb1} hex), and a base url @code{https://contentgateway.grassecon.net}, the result of the methods may be as follows:
@table @code
@item toURI(toHex(1234567890987654321))
-> @code{https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1}
@item toURL(toHex(1234567890987654321))
-> @code{https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1}
@item tokenURI(1234567890987654321)
-> @code{https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1}
@end table
@subsubsection Expressing locators in terms of a digest
Given the data @code{foo}, the digest algorithm @code{sha256} and a base url @code{https://contentgateway.grassecon.net}, the result of the methods may be as follows:
@table @code
@item toURI(sha256(foo))
-> @code{"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@item toURL(sha256(foo))
-> @code{"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@item tokenURI(toUint(sha256(foo)))
-> @code{"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@end table
@subsubsection Locator without URL
Given the data @code{foo}, the digest algorithm @code{sha256} and no base url, the result of the methods may be as follows:
@table @code
@item toURI(sha256(foo))
-> @code{"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@item toURL(sha256(foo))
-> @code{""}
@item tokenURI(toUint(sha256(foo)))
-> @code{"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@end table

View File

@ -1,17 +0,0 @@
@subsection Minter
Attached to @code{ERC20} and @code{ERC721} tokens that may be minted.
Implements the @code{mint(...)} and @code{safeMint(...)} parts of @code{ERC5679} for interoperability.
@subsubsection ERC165 Interface identifier
@include ../../build/Minter.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Minter.texi
@subsubsection Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}

View File

@ -1,20 +0,0 @@
@subsection Msg
Enables a reference "message" to describe the contract using an off-chain resource.
The reference may or may not be mutable.
The interface complements @code{Locator} and @code{MultiHash} to generate locators for how to resolve the reference.
@subsubsection ERC165 Interface identifier
@include ../../build/Msg.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Msg.texi
@subsubsection Example implementation
@uref{git://holbrook.no/eth-event-msg.git}

View File

@ -1,59 +0,0 @@
@subsection Auxiliary contracts
All other Smart Contracts in the network other than CICRegistry are essentially optional, and each applies @emph{at least one} the interfaces defined in the @code{cic-contracts} repository.
@subsection Contract interfaces
All contracts interfaces also implement the @strong{EIP165} Standard Interface Detection.
@subsubsection Registry
A key-value store, which resolves arbitrary 32-byte pointers to Ethereum addresses. Typically, this is used to resolve an address from a well-known identifier, either as a UTF-8 value or a 256-bit hash.
It also provides numerical index access to all registered values in order of insertion.
@subsubsection Registry Client
A subset of the @code{Registry} interface, which defines only the non-transactional methods of the contract. The @code{Registry Client} interface is implemented by the @code{CICRegistry} contract.
@subsubsection Faucet
Enables disbursement of a set amount of tokens to a requesting address.
Allows privileged accounts to adjust the amount of tokens to disburse.
Can be implemented as a periodic or a one-time service per account.
@subsubsection Transfer approval
Enables a third-party approval to spend an ERC20 token allowance.
This is useful in the case of a custodial key store, where a transaction has been initiated by another entity than the owner of the key.
The contract allows the third-party address to either allow or reject the transfer.
@subsubsection Declarator
Stores one or more 32-byte entries as a description of an Ethereum address, @emph{signed} by another Ethereum address.
This can be used to @emph{describe} network resources, be it tokens, contracts or user accounts. Examples of uses are KYC documentation proofs for users, token metadata used for display, or fraud alerts.
Entries are stored by the transacting address that adds address/description pairs. In other words, any address may have different "opinions" registered about it, depending on which signing address it is queried in the context of. This, in turn, allows the quering entity to compile its own "opinion" of an address by combining data from signatures it trusts.
Entries typically are text strings or content hashes.
@subsubsection Address Index
A simple append-only list of addresses. Used to check whether an address is part of a particular group.
@subsubsection DEX Index
Methods required to convert between tokens.

View File

@ -2,90 +2,75 @@
@chapter Smart contract interfaces
@section Smart Contracts in the CIC Network
@section Technology
@subsection Technology
CIC smart contracts are implemented using the @emph{solidity} programming language for the (Ethereum Virtual Machine (EVM).
The long-term aim of the CIC network is to be agnostic of consensus engines. However, since we have to start @emph{somewhere}, the current state of development only deals with Smart Contracts on the (Ethereum Virtual Machine (EVM).
@section Adopted standards
@subsection The registry contract
@subsection Signing
The CICRegistry contract defines the entry-point to the entire CIC network. All other CIC network resources can be discovered through this contract.
Its implementation is contained in the @file{cic-registry} repository. Details about it are documented further in that section.
@subsection Auxiliary contracts
All other Smart Contracts in the network other than CICRegistry are essentially optional, and each applies @emph{at least one} the interfaces defined in the @code{cic-contracts} repository.
@subsection ERC - Direct use
@subsection Contract interfaces
The following well-known solidity interfaces are used directly.
All contracts interfaces also implement the @strong{EIP165} Standard Interface Detection.
@itemize @bullet
@item
@uref{https://eips.ethereum.org/EIPS/eip-20, ERC20 - Token Standard}
@item
@uref{https://eips.ethereum.org/EIPS/eip-165, ERC165 - Standard Interface Detection}
@item
@uref{https://eips.ethereum.org/EIPS/eip-173, ERC173 - Contract Ownership Standard}
@item
@uref{https://eips.ethereum.org/EIPS/eip-191, ERC191 - Signed Data Standard}
@item
@uref{https://eips.ethereum.org/EIPS/eip-712, ERC712 - Typed structured data hashing and signing}
@item
@uref{https://eips.ethereum.org/EIPS/eip-721, ERC721 - Non-Fungible Token Standard}
@item
@uref{https://eips.ethereum.org/EIPS/eip-5007, ERC5007 - Time NFT (EIP-721 Time Extension)}
@item
@uref{https://eips.ethereum.org/EIPS/eip-5192, ERC5192 - Minimal Soulbound NFTs}
@end itemize
@subsubsection Registry
A key-value store, which resolves arbitrary 32-byte pointers to Ethereum addresses. Typically, this is used to resolve an address from a well-known identifier, either as a UTF-8 value or a 256-bit hash.
It also provides numerical index access to all registered values in order of insertion.
@subsection ERCs Partial use
@subsubsection Registry Client
The following well-known solidity interfaces are partially implemented in CIC native interfaces.
@itemize @dfn
@item
@uref{https://eips.ethereum.org/EIPS/eip-5679, ERC5679 - Token Minting and Burning} (See @code{Minter}, @code{Burner})
@end itemize
A subset of the @code{Registry} interface, which defines only the non-transactional methods of the contract. The @code{Registry Client} interface is implemented by the @code{CICRegistry} contract.
@section Native interfaces
@subsubsection Faucet
@include acl.sol.texi
Enables disbursement of a set amount of tokens to a requesting address.
@include accountsindex.sol.texi
Allows privileged accounts to adjust the amount of tokens to disburse.
@include burner.sol.texi
Can be implemented as a periodic or a one-time service per account.
@include chrono.sol.texi
@include declarator.sol.texi
@subsubsection Transfer approval
@include digest.sol.texi
Enables a third-party approval to spend an ERC20 token allowance.
@include expire.sol.texi
This is useful in the case of a custodial key store, where a transaction has been initiated by another entity than the owner of the key.
@include faucet.sol.texi
The contract allows the third-party address to either allow or reject the transfer.
@include locator.sol.texi
@include minter.sol.texi
@subsubsection Declarator
@include msg.sol.texi
Stores one or more 32-byte entries as a description of an Ethereum address, @emph{signed} by another Ethereum address.
@include registry.sol.texi
This can be used to @emph{describe} network resources, be it tokens, contracts or user accounts. Examples of uses are KYC documentation proofs for users, token metadata used for display, or fraud alerts.
@include seal.sol.texi
Entries are stored by the transacting address that adds address/description pairs. In other words, any address may have different "opinions" registered about it, depending on which signing address it is queried in the context of. This, in turn, allows the quering entity to compile its own "opinion" of an address by combining data from signatures it trusts.
@include throttle.sol.texi
Entries typically are text strings or content hashes.
@include tokenlimit.sol.texi
@include tokenquote.sol.texi
@subsubsection Address Index
@include tokenratechange.sol.texi
A simple append-only list of addresses. Used to check whether an address is part of a particular group.
@include tokenswap.sol.texi
@include tokenvote.sol.texi
@subsubsection DEX Index
@include writer.sol.texi
Methods required to convert between tokens.

View File

@ -1,28 +0,0 @@
@subsection Registry
The Registry interface is a key-value store resolving well-known contract identifier names to contract addresses.
It currently has two distinct uses in the CIC context:
@enumerate
@item
Entry-point to discover all relevant contracts of CIC networks.
@item
Unique (ERC20) token symbol resolver.
@end enumerate
@subsubsection ERC165 Interface identifier
@include ../../build/RegistryClient.interface
@subsubsection Solidity interface definition
@include ../../build/contract_RegistryClient.texi
@subsubsection Contract registry implementation
@uref{git://holbrook.no/eth-contract-registry.git,}
@subsubsection Token index implementation
@uref{git://holbrook.no/eth-contract-registry.git,}

View File

@ -1,34 +0,0 @@
@subsection Seal
Some smart contract parameters may need to be mutable over part of a smart contract's lifetime.
This interface provides a method to explicitly signal when certain parameters have been rendered immutable.
The value of @code{sealState()} @emph{must not} decrease, and must not exceed @code{maxSealState}.
@code{maxSealState} is used to define that @emph{all mutable parameters} have been rendered immutable. The practical implications of this will vary between contracts.
The implementer is encouraged to use simple, descriptive names in the source code to describe the applicable seal states.
Use cases of sealing include:
@itemize
@item
Whether more tokens can be minted
@item
Allow ownership of a contract to be transferred
@item
The expiry time of a token (see @code{Expire})
@end itemize
@subsubsection ERC165 Interface identifier
@include ../../build/Seal.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Seal.texi
@subsubsection Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}

View File

@ -1,22 +0,0 @@
@subsection Throttle
An backend contract to limit access to a resource by time.
The smart contract managing the resource calls @code{have(address)} on this contract to check if it can be made use of at the current point in time. This also implements @ref{acl, ACL}.
When the resource is made use of, it calls @code{poke(address)} method to register when it has been made use of.
The @code{next(address)} method returns the timestamp from which the resource may be used again by the given address. The implementer is permitted to change the value at any time.
@subsubsection ERC165 Interface identifier
@include ../../build/Throttle.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Throttle.texi
@subsubsection Reference implementation
@uref{git://holbrook.no/eth-faucet.git,} (PeriodSimple contract)

View File

@ -1,22 +0,0 @@
@subsection TokenLimit
Define limits of value amounts of tokens that individual addresses can hold.
Limits are inclusive; a limit for 42 means transfer resulting in a token balance @emph{higher} than 42 should be rejected.
A return value of 0 indicates that the token is categorically not accepted by the holder.
@subsubsection ERC165 Interface identifier
@include ../../build/TokenLimit.interface
@subsubsection Solidity interface definition
@include ../../build/contract_TokenLimit.texi
@subsubsection Reference implementations
@itemize
@item
@uref{git://holbrook.no/erc20-limiter.git,}
@end itemize

View File

@ -1,20 +0,0 @@
@subsection TokenQuote
Quote an output token value for a given value of input tokens.
Both input and output value is denominated in the smallest available unit of respective tokens.
@subsubsection ERC165 Interface identifier
@include ../../build/TokenQuote.interface
@subsubsection Solidity interface definition
@include ../../build/contract_TokenQuote.texi
@subsubsection Example implementation
@itemize
@item
@uref{git://holbrook.no/erc20-limiter.git,}
@end itemize

View File

@ -1,22 +0,0 @@
@subsection TokenRateChange
Enables detection of properties for CIC tokens that change value over time, e.g. through demurrage.
It allows defining the granularity of the rate of change, aswell as a frequency for which the rate of change is applied.
A method for canonical value change calculations is also provided.
@subsubsection ERC165 Interface identifier
@include ../../build/TokenRateChange.interface
@subsubsection Solidity interface definition
@include ../../build/contract_TokenRateChange.texi
@subsubsection Reference implementations
@itemize
@item
@uref{git://holbrook.no/erc20-demurrage-token.git,}
@end itemize

View File

@ -1,40 +0,0 @@
@subsection TokenSwap
Token swap interface that can fit token escrow purposes aswell as token swap contracts.
Optionally may define a @code{defaultToken}, that may among other things be used for @code{withdraw()} calls without an @code{inToken}.
An explicit @emph{ERC20 approval} of the balance to be transacted will usually be required for the implementing contract.
If the value 0 is passed as argument to @code{deposit} or @code{withdraw}, implementers can choose one of two possible outcomes:
@itemize
@item Noop. 0 @emph{must} be returned.
@item Use @emph{balance} or the max available @emph{allowance}. The actual (spent) value @emph{must} be returned.
@end itemize
@subsubsection ERC165 Interface identifier
@include ../../build/TokenSwap.interface
@subsubsection Solidity interface definition
@include ../../build/contract_TokenSwap.texi
@subsubsection Reference implementations
@itemize
@item
@uref{git://holbrook.no/erc20-pool.git,}
@end itemize
@subsubsection Handling deposits
The implementation is free to decide whether deposits can be recovered directly, or if they will be locked in the smart contract - temporarily or permanently.
For the duration deposits are locked, they are part of the smart contract's swap liquidity. During this time, locked deposits may only be withdrawn in exchange for other tokens accepted by the contract.
Deposits that are not locked should be withdrawable using the @code{withdraw(address,uint256)} (@code{0xf3fef3a3}) method signature.
Of course, as with most swap contracts, the tokens available for withdrawal by the holder may not necessarily match the tokens that were deposited by the holder.

View File

@ -1,21 +0,0 @@
@subsection TokenVend
This interface defines the mechanism for which a specific ERC20 token may be exchanged for a different ERC20 token.
A typical use-case is generation of voting tokens based on a momentary voucher balance. This is especially useful if the original ERC20 token is subject to decay (demurrage).
The tokens used for exchange @strong{SHOULD} be locked for the full duration of holding the vended tokens.
The withdrawal function may or may not allow partial withdrawals.
@table @dfn
@item ERC165 Interface identifier
@include ../../build/TokenVend.interface
@item Solidity interface definition
@include ../../build/contract_TokenVend.texi
@item Reference implementations
@itemize
@item
@uref{git://holbrook.no/erc20-vend.git,}
@end itemize
@end table

View File

@ -1,25 +0,0 @@
@anchor{token_vote}
@subsection TokenVote
Execute elections with granular ERC20 token votes.
A proposal submitted for vote may or may not contain multiple options. If multiple options are available, an ERC20 token holder may distribute its vote among the options with the granularity of the token balance.
Voted tokens @strong{SHOULD} be locked until the voting has finalized.
Finalization of voting should be callable by anyone.
@subsubsection ERC165 Interface identifier
@include ../../build/TokenVote.interface
@subsubsection Solidity interface definition
@include ../../build/contract_TokenVote.texi
@subsubsection Reference implementations
@itemize
@item
@uref{git://holbrook.no/evm-tokenvote.git,}
@end itemize

View File

@ -1,32 +0,0 @@
@subsection Writer
A complement to ERC173, which allows definition of a class of super-users for a contract.
A super-user address may perform @emph{more} actions than a "normal" address, aswell as @emph{some} actions normally limited to the @emph{contract owner}.
If an @emph{contract owner} is defined, No super-user should be able to perform actions that @emph{contract owner} cannot perform.
Typically, only the @emph{contract owner}, if it is defined, can add or remove a super-user.
Some use-case examples of super-user actions include:
@itemize
@item
Mint new tokens.
@item
Change the amount dispensed by the faucet.
@item
Edit access control lists.
@end itemize
@subsubsection ERC165 Interface identifier
@include ../../build/Writer.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Writer.texi
@subsubsection Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}

View File

@ -1 +0,0 @@
cbdb05c7

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AccountAdded","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

View File

@ -1 +0,0 @@
27beb910

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_declarator","type":"address"},{"indexed":false,"internalType":"address","name":"_subject","type":"address"},{"indexed":false,"internalType":"bytes32","name":"_proof","type":"bytes32"}],"name":"DeclarationAdded","type":"event"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"},{"internalType":"bytes32","name":"_proof","type":"bytes32"}],"name":"addDeclaration","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_declarator","type":"address"},{"internalType":"address","name":"_subject","type":"address"}],"name":"declaration","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_declarator","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declarationAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_declarator","type":"address"}],"name":"declarationCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declaratorAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"declaratorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@ -1 +0,0 @@
01ffc9a7

View File

@ -1 +0,0 @@
[{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]

View File

@ -1 +0,0 @@
9493f8b2

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

View File

@ -1 +0,0 @@
b61bc941

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_holder","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

View File

@ -1 +0,0 @@
de344547

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

View File

@ -1 +0,0 @@
449a52f8

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

View File

@ -1 +0,0 @@
37a47be4

View File

@ -1 +0,0 @@
[{"inputs":[],"name":"acceptOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

View File

@ -1 +0,0 @@
6b578339

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_result","type":"address"}],"name":"OwnershipTaken","type":"event"},{"inputs":[{"internalType":"address","name":"_target","type":"address"}],"name":"takeOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

View File

@ -1 +0,0 @@
bb34534c

View File

@ -1 +0,0 @@
[{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

View File

@ -1,235 +0,0 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are 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.
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.
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
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 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 work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 Affero 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 Affero 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 Affero 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 WARRANTY 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 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 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.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
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 AGPL, see <http://www.gnu.org/licenses/>.

View File

@ -1 +0,0 @@
include *requirements.txt solidity/* LICENSE README* cic_contracts/unittest/solidity/* cic_contracts/data/*

View File

@ -1,17 +0,0 @@
INPUTS = $(wildcard cic_contracts/unittest/solidity/*.sol)
OUTPUTS = $(patsubst %.sol, %.bin, $(INPUTS))
all: outs package
.SUFFIXES: .sol .bin
solidity:
.sol.bin:
solc $(basename $@).sol --evm-version=byzantium --bin | awk 'NR>3' > $@
truncate -s -1 $@
outs: $(OUTPUTS)
package:
python setup.py sdist

View File

@ -1,983 +0,0 @@
# Smart contract interfaces
## Technology
CIC smart contracts are implemented using the *solidity* programming
language for the (Ethereum Virtual Machine (EVM).
## Adopted standards
### Signing
### ERC - Direct use
The following well-known solidity interfaces are used directly.
- [ERC20 - Token Standard](https://eips.ethereum.org/EIPS/eip-20)
- [ERC165 - Standard Interface
Detection](https://eips.ethereum.org/EIPS/eip-165)
- [ERC173 - Contract Ownership
Standard](https://eips.ethereum.org/EIPS/eip-173)
- [ERC191 - Signed Data
Standard](https://eips.ethereum.org/EIPS/eip-191)
- [ERC712 - Typed structured data hashing and
signing](https://eips.ethereum.org/EIPS/eip-712)
- [ERC721 - Non-Fungible Token
Standard](https://eips.ethereum.org/EIPS/eip-721)
- [ERC5007 - Time NFT (EIP-721 Time
Extension)](https://eips.ethereum.org/EIPS/eip-5007)
- [ERC5192 - Minimal Soulbound
NFTs](https://eips.ethereum.org/EIPS/eip-5192)
### ERCs Partial use
The following well-known solidity interfaces are partially implemented
in CIC native interfaces.
- [ERC5679 - Token Minting and
Burning](https://eips.ethereum.org/EIPS/eip-5679) (See `Minter`,
`Burner`)
## Native interfaces
### ACL
A simple Access Control List definition that returns true of false
depending on whether an signatory (address) is allowed to operate in a
given context.
#### ERC165 Interface identifier
3ef25013
#### Solidity interface definition
interface IACL {
// Returns true if the address has permission to operate in the given context.
function have(address _address) external view returns(bool);
}
#### Example implementation
<git://holbrook.no/eth-accounts-index.git>
### Accounts Index
Append-only list of addresses. Typically used for access control lists.
Addresses may be *added*, *removed*, aswell as *deactivated* and
*activated*. Deactivated accounts still count towards the `entryCount`.
The `entry` method is used to iterate the account list. The order of
which accounts are returned is not guaranteed. Any returned value
matching `address(0x00)` should be skipped, and not counted towards
`entryCount`.
May optionally record time when account was added.
#### ERC165 Interface identifier
b7bca625
#### Solidity interface definition
interface IAccountsIndex {
// Address added to store, index in array.
event AddressAdded(uint256 indexed _idx, address _account);
// Return number of entries in index.
function entryCount() external view returns (uint256);
// Return entry at the spceificed index.
// Will revert if index is beyond array length.
// An entry result of 0 means the entry should be skipped, and not count towards entry count.
function entry(uint256) external view returns (address);
// Add an entry to the index. Incresases the entry count.
function add(address) external returns (bool);
// Verify that the entry exists in the index.
// Implements ACL
function have(address) external view returns (bool);
// Retrieve the timestamp when account was added.
// If time is not being tracked, a value of 0 should be returned.
function time(address) external view returns (uint256);
}
#### Reference implementation
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
### Accounts Index Mutable
Extends the functionality of `Accounts Index` to allow changes to the
address list.
Addresses may be *added*, *removed*, aswell as *deactivated* and
*activated*. Deactivated accounts still count towards the `entryCount`.
#### ERC165 Interface identifier
9479f0ae
#### Solidity interface definition
interface IAccountsIndexMutable {
// Active status of address changed, and by whom changed.
event AddressActive(address indexed _account, bool _active);
// Address removed from store, and by whom removed.
event AddressRemoved(address _account);
// Remove an entry from the index. Reduces the entry count.
function remove(address) external returns (bool);
// Deactivate account but keep in index. Does not affect entry count.
function deactivate(address) external returns (bool);
// Activate previously deactivated account. Does not affect entry count.
function activate(address) external returns (bool);
// Check if account exists and is active;
function isActive(address) external view returns (bool);
}
#### Reference implementation
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
### Burner
Attached to `ERC20` and `ERC721` tokens that may be *burned*.
Implements the `burn(...)` part of `ERC5679` for interoperability.
#### ERC165 Interface identifier
b1110c1b
#### Solidity interface definition
interface IBurner {
// Token(s) successfully burned; by who and how much.
event Burn(address indexed _burner, uint256 _burned);
// Satisfies ERC 5679
function burn(address _from, uint256 _amount, bytes calldata _data) external;
// Burn given amount of tokens held by signer.
function burn(uint256 _amount) external returns (bool);
// Burn all tokens held by signer.
// Returns the amount of tokens burned.
function burn() external returns (uint256);
// Total amount of tokens that have been burned.
function totalBurned() external returns (uint256);
// Total amount of tokens ever minted.
// If totalSupply() is available (ERC20, ERC721 Enumerable), this equals totalSupply() + totalBurned().
function totalMinted() external returns (uint256);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Chrono
Define a creation time for a resource.
Complements `ERC5007`.
#### ERC165 Interface identifier
4db1ccd4
#### Solidity interface definition
interface IChrono {
// Returns the timestamp of when a resource corresponding to _idx was first created.
// int64 chosen as return value for simpler interoperability with ERC5007.
function createTime(uint256 _idx) external returns(int64);
}
#### Example implementation
<https://git.defalsify.org/eth-erc721> (BadgeToken contract)
### Declarator
Permissionless store of signed claims made by an address about other
addresses, or addresses about themselves.
It is used to declare or respond to certifications of vouchers, NFT,
voucher members.
Addresses may be Externally Owned Accounts or smart contracts.
Claims may be made with or without topics. A missing topic is synonymous
with a topic value of `bytes32(0x00)`.
Any number of claims can be made about an address under any number of
topics. All claims must be stored, and returned in the order which they
were added.
#### ERC165 Interface identifier
21b7493b
#### Solidity interface definition
interface IDeclarator {
event DeclarationAdded(address indexed _declarator, address indexed _subject, bytes32 indexed _topic, bytes32 _proof);
// Get all declarations for a subject (without topic) signed by a declarator
function declaration(address _declarator, address _subject) external view returns ( bytes32[] memory );
// Get all declarations for a subject for the given topic signed by a declarator
function declaration(address _declarator, address _subject, bytes32 _topic) external view returns ( bytes32[] memory );
// Get number of declarations the declarator has ever signed
function declarationCount(address _declarator) external view returns ( uint256 );
// Get the subject of a declarator's declarations at the specific index
function declarationAddressAt(address _declarator, uint256 _idx) external view returns ( address );
// Add a declaration for the subject
function addDeclaration(address _subject, bytes32 _proof) external returns ( bool );
// Add a declaration with topic for the subject
function addDeclaration(address _subject, bytes32 _proof, bytes32 _topic) external returns ( bool );
// Get the declarator that signed a declaration at the specificed index for a subject
function declaratorAddressAt(address _subject, uint256 _idx) external view returns ( address );
// Get the number of declarators that have signed for a subject
function declaratorCount(address _subject) external view returns ( uint256 );
}
#### Reference implementation
<git://holbrook.no/eth-address-index.git>
### Digest
Allows encoding of digests according to a specific encoding scheme.
Primary use-case is the abstraction of self-describing
[Multhash](https://multiformats.io/multihash/) encoding.
A default encoding *must* always be defined, and the encoding of a valid
digest *must* succeed with the default encoding.
#### ERC165 Interface identifier
982ab05d
#### Solidity interface definition
interface IDigest {
// Returns the default digest encoding used by the contract instance.
function defaultDigestEncoding() external view returns (uint256 _encoding);
// Check if the given encoding has been implemented in the contract instance.
function haveDigestEncoding(uint256 _codec) external view returns(bool);
// Verify and encode the given digest for a specific hashing algorithm.
// Returns a zero-length byte array if digest is invalid.
// Must succeed if called with the defaultDigestEncoding and a valid digest.
function encodeDigest(bytes memory _data, uint256 _encoding) external view returns (bytes memory);
// Encodes the digest using the default digest encoding.
// Returns a zero-length byte array if digest is invalid.
// Must succeed with a valid digest.
function encodeDigest(bytes memory _data) external view returns (bytes memory);
}
#### Example implementation
<git://holbrook.no/eth-event-msg.git>
### Expire
Defines an expiry time after which token balances and supply *cannot
change*.
A contract defining an expiry *must not* allow changing the expiration
time to a time in the past.
#### ERC165 Interface identifier
841a0e94
#### Solidity interface definition
interface IExpire {
// Contract has expired.
event Expired(uint256 _timestamp);
// Expiry time has changed.
event ExpiryChange(uint256 indexed _oldTimestamp, uint256 _newTimestamp);
// The current expiration timestamp.
function expires() external returns (uint256);
// Check expiry and apply expiration if expired.
// Return values must be:
// 0: not yet expired.
// 1: already expired.
// >1: expiry executed.
function applyExpiry() external returns(uint8);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Faucet
Used for dispensing tokens to any address.
It can be used for gas tokens and *ERC20* alike.
The interface is the same whether the faucet is dispensing from existing
balance or minting new tokens.
The value dispersed *must* be the same for all addresses.
In general, four criteria are expected to exist in any combination for
limiting access to the faucet:
Time
A recipient may only use the faucet again after some time has passed.
Balance threshold
A recipient may only use the faucet after its balance is below a certain
amount.
Membership
A recipient may only use the faucet if it has been added to an access
control list.
Capacity
The contract has sufficient token funds to dispense the current defined
amount to dispense.
The *check(address)* contract call *must* evaluate all four criteria,
and *must* return `false` if any of the criteria are not met.
#### ERC165 Interface identifier
1a3ac634
#### Solidity interface definition
interface IFaucet {
// Tokens were given to an address
event Give(address indexed _recipient, address indexed _token, uint256 _value);
// The amount that the faucet disperses has changed
event FaucetAmountChange(uint256 _value);
// Address of token the faucet represents
// The faucet will return gas tokens with the zero-address is returned.
function token() external returns (address);
// Amount of tokens the faucet gives out
function tokenAmount() external returns (uint256);
// Give tokens to the given recipient. Returns amount of tokens given.
function giveTo(address _recipient) external returns (uint256);
// Give tokens to yourself. Returns amount of tokens given.
function gimme() external returns (uint256);
// Check if faucet may be used in the current contract state by _recipient
function check(address _recipient) external view returns (bool);
// Returns timestamp when faucet may be used again by _recipient
// If 0 is returned, the address has not yet been used.
// A return value of max(uint256) indicates that the faucet may not be used again.
function nextTime(address _recipient) external returns (uint256);
// Returns the token balance under which faucet may be used again by _recipient
// A return value of max(uint256) indicates that the faucet may be used regardless
// of the token balance of _recipient
function nextBalance(address _recipient) external returns (uint256);
}
#### Reference implementations
- <git://holbrook.no/erc20-faucet.git>
- <git://holbrook.no/eth-faucet.git>
### Locator
This interface supports `ERC721 Metadata`, in particular the
`tokenURI(uint256)` call.
Off-chain resources in the CIC network *must* be defined in terms of
content addressed strings.
It *must* be possible to refer to all off-chain resources directly by
the content address.
Furthermore, it *should* be possible to refer to a resource by a
fully-qualified location on the web or an overlay network (e.g. tor).
#### ERC165 Interface identifier
ed75b333
#### Solidity interface definition
interface ILocator {
// URI that may or may not point to a specific resource location.
function toURI(bytes memory _data) external view returns (string memory);
// URL pointing to a specific resource location.
function toURL(bytes memory _data) external view returns(string memory);
}
#### Example implementation
<git://holbrook.no/eth-event-msg.git>
#### Expressing locators in terms of numeric token id
Given the numeric token id `1234567890987654321` (`0x112210f4b16c1cb1`
hex), and a base url `https://contentgateway.grassecon.net`, the result
of the methods may be as follows:
`toURI(toHex(1234567890987654321))`
-\>
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
`toURL(toHex(1234567890987654321))`
-\>
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
`tokenURI(1234567890987654321)`
-\>
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
#### Expressing locators in terms of a digest
Given the data `foo`, the digest algorithm `sha256` and a base url
`https://contentgateway.grassecon.net`, the result of the methods may be
as follows:
`toURI(sha256(foo))`
-\>
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
`toURL(sha256(foo))`
-\>
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
`tokenURI(toUint(sha256(foo)))`
-\>
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
#### Locator without URL
Given the data `foo`, the digest algorithm `sha256` and no base url, the
result of the methods may be as follows:
`toURI(sha256(foo))`
-\>
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
`toURL(sha256(foo))`
-\> `""`
`tokenURI(toUint(sha256(foo)))`
-\>
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
### Minter
Attached to `ERC20` and `ERC721` tokens that may be minted.
Implements the `mint(...)` and `safeMint(...)` parts of `ERC5679` for
interoperability.
#### ERC165 Interface identifier
5878bcf4
#### Solidity interface definition
interface IMinter {
// Tokens are successfully minted; by who, to whom and how much
event Mint(address indexed _minter, address indexed _beneficiary, uint256 value);
// The given token has been successfully minted; by who, to whom and how much
event Mint(address indexed _minter, address indexed _beneficiary, address indexed _token, uint256 value);
// Mint the specified value of tokens to the specified recipient
function mintTo(address _beneficiary, uint256 value) external returns (bool);
// Satisfies ERC5679 for ERC20
function mint(address _beneficiary, uint256 value, bytes calldata _data) external;
// Satisfies ERC5679 for ERC721
function safeMint(address _beneficiary, uint256 value, bytes calldata _data) external;
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Msg
Enables a reference "message" to describe the contract using an
off-chain resource.
The reference may or may not be mutable.
The interface complements `Locator` and `MultiHash` to generate locators
for how to resolve the reference.
#### ERC165 Interface identifier
a3002595
#### Solidity interface definition
interface IMsg {
// Emitted when a new message digest has been set
// Should not be emitted if the digest set is identical to the previous
event Msg(bytes _msgDigest);
// Get the current message content hash
function getMsg() external view returns(bytes memory);
}
#### Example implementation
<git://holbrook.no/eth-event-msg.git>
### Registry
The Registry interface is a key-value store resolving well-known
contract identifier names to contract addresses.
It currently has two distinct uses in the CIC context:
1. Entry-point to discover all relevant contracts of CIC networks.
2. Unique (ERC20) token symbol resolver.
#### ERC165 Interface identifier
effbf671
#### Solidity interface definition
interface IRegistryClient {
// Address added to store with the given key
event AddressKey(bytes32 indexed _key, address _address);
// Return the address of the contract identified by the given byte string
function addressOf(bytes32) external view returns (address);
// Indexed accessor for the full list of registred identifiers
function identifier(uint256) external view returns (bytes32);
// Number of registered interfaces
function identifierCount() external view returns (uint256);
}
#### Contract registry implementation
<git://holbrook.no/eth-contract-registry.git>
#### Token index implementation
<git://holbrook.no/eth-contract-registry.git>
### Seal
Some smart contract parameters may need to be mutable over part of a
smart contracts lifetime.
This interface provides a method to explicitly signal when certain
parameters have been rendered immutable.
The value of `sealState()` *must not* decrease, and must not exceed
`maxSealState`.
`maxSealState` is used to define that *all mutable parameters* have been
rendered immutable. The practical implications of this will vary between
contracts.
The implementer is encouraged to use simple, descriptive names in the
source code to describe the applicable seal states.
Use cases of sealing include:
- Whether more tokens can be minted
- Allow ownership of a contract to be transferred
- The expiry time of a token (see `Expire`)
#### ERC165 Interface identifier
0d7491f8
#### Solidity interface definition
interface ISeal {
// Seal state has changed.
event SealStateChange(bool indexed _final, uint256 _sealState);
// The current seal state.
function sealState() external view returns(uint256);
// The numeric seal state in everything sealable has been sealed.
function maxSealState() external view returns(uint256);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
### Throttle
An backend contract to limit access to a resource by time.
The smart contract managing the resource calls `have(address)` on this
contract to check if it can be made use of at the current point in time.
This also implements [ACL](#acl).
When the resource is made use of, it calls `poke(address)` method to
register when it has been made use of.
The `next(address)` method returns the timestamp from which the resource
may be used again by the given address. The implementer is permitted to
change the value at any time.
#### ERC165 Interface identifier
242824a9
#### Solidity interface definition
interface IThrottle {
// Returns true if the given address is authorized to make use of the resource at the current moment.
// Implements ACL
function have(address _address) external view returns(bool);
// Returns the timestamp when the resource may next be used by the given address.
// A return value of 0 or a timestamp before the current timestamp indicates that the resource may used momentarily.
// A return value of max uint265 can be used to indicate that the resource may never be used again by the address.
function next(address _address) external returns(bool);
// Must be called when the resource is being used.
function poke(address _address) external returns(bool);
}
#### Reference implementation
<git://holbrook.no/eth-faucet.git> (PeriodSimple contract)
### TokenLimit
Define limits of value amounts of tokens that individual addresses can
hold.
Limits are inclusive; a limit for 42 means transfer resulting in a token
balance *higher* than 42 should be rejected.
A return value of 0 indicates that the token is categorically not
accepted by the holder.
#### ERC165 Interface identifier
23778613
#### Solidity interface definition
interface ITokenLimit {
// Returns limit of total value a holder will accept of a specific token.
// The value limit returned is inclusive; A limit of 42 means any operation resulting in a balance OVER 42 should be rejected.
// A value of 0 means that no value of the token is accepted.
function limitOf(address _token, address _holder) external view returns(uint256);
}
#### Reference implementations
- <git://holbrook.no/erc20-limiter.git>
### TokenQuote
Quote an output token value for a given value of input tokens.
Both input and output value is denominated in the smallest available
unit of respective tokens.
#### ERC165 Interface identifier
dbb21d40
#### Solidity interface definition
interface ITokenQuote {
// Returns, within a current context, what value of outTokens the given value of inTokens translates to.
// The values are given in smallest unit of each respective token.
function valueFor(address _outToken, address _inToken, uint256 value) external view returns (uint256);
}
#### Example implementation
- <git://holbrook.no/erc20-limiter.git>
### TokenRateChange
Enables detection of properties for CIC tokens that change value over
time, e.g. through demurrage.
It allows defining the granularity of the rate of change, aswell as a
frequency for which the rate of change is applied.
A method for canonical value change calculations is also provided.
#### ERC165 Interface identifier
b716af03
#### Solidity interface definition
interface ITokenChangeRate {
// Time unit resolution for rate of change.
// A value of 0 indicates no rate of change,
function changeTimeUnit() external view returns(uint256);
// Rate of change per changeTimeUnit(), signed integer.
// An effective value of 0 indicates no rate of change.
function changeRate() external view returns (int256);
// Number of decimals with which the changeRate is defined.
// changeRate() should be divided by 10 ** changeRateDecimals() to obtain effective value
function changeRateDecimals() external view returns(uint8);
// Timestamp from when rate of change should be applied.
// A value of 0 indicates no rate of change,
function changeStartTime() external view returns(uint256);
// Calculate value with change rate applied for given amount of time units.
// Will calculate compounded change over the given amount of time units
function applyChange(int256 _value, uint256 _changeTimeUnits) external view returns(int256);
}
#### Reference implementations
- <git://holbrook.no/erc20-demurrage-token.git>
### TokenSwap
Token swap interface that can fit token escrow purposes aswell as token
swap contracts.
Optionally may define a `defaultToken`, that may among other things be
used for `withdraw()` calls without an `inToken`.
An explicit *ERC20 approval* of the balance to be transacted will
usually be required for the implementing contract.
If the value 0 is passed as argument to `deposit` or `withdraw`,
implementers can choose one of two possible outcomes:
- Noop. 0 *must* be returned.
- Use *balance* or the max available *allowance*. The actual (spent)
value *must* be returned.
#### ERC165 Interface identifier
4146b765
#### Solidity interface definition
interface ITokenSwap {
// Emitted when a new deposit has been made.
event Deposit(address indexed _token, uint256 _value);
// Default token used to access the token swap.
// Returns zero-address if no default token is defined.
function defaultToken() external returns (address);
// Add inToken liquidity to the tune of given value.
// Requires token approval for the corresponding value.
// If value is 0, up to the full approval MAY be used for the transfer.
function deposit(address _inToken, uint256 _value) external returns (uint256);
// Withdraw pending outToken balance of given value in the pool for the sender.
// May require token approval for defaultToken if used by contract as exchange for the withdrawal.
// If value is 0, up to the full approval value MAY be used for the transfer.
function withdraw(address _outToken, uint256 _value) external returns (uint256);
// Exchange inToken equalling given value for outToken.
// Requires token approval for the value of inToken.
// If value is 0, up to the full approval value MAY be used for the transfer.
function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256);
}
#### Reference implementations
- <git://holbrook.no/erc20-pool.git>
#### Handling deposits
The implementation is free to decide whether deposits can be recovered
directly, or if they will be locked in the smart contract - temporarily
or permanently.
For the duration deposits are locked, they are part of the smart
contracts swap liquidity. During this time, locked deposits may only be
withdrawn in exchange for other tokens accepted by the contract.
Deposits that are not locked should be withdrawable using the
`withdraw(address,uint256)` (`0xf3fef3a3`) method signature.
Of course, as with most swap contracts, the tokens available for
withdrawal by the holder may not necessarily match the tokens that were
deposited by the holder.
### TokenVote
Execute elections with granular ERC20 token votes.
A proposal submitted for vote may or may not contain multiple options.
If multiple options are available, an ERC20 token holder may distribute
its vote among the options with the granularity of the token balance.
Voted tokens **SHOULD** be locked until the voting has finalized.
Finalization of voting should be callable by anyone.
#### ERC165 Interface identifier
f2e0bfeb
#### Solidity interface definition
interface ITokenVote {
// A new proposal has been created.
event ProposalAdded(uint256 indexed _blockDeadline, uint256 indexed voteTargetPpm, uint256 indexed _proposalIdx);
// A proposal vote has been completed.
// The proposal is identified by the serial number in _proposalIdx. It is up to the implementer to define how the proposal should be retrieved by index.
// The proposal result may be in one of three states:
// * Ratified (_cancelled == false, _insufficient == false)
// * Cancelled (_cancelled == true, _insufficient == false)
// * Not reached quorum (_cancelled == false, _insufficient == true)
event ProposalCompleted(uint256 indexed _proposalIdx, bool indexed _cancelled, bool indexed _insufficient, uint256 _totalVote);
// Propose a new vote.
// Voting is active until one of:
// * total cancel vote reach quorum (_targetVotePpm, ppm = parts-per-million).
// * _blockWait blocks from now.
function propose(bytes32 _description, uint256 _blockWait, uint24 _targetVotePpm) external returns (uint256);
// Add a voting option to a proposal
function addOption(uint256 _proposalIdx, bytes32 _description) external;
// Get number of options available for the proposal.
// This decides the boundary of the index that can be used with voteOptions(...)
// If the result is 0, vote(...) can be used aswell.
function optionCount(uint256 _proposalIdx) external view returns(uint256);
// Get proposal option. Assumes that proposal was created with proposeMulti(...)
function getOption(uint256 _proposalIdx, uint256 _optionIdx) external view returns (bytes32);
// Get vote count for the given option.
// If proposal has no options, it should be called with _optionIdx = 0
function voteCount(uint256 _proposalIdx, uint256 _optionIdx) external view returns(uint256);
// Vote on a proposal without options.
// Assumes that proposal was created with propose(...) and will fail otherwise.
function vote(uint256 _value) external returns (bool);
// Vote on a proposal option. Assumes that proposal was created with proposeMulti(...).
// Must work with a non-option proposal if _optionIndex is 0.
function voteOption(uint256 _optionIndex, uint256 _value) external returns (bool);
// Vote to cancel a proposal.
// If cancel has the majority:
// * A vote without options will have rejected the proposal description.
// * A vote with options will have rejected the proposal description as well as all option descriptions.
function voteCancel(uint256 _value) external returns (bool);
// Finalize the vote for a proposal.
// May be called if deadline has been passed, or if:
// * quorum has been reached with cancel votes.
// * quorum has been reached and proposal has no/only one option.
function finalize() external returns (bool);
}
#### Reference implementations
- <git://holbrook.no/evm-tokenvote.git>
### Writer
A complement to ERC173, which allows definition of a class of
super-users for a contract.
A super-user address may perform *more* actions than a "normal" address,
aswell as *some* actions normally limited to the *contract owner*.
If an *contract owner* is defined, No super-user should be able to
perform actions that *contract owner* cannot perform.
Typically, only the *contract owner*, if it is defined, can add or
remove a super-user.
Some use-case examples of super-user actions include:
- Mint new tokens.
- Change the amount dispensed by the faucet.
- Edit access control lists.
#### ERC165 Interface identifier
abe1f1f5
#### Solidity interface definition
interface IWriter {
// A writer has been added by _executor
event WriterAdded(address _writer);
// A writer has been removed by _executor
event WriterDeleted(address _writer);
// Add a new writer to the contract.
function addWriter(address _writer) external returns (bool);
// Remove existing writer from the contract.
function deleteWriter(address _writer) external returns (bool);
// Check whether the given address is a writer.
function isWriter(address _writer) external view returns (bool);
}
#### Example implementation
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>

View File

@ -1,8 +0,0 @@
# local imports
from cic_contracts.search import search
from cic_contracts.names import Name
erc165_for = search
def abi(v):
return search(v, ext='json')

Some files were not shown because too many files have changed in this diff Show More