From 82d37092c23b8ecbef1c7fd52e0bc9d76c9e36c8 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 2 Jan 2021 08:49:32 +0100 Subject: [PATCH] Update transferapproval interface --- Dockerfile | 24 ------------------- Faucet.sol | 5 ++-- RegistryClient.sol | 1 + RegistryStandard.sol | 1 + TokenEndorsement.sol | 3 --- TokenRegistry.sol | 18 -------------- TokenRegistryClient.sol | 18 -------------- TransferApproval.sol | 24 ++++++++++++++----- build_docker.sh | 3 --- .../calculate_erc165.py | 5 ++-- 10 files changed, 26 insertions(+), 76 deletions(-) delete mode 100644 Dockerfile delete mode 100644 TokenEndorsement.sol delete mode 100644 TokenRegistry.sol delete mode 100644 TokenRegistryClient.sol delete mode 100644 build_docker.sh rename calculate_erc165.py => util/calculate_erc165.py (75%) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index bbf5385..0000000 --- a/Dockerfile +++ /dev/null @@ -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 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" diff --git a/Faucet.sol b/Faucet.sol index faa123e..296eac1 100644 --- a/Faucet.sol +++ b/Faucet.sol @@ -2,16 +2,17 @@ pragma solidity >=0.6.12; // Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 // SPDX-License-Identifier: GPL-3.0-or-later -// File-version: 3 +// 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 gimme() external returns (bool); + function cooldown(address _recipient) external return (uint256); } diff --git a/RegistryClient.sol b/RegistryClient.sol index 279a1dc..bcf5798 100644 --- a/RegistryClient.sol +++ b/RegistryClient.sol @@ -8,4 +8,5 @@ pragma solidity >=0.6.12; interface RegistryClient { function registryCount() external view returns (uint256); function addressOf(bytes32) external view returns (address); + function entry(uint256) external view returns (address); } diff --git a/RegistryStandard.sol b/RegistryStandard.sol index e85507e..a7472b2 100644 --- a/RegistryStandard.sol +++ b/RegistryStandard.sol @@ -9,4 +9,5 @@ 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); } diff --git a/TokenEndorsement.sol b/TokenEndorsement.sol deleted file mode 100644 index 4f4155a..0000000 --- a/TokenEndorsement.sol +++ /dev/null @@ -1,3 +0,0 @@ -interface TokenEndorser { - function getBySymbol(address _tokenAddress) external view returns ( bytes32 ); -} diff --git a/TokenRegistry.sol b/TokenRegistry.sol deleted file mode 100644 index eb91256..0000000 --- a/TokenRegistry.sol +++ /dev/null @@ -1,18 +0,0 @@ -pragma solidity >=0.6.12; - -// Author: Louis Holbrook 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 ); -} diff --git a/TokenRegistryClient.sol b/TokenRegistryClient.sol deleted file mode 100644 index eb91256..0000000 --- a/TokenRegistryClient.sol +++ /dev/null @@ -1,18 +0,0 @@ -pragma solidity >=0.6.12; - -// Author: Louis Holbrook 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 ); -} diff --git a/TransferApproval.sol b/TransferApproval.sol index b11ef9e..5b0e8f8 100644 --- a/TransferApproval.sol +++ b/TransferApproval.sol @@ -9,11 +9,23 @@ interface TransferApproval { 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); - function serial() external view returns (uint256); - function requests(uint256) external view returns (address); - function approvers(address) external view returns(bool); - function request(address _recipient, address _token, uint256 _value) external returns (uint256); - function execute(uint256 _serial) external returns (bool); - function reject(uint256 _serial) external returns (bool); + struct Transaction { + uint256 serial; + address sender; + address recipient; + address token; + uint256 value; + } + + function approvers() external view return (address[]); + 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 _idx) external view returns (Transaction); + 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); } diff --git a/build_docker.sh b/build_docker.sh deleted file mode 100644 index 4187202..0000000 --- a/build_docker.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker build -t grassrootseconomics:cic . diff --git a/calculate_erc165.py b/util/calculate_erc165.py similarity index 75% rename from calculate_erc165.py rename to util/calculate_erc165.py index dcf1cfa..f93f84d 100644 --- a/calculate_erc165.py +++ b/util/calculate_erc165.py @@ -9,8 +9,9 @@ while True: l = f.readline() if l == '': break - print('line {}'.format(l)) + #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()) + #print(h.hex(), z.hex()) f.close() +print(h[:4].hex())