Compare commits

...

58 Commits

Author SHA1 Message Date
lash b1c03932ad
Add throttle interface 2023-08-04 18:17:23 +01:00
lash db35d389ec
Add ACL interface 2023-08-03 15:16:45 +01:00
lash b9a29b7827
Add tokenquote interface 2023-08-03 14:13:26 +01:00
lash 48d69ce74c
clarify limiter functionality 2023-08-03 10:34:38 +01:00
lash 9df26634fd
Add tokenlimit interface 2023-08-03 10:27:05 +01:00
lash da5d7d9d2d Fix remaining texinfo code examples
Signed-off-by: lash <dev@holbrook.no>
2023-08-02 10:22:32 +01:00
lash f9d2af2e3b
Restructure texinfo to improve readme formatting for code example 2023-08-02 10:19:33 +01:00
lash e3d0704d4f
Token swap interface implementation 2023-08-01 16:07:31 +01:00
lash 80671fdfaa
Add rate of change definition 2023-08-01 14:50:25 +01:00
lash 0fba11aeaf
Replace pysha3 with safe-pysha3 2023-06-10 10:58:09 +01:00
lash a7cc695045
Add data files to manifest 2023-06-09 09:47:06 +01:00
lash 64e8df2573
Interface and abi generator interface 2023-06-09 09:44:03 +01:00
lash 45ca79cf46
Add seal set part of interface test 2023-06-08 16:55:48 +01:00
lash fe4f1c2c41
Habilitate expire unittest module for external use 2023-06-08 16:06:03 +01:00
lash 80589e574a
Ensure test client specifies max supply in unittest 2023-06-08 14:39:46 +01:00
lash 5ff686e513
Bump version 2023-06-08 14:00:59 +01:00
lash 6aa0319407
Add bytecode generator for cic contracts unittests 2023-06-08 14:00:23 +01:00
lash a7b0858baa
Include unittest modules 2023-06-08 08:34:12 +01:00
lash 6f44c8304f
Add seal test interface 2023-06-08 08:05:10 +01:00
lash 993d52ecab
Rename writer test contract 2023-06-06 18:15:07 +01:00
lash 02aa54f653
Add writer test contract 2023-06-06 18:12:06 +01:00
lash 360a288d77
Bump version 2023-06-06 17:57:29 +01:00
lash ef3ee7caf0
Add minter and burner python interface and test code 2023-06-06 17:56:45 +01:00
lash 220b8afbeb
Add capped interface, python interface and test for capped, expire 2023-06-06 14:46:55 +01:00
lash c10d2c46f1
Add readme from texinfo docbook intermediary 2023-05-13 20:42:47 +01:00
lash 3edc8bf021
Add option count to interface token vote 2023-05-07 19:16:08 +01:00
lash 2c666cc2aa Merge branch 'dev-0.2.1' 2023-05-07 19:02:58 +01:00
lash 2eba8c6254
Add token vote interfaces 2023-05-07 19:01:06 +01:00
lash c2c9581dab
Update gitignore 2023-03-26 12:06:12 +01:00
lash b3f6e45696
Add Digest interface 2023-03-26 12:04:31 +01:00
lash 1e11d8df08
Update writer, registry, expire, improve comments 2023-03-26 09:58:23 +01:00
lash 46cc35b54c
Add back ERC interfaces 2023-03-25 12:32:56 +00:00
lash a28cfdbb36
Improve locator example 2023-03-25 11:24:23 +00:00
lash 0877fe7769
Embed solidity code, interfaces in documentation 2023-03-25 11:14:46 +00:00
lash 8507f202e7
Update declarator to include topic 2023-03-24 11:05:21 +00:00
lash 0f2cc2d232
Update interfaces to current implenentations 2023-03-21 20:46:46 +00:00
lash 99dce60a97
Bump dep 2023-02-11 04:53:46 +00:00
William Luke ba3e6e047f fix: add manifest 2022-06-13 16:31:55 +03:00
William Luke 105f85be1c feat: bump chainlib 2022-06-13 14:15:50 +03:00
lash 4b0ff00f20
upgrade deps 2022-04-20 21:35:29 +00:00
nolash 6c6c48965e
Add set, bind to registry 2021-12-22 19:13:18 +00:00
nolash 9091c83295
Add python interfaces, package 2021-11-13 07:06:52 +01:00
nolash b0b1536f39
Move mergeabis script to scripts folder 2021-10-23 21:00:17 +02:00
nolash f601b706ac
Link license 2021-10-23 20:57:15 +02:00
nolash 0a8ec989ef
Add ERC specs, licenses 2021-10-23 20:52:30 +02:00
nolash 689ad18025
Add comments to interfaces, add ERC721, rename EIP to ERC 2021-10-23 20:42:52 +02:00
nolash 890ffec28b
Add missing balanceOf method to ERC20 2021-06-10 16:35:50 +02:00
nolash 98b58dce03
Add fungible minter 2021-05-10 09:13:22 +02:00
nolash c0140bffe6
Add gitignore 2021-04-29 08:54:26 +02:00
nolash 73f9a1b08c
Move python scripts to subfolder 2021-04-29 08:40:26 +02:00
nolash d15dabb4b5
Move solidity source to subfolder 2021-04-29 08:37:41 +02:00
nolash 08040874ef
Add interface digest generator script, add to makefile 2021-04-28 14:01:37 +02:00
nolash c956d9b202
Add interface signature generator 2021-04-28 13:55:53 +02:00
nolash 03856123d2
Add missing file 2021-04-28 13:02:50 +02:00
nolash 43b43a189e
Make new abis 2021-04-28 11:59:47 +02:00
nolash 75e119da09
Add (embarrassing) lexer to parse contract interfaec 2021-04-27 20:46:39 +02:00
Louis Holbrook 21ddd34201 Merge branch 'lash/declarator' into 'master'
Add declarator python meta interface

See merge request grassrootseconomics/cic-contracts!3
2021-02-23 16:16:57 +00:00
Louis Holbrook f33537e988 Add declarator python meta interface 2021-02-23 16:16:57 +00:00
272 changed files with 8157 additions and 483 deletions

9
.gitignore vendored Normal file
View File

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

View File

@ -1,19 +0,0 @@
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);
}

View File

@ -1,15 +0,0 @@
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,4 +1,9 @@
- 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

View File

@ -1,17 +0,0 @@
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;
}

View File

@ -1,12 +0,0 @@
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);
}

View File

@ -1,15 +0,0 @@
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,24 +0,0 @@
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"

View File

@ -1,22 +0,0 @@
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);
}

View File

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

View File

@ -1,18 +0,0 @@
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);
}

1
LICENSE Symbolic link
View File

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

121
LICENSE.CC0 Normal file
View File

@ -0,0 +1,121 @@
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.

674
LICENSE.GPL3 Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO 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 General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -2,24 +2,53 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# File-version: 5
INPUTS = $(wildcard *.sol)
OUTPUTS = $(patsubst %.sol, %.json, $(INPUTS))
PREFIX = /usr/local/share/cic/solidity/abi
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
#%.abi.json: $(wildcard *.sol)
# install -vDm0644 $@ $(PREFIX)/$@
.SUFFIXES: .sol .json
.SUFFIXES: .sol .json .interface
.sol.json:
solc $(basename $@).sol --abi | awk 'NR>3' > $@
all: $(OUTPUTS)
.sol.interface:
bash to_interface.sh $(basename $@).sol > $@
install: $(OUTPUTS)
all: outs doc
outs: $(OUTPUTS)
echo $(OUTPUTS)
install-code: $(OUTPUTS)
install -vDm0644 -t $(PREFIX) $?
install-doc:
bash texify.sh
install: outs install-code install-doc doc
clean:
rm -vf *.json
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: outs
mkdir -vp python/cic_contracts/data
cp -v solidity/*.interface python/cic_contracts/data
cp -v solidity/*.json python/cic_contracts/data
make -C python
.PHONY: clean install

View File

@ -1,19 +0,0 @@
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);
}

974
README.md Normal file
View File

@ -0,0 +1,974 @@
# 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.
#### ERC165 Interface identifier
8f5bc7bf
#### 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);
// 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,17 +0,0 @@
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);
}

View File

@ -1,12 +0,0 @@
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);
}

View File

@ -1,13 +0,0 @@
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);
}

View File

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

View File

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

View File

@ -1,18 +0,0 @@
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 );
}

View File

@ -1,18 +0,0 @@
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 );
}

View File

@ -1,31 +0,0 @@
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 NewExecution(uint256 serial);
event NewRejection(uint256 serial);
event TransferFail(uint256 serial);
struct Transaction {
uint256 serial;
address sender;
address recipient;
address token;
uint256 value;
}
function approvers() external view returns (address[] memory);
function count() 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 createRequest(address _recipient, address _token, uint256 _value) external returns (uint256);
function executeRequest(uint256 _serial) external returns (bool);
function rejectRequest(uint256 _serial) external returns (bool);
}

View File

@ -1 +1 @@
0.0.2
0.2.0

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":"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

@ -1 +0,0 @@
[{"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"}]

View File

@ -1 +0,0 @@
[{"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

@ -1 +0,0 @@
[{"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"}]

View File

@ -1 +0,0 @@
[{"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"}]

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"},{"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"}]

View File

@ -1 +0,0 @@
[{"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":"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"}]

View File

@ -1 +0,0 @@
[{"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"}]

View File

@ -1 +0,0 @@
[{"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"}]

View File

@ -1 +0,0 @@
[{"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

@ -1 +0,0 @@
[{"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

@ -1 +0,0 @@
[{"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

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"serial","type":"uint256"}],"name":"NewExecution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"serial","type":"uint256"}],"name":"NewRejection","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"NewRequest","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"execute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"reject","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"request","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requests","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"serial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@ -1 +0,0 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"serial","type":"uint256"}],"name":"NewExecution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"serial","type":"uint256"}],"name":"NewRejection","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"NewRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"serial","type":"uint256"}],"name":"TransferFail","type":"event"},{"inputs":[],"name":"approvers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"createRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"executeRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getSerialAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"rejectRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"requests","outputs":[{"components":[{"internalType":"uint256","name":"serial","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct TransferAuthorization.Transaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}]

View File

@ -1,16 +0,0 @@
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

@ -1,47 +0,0 @@
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,3 +1,5 @@
all:
makeinfo --html index.texi
readme:
makeinfo --docbook --no-split -o build/docbook.xml index.texi

View File

@ -0,0 +1,42 @@
@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)

18
doc/texinfo/acl.sol.texi Normal file
View File

@ -0,0 +1,18 @@
@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

@ -0,0 +1,17 @@
@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

@ -0,0 +1,18 @@
@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

@ -0,0 +1,23 @@
@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

@ -0,0 +1,20 @@
@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

@ -0,0 +1,18 @@
@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

@ -0,0 +1,42 @@
@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.7, http://www.gnu.org/software/texinfo/ -->
<!-- Created by GNU Texinfo 6.8, https://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,14 +10,16 @@
<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}
@ -26,6 +28,7 @@ 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>
@ -34,45 +37,77 @@ ul.no-bullet {list-style: none}
</head>
<body lang="en">
<span id="Smart-contract-interfaces"></span><span id="Smart-contract-interfaces-1"></span><h2 class="chapter">1 Smart contract interfaces</h2>
<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-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="#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="Technology"></span><h4 class="subsection">1.1.1 Technology</h4>
<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>
<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>
<span id="The-registry-contract"></span><h4 class="subsection">1.1.2 The registry contract</h4>
</div>
<div class="subsection" id="The-registry-contract">
<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>
<span id="Auxiliary-contracts"></span><h4 class="subsection">1.1.3 Auxiliary contracts</h4>
</div>
<div class="subsection" id="Auxiliary-contracts">
<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>
<span id="Contract-interfaces"></span><h4 class="subsection">1.1.4 Contract interfaces</h4>
</div>
<div class="subsection" id="Contract-interfaces">
<h4 class="subsection">1.1.4 Contract interfaces</h4>
<p>All contracts interfaces also implement the <strong>EIP165</strong> Standard Interface Detection.
</p>
<span id="Registry"></span><h4 class="subsubsection">1.1.4.1 Registry</h4>
<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>
<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>
<span id="Registry-Client"></span><h4 class="subsubsection">1.1.4.2 Registry Client</h4>
</div>
<div class="subsubsection" id="Registry-Client">
<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>
<span id="Faucet"></span><h4 class="subsubsection">1.1.4.3 Faucet</h4>
</div>
<div class="subsubsection" id="Faucet">
<h4 class="subsubsection">1.1.4.3 Faucet</h4>
<p>Enables disbursement of a set amount of tokens to a requesting address.
</p>
@ -81,7 +116,9 @@ ul.no-bullet {list-style: none}
<p>Can be implemented as a periodic or a one-time service per account.
</p>
<span id="Transfer-approval"></span><h4 class="subsubsection">1.1.4.4 Transfer approval</h4>
</div>
<div class="subsubsection" id="Transfer-approval">
<h4 class="subsubsection">1.1.4.4 Transfer approval</h4>
<p>Enables a third-party approval to spend an ERC20 token allowance.
</p>
@ -90,7 +127,9 @@ ul.no-bullet {list-style: none}
<p>The contract allows the third-party address to either allow or reject the transfer.
</p>
<span id="Declarator"></span><h4 class="subsubsection">1.1.4.5 Declarator</h4>
</div>
<div class="subsubsection" id="Declarator">
<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>
@ -101,15 +140,22 @@ ul.no-bullet {list-style: none}
<p>Entries typically are text strings or content hashes.
</p>
<span id="Address-Index"></span><h4 class="subsubsection">1.1.4.6 Address Index</h4>
</div>
<div class="subsubsection" id="Address-Index">
<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>
<span id="DEX-Index"></span><h4 class="subsubsection">1.1.4.7 DEX Index</h4>
</div>
<div class="subsubsection" id="DEX-Index">
<h4 class="subsubsection">1.1.4.7 DEX Index</h4>
<p>Methods required to convert between tokens.
</p><hr>
</p><hr></div>
</div>
</div>
</div>

View File

@ -0,0 +1,63 @@
@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

@ -0,0 +1,17 @@
@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}

20
doc/texinfo/msg.sol.texi Normal file
View File

@ -0,0 +1,20 @@
@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}

59
doc/texinfo/old.texi Normal file
View File

@ -0,0 +1,59 @@
@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,75 +2,90 @@
@chapter Smart contract interfaces
@section Smart Contracts in the CIC Network
@subsection Technology
@section Technology
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).
CIC smart contracts are implemented using the @emph{solidity} programming language for the (Ethereum Virtual Machine (EVM).
@subsection The registry contract
@section Adopted standards
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 Signing
@subsection Contract interfaces
@subsection ERC - Direct use
All contracts interfaces also implement the @strong{EIP165} Standard Interface Detection.
The following well-known solidity interfaces are used directly.
@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.
@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 Client
@subsection ERCs Partial use
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.
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
@subsubsection Faucet
@section Native interfaces
Enables disbursement of a set amount of tokens to a requesting address.
@include acl.sol.texi
Allows privileged accounts to adjust the amount of tokens to disburse.
@include accountsindex.sol.texi
Can be implemented as a periodic or a one-time service per account.
@include burner.sol.texi
@include chrono.sol.texi
@subsubsection Transfer approval
@include declarator.sol.texi
Enables a third-party approval to spend an ERC20 token allowance.
@include digest.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 expire.sol.texi
The contract allows the third-party address to either allow or reject the transfer.
@include faucet.sol.texi
@include locator.sol.texi
@subsubsection Declarator
@include minter.sol.texi
Stores one or more 32-byte entries as a description of an Ethereum address, @emph{signed} by another Ethereum address.
@include msg.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 registry.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 seal.sol.texi
Entries typically are text strings or content hashes.
@include throttle.sol.texi
@include tokenlimit.sol.texi
@subsubsection Address Index
@include tokenquote.sol.texi
A simple append-only list of addresses. Used to check whether an address is part of a particular group.
@include tokenratechange.sol.texi
@include tokenswap.sol.texi
@subsubsection DEX Index
@include tokenvote.sol.texi
Methods required to convert between tokens.
@include writer.sol.texi

View File

@ -0,0 +1,28 @@
@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,}

34
doc/texinfo/seal.sol.texi Normal file
View File

@ -0,0 +1,34 @@
@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

@ -0,0 +1,20 @@
@subsection 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 @ref{acl, ACL}.
When the resource is made use of, it calls `poke(address)` method to register when it has been made use of.
@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

@ -0,0 +1,22 @@
@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

@ -0,0 +1,20 @@
@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

@ -0,0 +1,22 @@
@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

@ -0,0 +1,40 @@
@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

@ -0,0 +1,21 @@
@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

@ -0,0 +1,25 @@
@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

@ -0,0 +1,32 @@
@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

@ -0,0 +1 @@
cbdb05c7

1
out/AccountsIndex.json Normal file
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":"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"}]

1
out/Declarator.interface Normal file
View File

@ -0,0 +1 @@
27beb910

1
out/Declarator.json Normal file
View File

@ -0,0 +1 @@
[{"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"}]

1
out/EIP165.interface Normal file
View File

@ -0,0 +1 @@
01ffc9a7

1
out/EIP165.json Normal file
View File

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

1
out/EIP173.interface Normal file
View File

@ -0,0 +1 @@
9493f8b2

1
out/EIP173.json Normal file
View File

@ -0,0 +1 @@
[{"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"}]

1
out/ERC20.interface Normal file
View File

@ -0,0 +1 @@
b61bc941

1
out/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"},{"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"}]

1
out/Faucet.interface Normal file
View File

@ -0,0 +1 @@
de344547

1
out/Faucet.json Normal file
View File

@ -0,0 +1 @@
[{"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"}]

1
out/Minter.interface Normal file
View File

@ -0,0 +1 @@
449a52f8

1
out/Minter.json Normal file
View File

@ -0,0 +1 @@
[{"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

@ -0,0 +1 @@
37a47be4

1
out/OwnedAccepter.json Normal file
View File

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

1
out/OwnedTaker.interface Normal file
View File

@ -0,0 +1 @@
6b578339

1
out/OwnedTaker.json Normal file
View File

@ -0,0 +1 @@
[{"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"}]

1
out/Registry.interface Normal file
View File

@ -0,0 +1 @@
bb34534c

674
python/LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO 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 General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

1
python/MANIFEST.in Normal file
View File

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

17
python/Makefile Normal file
View File

@ -0,0 +1,17 @@
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

974
python/README.md Normal file
View File

@ -0,0 +1,974 @@
# 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.
#### ERC165 Interface identifier
8f5bc7bf
#### 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);
// 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

@ -0,0 +1,8 @@
# 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')

View File

@ -0,0 +1,121 @@
# standard imports
import logging
# external imports
from chainlib.eth.tx import (
TxFormat,
)
from chainlib.eth.contract import (
ABIContractEncoder,
ABIContractDecoder,
ABIContractType,
abi_decode_single,
)
from chainlib.eth.constant import ZERO_ADDRESS
from chainlib.jsonrpc import JSONRPCRequest
from chainlib.eth.error import RequestMismatchException
from hexathon import (
add_0x,
strip_0x,
)
# local imports
from .base import CICTxHelper
from .writer import CICWriter
logg = logging.getLogger(__name__)
class CICAccountsIndex(CICWriter):
def add(self, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC):
return self.single_address_method('add', contract_address, sender_address, address, tx_format)
def have(self, contract_address, address, sender_address=ZERO_ADDRESS, id_generator=None):
j = JSONRPCRequest(id_generator)
o = j.template()
o['method'] = 'eth_call'
enc = ABIContractEncoder()
enc.method('have')
enc.typ(ABIContractType.ADDRESS)
enc.address(address)
data = add_0x(enc.get())
tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx))
return o
def entry_count(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None):
j = JSONRPCRequest(id_generator)
o = j.template()
o['method'] = 'eth_call'
enc = ABIContractEncoder()
enc.method('entryCount')
data = add_0x(enc.get())
tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx))
return o
def count(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None):
return self.entry_count(contract_address, sender_address=sender_address, id_generator=id_generator)
def entry(self, contract_address, idx, sender_address=ZERO_ADDRESS, id_generator=None):
j = JSONRPCRequest(id_generator)
o = j.template()
o['method'] = 'eth_call'
enc = ABIContractEncoder()
enc.method('entry')
enc.typ(ABIContractType.UINT256)
enc.uint256(idx)
data = add_0x(enc.get())
tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx))
return o
@classmethod
def parse_account(self, v):
return abi_decode_single(ABIContractType.ADDRESS, v)
@classmethod
def parse_entry(self, v):
return abi_decode_single(ABIContractType.ADDRESS, v)
@classmethod
def parse_entry_count(self, v):
return abi_decode_single(ABIContractType.UINT256, v)
@classmethod
def parse_have(self, v):
return abi_decode_single(ABIContractType.BOOLEAN, v)
@classmethod
def parse_add_request(self, v):
v = strip_0x(v)
cursor = 0
enc = ABIContractEncoder()
enc.method('add')
enc.typ(ABIContractType.ADDRESS)
r = enc.get()
l = len(r)
m = v[:l]
if m != r:
logg.debug('method mismatch, expected {}, got {}'.format(r, m))
raise RequestMismatchException(v)
cursor += l
dec = ABIContractDecoder()
dec.typ(ABIContractType.ADDRESS)
dec.val(v[cursor:cursor+64])
r = dec.decode()
return r

View File

@ -0,0 +1,23 @@
# external imports
from chainlib.eth.tx import (
TxFactory,
TxFormat,
)
from chainlib.eth.contract import (
ABIContractEncoder,
ABIContractType,
)
class CICTxHelper(TxFactory):
def single_address_method(self, method, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC):
enc = ABIContractEncoder()
enc.method(method)
enc.typ(ABIContractType.ADDRESS)
enc.address(address)
data = enc.get()
tx = self.template(sender_address, contract_address, use_nonce=True)
tx = self.set_code(tx, data)
tx = self.finalize(tx, tx_format)
return tx

View File

@ -0,0 +1 @@
b7bca625

View File

@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_idx","type":"uint256"},{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressAdded","type":"event"},{"inputs":[{"internalType":"address","name":"","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":"","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@ -0,0 +1 @@
9479f0ae

View File

@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"},{"indexed":false,"internalType":"bool","name":"_active","type":"bool"}],"name":"AddressActive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressRemoved","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"activate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"deactivate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"remove","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

View File

@ -0,0 +1 @@
b1110c1b

View File

@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_burner","type":"address"},{"indexed":false,"internalType":"uint256","name":"_burned","type":"uint256"}],"name":"Burn","type":"event"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

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