Compare commits

...

19 Commits

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

View File

@ -5,7 +5,8 @@ pragma solidity >=0.6.12;
// File-version: 2 // File-version: 2
interface AccountsIndex {
interface AccountRegistry {
event AccountAdded(address indexed addedAccount, uint256 indexed accountIndex); event AccountAdded(address indexed addedAccount, uint256 indexed accountIndex);
function accounts(uint256 _idx) external view returns (address); function accounts(uint256 _idx) external view returns (address);

15
AddressDeclarator.sol Normal file
View File

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

4
CHANGELOG Normal file
View File

@ -0,0 +1,4 @@
- 0.0.2
* Add token endorser contract
- 0.0.1
* Consolidate all existing contract interfaces

View File

@ -8,4 +8,5 @@ pragma solidity >=0.6.12;
interface ConverterRegistry { interface ConverterRegistry {
function getConvertibleTokens() external view returns (address[] memory); 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 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);
} }

6
ERC20.txt Normal file
View File

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

View File

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

View File

@ -1,22 +1,25 @@
# Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 # Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# File-version: 3 # File-version: 5
INPUTS = $(wildcard *.sol) INPUTS = $(wildcard *.sol)
OUTPUTS = $(patsubst %.sol, %.json, $(INPUTS))
PREFIX = /usr/local/share/cic/solidity/abi PREFIX = /usr/local/share/cic/solidity/abi
%.abi: $(wildcard *.sol) #%.abi.json: $(wildcard *.sol)
install -vDm0644 $@ $(PREFIX)/$@ # install -vDm0644 $@ $(PREFIX)/$@
%.sol: .SUFFIXES: .sol .json
solc $@ --abi | awk 'NR>3' > $(basename $@).abi
# TODO: improve, does not detect changes in sol files (I suck at writing makefiles) .sol.json:
all: $(INPUTS) solc $(basename $@).sol --abi | awk 'NR>3' > $@
install: $(wildcard *.abi) all: $(OUTPUTS)
install: $(OUTPUTS)
install -vDm0644 -t $(PREFIX) $?
clean: clean:
rm -vf *.abi rm -vf *.json
.PHONY: clean install .PHONY: clean install

View File

@ -14,6 +14,6 @@ interface Network {
uint256 _toAmount, uint256 _toAmount,
address _trader address _trader
); );
function convert(address) external view returns (address); function convert(address[] memory _path, uint256 _amount, uint256 _minReturn) external payable returns (uint256);
function rateByPath(address,uint256) external view returns (uint256); function rateByPath(address,uint256) external view returns (uint256);
} }

View File

@ -5,6 +5,13 @@ pragma solidity >=0.6.12;
// File-version: 1 // File-version: 1
interface RegistryClient { interface Registry {
function addressOf(address) external view returns (address); function owner() external view returns (address);
function identifiers() external view returns (bytes32[] memory);
function chainOf(bytes32 _identifier) external view returns (bytes32);
function configSumOf(bytes32 _chain) external view returns (bytes32);
function set (bytes32 _identifier, address _address, bytes32 _chainDescriptor, bytes32 _chainConfig) external returns (bool);
function seal() external returns (bool);
// TODO: extend RegistryClient, but flatten files
function addressOf(bytes32) external view returns (address);
} }

12
RegistryClient.sol Normal file
View File

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

13
RegistryStandard.sol Normal file
View File

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

3
RegistryStandard.txt Normal file
View File

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

View File

@ -9,11 +9,23 @@ interface TransferApproval {
event NewRequest(address indexed _sender, address indexed _recipient, address indexed _token, uint256 _value, uint256 _serial); event NewRequest(address indexed _sender, address indexed _recipient, address indexed _token, uint256 _value, uint256 _serial);
event NewExecution(uint256 serial); event NewExecution(uint256 serial);
event NewRejection(uint256 serial); event NewRejection(uint256 serial);
event TransferFail(uint256 serial);
function serial() external view returns (uint256); struct Transaction {
function requests(uint256) external view returns (address); uint256 serial;
function approvers(address) external view returns(bool); address sender;
function request(address _recipient, address _token, uint256 _value) external returns (uint256); address recipient;
function execute(uint256 _serial) external returns (bool); address token;
function reject(uint256 _serial) external returns (bool); 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);
} }

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.0.2

View File

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

View File

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

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

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

1
abis/Faucet.json Normal file
View File

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

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":"","type":"address"}],"name":"convert","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rateByPath","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

1
abis/Network.json Normal file
View File

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

View File

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

1
abis/Registry.json Normal file
View File

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

1
abis/RegistryClient.json Normal file
View File

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

View File

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

View File

@ -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

@ -0,0 +1 @@
[{"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 TransferApproval.Transaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}]

View File

@ -1,3 +0,0 @@
#!/bin/bash
docker build -t grassrootseconomics:cic .

47
contracts_overview.txt Normal file
View File

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

3
doc/texinfo/Makefile Normal file
View File

@ -0,0 +1,3 @@
all:
makeinfo --html index.texi

1
doc/texinfo/index.texi Normal file
View File

@ -0,0 +1 @@
@include overview.texi

View File

@ -0,0 +1,117 @@
<!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/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Smart contract interfaces (Untitled Document)</title>
<meta name="description" content="Smart contract interfaces (Untitled Document)">
<meta name="keywords" content="Smart contract interfaces (Untitled Document)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="#Smart-contract-interfaces" rel="start" title="Smart contract interfaces">
<style type="text/css">
<!--
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}
pre.menu-comment {font-family: serif}
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}
ul.no-bullet {list-style: none}
-->
</style>
</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>
<span id="Smart-Contracts-in-the-CIC-Network"></span><h3 class="section">1.1 Smart Contracts in the CIC Network</h3>
<span id="Technology"></span><h4 class="subsection">1.1.1 Technology</h4>
<p>The long-term aim of the CIC network is to be agnostic of consensus engines. However, since we have to start <em>somewhere</em>, the current state of development only deals with Smart Contracts on the (Ethereum Virtual Machine (EVM).
</p>
<span id="The-registry-contract"></span><h4 class="subsection">1.1.2 The registry contract</h4>
<p>The CICRegistry contract defines the entry-point to the entire CIC network. All other CIC network resources can be discovered through this contract.
</p>
<p>Its implementation is contained in the <samp>cic-registry</samp> repository. Details about it are documented further in that section.
</p>
<span id="Auxiliary-contracts"></span><h4 class="subsection">1.1.3 Auxiliary contracts</h4>
<p>All other Smart Contracts in the network other than CICRegistry are essentially optional, and each applies <em>at least one</em> the interfaces defined in the <code>cic-contracts</code> repository.
</p>
<span id="Contract-interfaces"></span><h4 class="subsection">1.1.4 Contract interfaces</h4>
<p>All contracts interfaces also implement the <strong>EIP165</strong> Standard Interface Detection.
</p>
<span id="Registry"></span><h4 class="subsubsection">1.1.4.1 Registry</h4>
<p>A key-value store, which resolves arbitrary 32-byte pointers to Ethereum addresses. Typically, this is used to resolve an address from a well-known identifier, either as a UTF-8 value or a 256-bit hash.
</p>
<p>It also provides numerical index access to all registered values in order of insertion.
</p>
<span id="Registry-Client"></span><h4 class="subsubsection">1.1.4.2 Registry Client</h4>
<p>A subset of the <code>Registry</code> interface, which defines only the non-transactional methods of the contract. The <code>Registry Client</code> interface is implemented by the <code>CICRegistry</code> contract.
</p>
<span id="Faucet"></span><h4 class="subsubsection">1.1.4.3 Faucet</h4>
<p>Enables disbursement of a set amount of tokens to a requesting address.
</p>
<p>Allows privileged accounts to adjust the amount of tokens to disburse.
</p>
<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>
<p>Enables a third-party approval to spend an ERC20 token allowance.
</p>
<p>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.
</p>
<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>
<p>Stores one or more 32-byte entries as a description of an Ethereum address, <em>signed</em> by another Ethereum address.
</p>
<p>This can be used to <em>describe</em> 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.
</p>
<p>Entries are stored by the transacting address that adds address/description pairs. In other words, any address may have different &quot;opinions&quot; 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 &quot;opinion&quot; of an address by combining data from signatures it trusts.
</p>
<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>
<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>
<p>Methods required to convert between tokens.
</p><hr>
</body>
</html>

76
doc/texinfo/overview.texi Normal file
View File

@ -0,0 +1,76 @@
@node Smart contract interfaces
@chapter Smart contract interfaces
@section Smart Contracts in the CIC Network
@subsection 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).
@subsection The registry contract
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 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.

17
util/calculate_erc165.py Normal file
View File

@ -0,0 +1,17 @@
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()
print(h[:4].hex())

13
util/mergeabis.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
import sys
import json
merged = []
for a in sys.argv[1:]:
f = open(a, 'r')
j = json.load(f)
f.close()
merged += j
print(json.dumps(merged))