Merge branch 'lash/better-interfaces' into 'master'
Add token registry See merge request grassrootseconomics/cic-contracts!1
This commit is contained in:
commit
6ab91439ad
@ -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
15
AddressDeclarator.sol
Normal 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
4
CHANGELOG
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- 0.0.2
|
||||||
|
* Add token endorser contract
|
||||||
|
- 0.0.1
|
||||||
|
* Consolidate all existing contract interfaces
|
@ -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);
|
||||||
}
|
}
|
||||||
|
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
FROM ethereum/solc:0.6.12
|
||||||
|
|
||||||
|
# The solc image messes up the alpine environment, so we have to go all over again
|
||||||
|
FROM alpine
|
||||||
|
COPY --from=0 /usr/bin/solc /usr/bin/solc
|
||||||
|
|
||||||
|
RUN apk update && \
|
||||||
|
apk add make
|
||||||
|
|
||||||
|
WORKDIR /usr/src
|
||||||
|
|
||||||
|
COPY ./Makefile ./cic-contracts/Makefile
|
||||||
|
COPY ./*.sol ./cic-contracts/
|
||||||
|
|
||||||
|
RUN cd cic-contracts && \
|
||||||
|
make -B && make install -B
|
||||||
|
|
||||||
|
#RUN mkdir -vp /usr/local/share/cic/solidity && \
|
||||||
|
# cp -rv cic-contracts/abis
|
||||||
|
|
||||||
|
LABEL authors="Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746"
|
||||||
|
LABEL spdx-license-identifier="GPL-3.0-or-later"
|
||||||
|
LABEL description="Ethereum smart contract interfaces used by the CIC component suite"
|
||||||
|
LABEL version="3"
|
@ -2,7 +2,7 @@ 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: 3
|
||||||
|
|
||||||
|
|
||||||
interface Faucet {
|
interface Faucet {
|
||||||
@ -13,4 +13,5 @@ interface Faucet {
|
|||||||
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 gimme() external returns (bool);
|
||||||
}
|
}
|
||||||
|
21
Makefile
21
Makefile
@ -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
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
11
Registry.sol
11
Registry.sol
@ -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);
|
||||||
}
|
}
|
||||||
|
11
RegistryClient.sol
Normal file
11
RegistryClient.sol
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
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);
|
||||||
|
}
|
12
RegistryStandard.sol
Normal file
12
RegistryStandard.sol
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
pragma solidity >=0.6.12;
|
||||||
|
|
||||||
|
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
// File-version: 1
|
||||||
|
|
||||||
|
|
||||||
|
interface RegistryStandard {
|
||||||
|
function registryCount() external view returns (uint256);
|
||||||
|
function addressOf(bytes32) external view returns (address);
|
||||||
|
function register(bytes32,address) external view returns (bool);
|
||||||
|
}
|
3
RegistryStandard.txt
Normal file
3
RegistryStandard.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
registryCount()
|
||||||
|
addressOf(bytes32)
|
||||||
|
register(bytes32,address)
|
3
TokenEndorsement.sol
Normal file
3
TokenEndorsement.sol
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
interface TokenEndorser {
|
||||||
|
function getBySymbol(address _tokenAddress) external view returns ( bytes32 );
|
||||||
|
}
|
18
TokenRegistry.sol
Normal file
18
TokenRegistry.sol
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
pragma solidity >=0.6.12;
|
||||||
|
|
||||||
|
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
// File-version: 1
|
||||||
|
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Rename everything to something more generic
|
||||||
|
interface TokenEndorser {
|
||||||
|
function endorsement(bytes32) external view returns ( bytes32 );
|
||||||
|
function tokenIndex(address) external view returns ( uint256 );
|
||||||
|
function endorser(address, uint256) external view returns ( uint256 );
|
||||||
|
function endorserTokenCount(address) external view returns ( uint256 );
|
||||||
|
function tokenSymbolIndex(string memory) external view returns ( address );
|
||||||
|
function tokens(uint256) external view returns ( address );
|
||||||
|
function add(address _token, bytes32 _data) external returns ( bool );
|
||||||
|
}
|
18
TokenRegistryClient.sol
Normal file
18
TokenRegistryClient.sol
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
pragma solidity >=0.6.12;
|
||||||
|
|
||||||
|
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
// File-version: 1
|
||||||
|
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Rename everything to something more generic
|
||||||
|
interface TokenEndorser {
|
||||||
|
function endorsement(bytes32) external view returns ( bytes32 );
|
||||||
|
function tokenIndex(address) external view returns ( uint256 );
|
||||||
|
function endorser(address, uint256) external view returns ( uint256 );
|
||||||
|
function endorserTokenCount(address) external view returns ( uint256 );
|
||||||
|
function tokenSymbolIndex(string memory) external view returns ( address );
|
||||||
|
function tokens(uint256) external view returns ( address );
|
||||||
|
function add(address _token, bytes32 _data) external returns ( bool );
|
||||||
|
}
|
@ -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"}]
|
|
1
abis/ConverterRegistry.json
Normal file
1
abis/ConverterRegistry.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address[]","name":"_anchors","type":"address[]"}],"name":"getConvertersByAnchors","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConvertibleTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_type","type":"uint16"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint32","name":"_maxConversionFee","type":"uint32"},{"internalType":"address[]","name":"_reserveTokens","type":"address[]"},{"internalType":"uint32[]","name":"_reserveWeights","type":"uint32[]"}],"name":"newConverter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}]
|
@ -1 +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
1
abis/Network.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_smartToken","type":"address"},{"indexed":true,"internalType":"address","name":"_fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"_toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_trader","type":"address"}],"name":"Conversion","type":"event"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minReturn","type":"uint256"}],"name":"convert","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rateByPath","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
|
1
abis/Registry.json
Normal file
1
abis/Registry.json
Normal 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 +1 @@
|
|||||||
[{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
|
[{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
|
1
abis/TokenEndorser.json
Normal file
1
abis/TokenEndorser.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"endorsement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"endorser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"endorserTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"tokenSymbolIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
|
1
abis/TokenRegistry.json
Normal file
1
abis/TokenRegistry.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"endorsement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"endorser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"endorserTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"tokenSymbolIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
|
16
calculate_erc165.py
Normal file
16
calculate_erc165.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import sys
|
||||||
|
import web3
|
||||||
|
|
||||||
|
f = open(sys.argv[1], 'r')
|
||||||
|
z = b''
|
||||||
|
for i in range(32):
|
||||||
|
z += b'\x00'
|
||||||
|
while True:
|
||||||
|
l = f.readline()
|
||||||
|
if l == '':
|
||||||
|
break
|
||||||
|
print('line {}'.format(l))
|
||||||
|
h = web3.Web3.keccak(text=l)
|
||||||
|
z = bytes([a ^ b for a, b in zip(h, z)])
|
||||||
|
print(h.hex(), z.hex())
|
||||||
|
f.close()
|
13
util/mergeabis.py
Normal file
13
util/mergeabis.py
Normal 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))
|
Loading…
Reference in New Issue
Block a user