git.delta.rocks / unique-network / refs/commits / b11eb43d69dc

difftreelog

feat regenerate solidity stubs

Yaroslav Bolyukin2021-11-02parent: #44992fc.patch.diff
in: master

15 files changed

modified.maintain/scripts/compile_stub.shdiffbeforeafterboth
6tmp=$(mktemp -d)6tmp=$(mktemp -d)
7cd $tmp7cd $tmp
8cp $dir/$INPUT input.sol8cp $dir/$INPUT input.sol
9solcjs --optimize --bin input.sol9solcjs --optimize --bin input.sol -o $PWD
1010
11mv input_sol_$(basename $OUTPUT .raw).bin out.bin11mv input_sol_$(basename $OUTPUT .raw).bin out.bin
12xxd -r -p out.bin out.raw12xxd -r -p out.bin out.raw
modified.maintain/scripts/generate_api.shdiffbeforeafterboth

no syntactic changes

modifiedMakefilediffbeforeafterboth
88
9.PHONY: regenerate_solidity9.PHONY: regenerate_solidity
10regenerate_solidity:10regenerate_solidity:
11 PACKAGE=pallet-nft NAME=eth::erc::fungible_iface OUTPUT=./tests/src/eth/api/UniqueFungible.sol ./.maintain/scripts/generate_api.sh11 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=./tests/src/eth/api/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
12 PACKAGE=pallet-nft NAME=eth::erc::nft_iface OUTPUT=./tests/src/eth/api/UniqueNFT.sol ./.maintain/scripts/generate_api.sh12 PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=./tests/src/eth/api/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
13 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=./tests/src/eth/api/ContractHelpers.sol ./.maintain/scripts/generate_api.sh13 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=./tests/src/eth/api/ContractHelpers.sol ./.maintain/scripts/generate_api.sh
1414
15 PACKAGE=pallet-nft NAME=eth::erc::fungible_impl OUTPUT=./pallets/nft/src/eth/stubs/UniqueFungible.sol ./.maintain/scripts/generate_api.sh15 PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=./pallets/fungible/src/stubs/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
16 PACKAGE=pallet-nft NAME=eth::erc::nft_impl OUTPUT=./pallets/nft/src/eth/stubs/UniqueNFT.sol ./.maintain/scripts/generate_api.sh16 PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=./pallets/nonfungible/src/stubs/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
17 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=./pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol ./.maintain/scripts/generate_api.sh17 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=./pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol ./.maintain/scripts/generate_api.sh
1818
19FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs
19NFT_EVM_STUBS=./pallets/nft/src/eth/stubs20NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs
20CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/21CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/
2122
22$(NFT_EVM_STUBS)/UniqueFungible.raw: $(NFT_EVM_STUBS)/UniqueFungible.sol23$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw: $(FUNGIBLE_EVM_STUBS)/UniqueFungible.sol
23 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh24 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh
24$(NFT_EVM_STUBS)/UniqueNFT.raw: $(NFT_EVM_STUBS)/UniqueNFT.sol25$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw: $(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.sol
25 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh26 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh
26$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw: $(CONTRACT_HELPERS_STUBS)/ContractHelpers.sol27$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw: $(CONTRACT_HELPERS_STUBS)/ContractHelpers.sol
27 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh28 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh
2829
29evm_stubs: $(NFT_EVM_STUBS)/UniqueFungible.raw $(NFT_EVM_STUBS)/UniqueNFT.raw $(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw30evm_stubs: $(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw $(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw $(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw
3031
31.PHONY: _bench32.PHONY: _bench
32_bench:33_bench:
modifiedcrates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth
714 )*),714 )*),
715 };715 };
716 if is_impl {716 if is_impl {
717 tc.collect("// Common stubs holder\ncontract Dummy {\n\tuint8 dummy;\n\tstring stub_error = \"this contract is implemented in native\";\n}\ninterface ERC165 {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool) {\n\t\trequire(false, stub_error);\n\t\tinterfaceID;\n\t\treturn true;\n\t}\n}\n".into());717 tc.collect("// Common stubs holder\ncontract Dummy {\n\tuint8 dummy;\n\tstring stub_error = \"this contract is implemented in native\";\n}\ncontract ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool) {\n\t\trequire(false, stub_error);\n\t\tinterfaceID;\n\t\treturn true;\n\t}\n}\n".into());
718 } else {718 } else {
719 tc.collect("// Common stubs holder\ninterface Dummy {\n}\ninterface ERC165 {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n".into());719 tc.collect("// Common stubs holder\ninterface Dummy {\n}\ninterface ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n".into());
720 }720 }
721 #(721 #(
722 #solidity_generators722 #solidity_generators
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
9 string stub_error = "this contract is implemented in native";9 string stub_error = "this contract is implemented in native";
10}10}
11
12contract ERC165 is Dummy {
13 function supportsInterface(bytes4 interfaceID)
14 external
15 view
16 returns (bool)
17 {
18 require(false, stub_error);
19 interfaceID;
20 return true;
21 }
22}
1123
12contract ContractHelpers is Dummy {24contract ContractHelpers is Dummy, ERC165 {
13 // Selector: contractOwner(address) 5152b14c25 // Selector: contractOwner(address) 5152b14c
14 function contractOwner(address contractAddress)26 function contractOwner(address contractAddress)
15 public27 public
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
18pallet-common = { default-features = false, path = '../common' }18pallet-common = { default-features = false, path = '../common' }
19nft-data-structs = { default-features = false, path = '../../primitives/nft' }19nft-data-structs = { default-features = false, path = '../../primitives/nft' }
20evm-coder = { default-features = false, path = '../../crates/evm-coder' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }
21ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
22pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
22ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
23frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }23frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
24scale-info = { version = "1.0.0", default-features = false, features = [24scale-info = { version = "1.0.0", default-features = false, features = [
25 "derive",25 "derive",
36 "pallet-common/std",36 "pallet-common/std",
37 "evm-coder/std",37 "evm-coder/std",
38 "ethereum/std",38 "ethereum/std",
39 "pallet-evm-coder-substrate/std",
39 'frame-benchmarking/std',40 'frame-benchmarking/std',
40]41]
41runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']42runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
111#[solidity_interface(name = "UniqueFungible", is(ERC20))]111#[solidity_interface(name = "UniqueFungible", is(ERC20))]
112impl<T: Config> FungibleHandle<T> {}112impl<T: Config> FungibleHandle<T> {}
113113
114generate_stubgen!(get_impl, UniqueFungibleCall, true);114generate_stubgen!(gen_impl, UniqueFungibleCall, true);
115generate_stubgen!(gen_iface, UniqueFungibleCall, false);115generate_stubgen!(gen_iface, UniqueFungibleCall, false);
116116
117impl<T: Config> CommonEvmHandler for FungibleHandle<T> {117impl<T: Config> CommonEvmHandler for FungibleHandle<T> {
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
9 string stub_error = "this contract is implemented in native";9 string stub_error = "this contract is implemented in native";
10}10}
11
12contract ERC165 is Dummy {
13 function supportsInterface(bytes4 interfaceID)
14 external
15 view
16 returns (bool)
17 {
18 require(false, stub_error);
19 interfaceID;
20 return true;
21 }
22}
1123
12// Inline24// Inline
13contract ERC20Events {25contract ERC20Events {
19 );31 );
20}32}
21
22// Inline
23contract InlineNameSymbol is Dummy {
24 // Selector: name() 06fdde03
25 function name() public view returns (string memory) {
26 require(false, stub_error);
27 dummy;
28 return "";
29 }
30
31 // Selector: symbol() 95d89b41
32 function symbol() public view returns (string memory) {
33 require(false, stub_error);
34 dummy;
35 return "";
36 }
37}
38
39// Inline
40contract InlineTotalSupply is Dummy {
41 // Selector: totalSupply() 18160ddd
42 function totalSupply() public view returns (uint256) {
43 require(false, stub_error);
44 dummy;
45 return 0;
46 }
47}
48
49contract ERC165 is Dummy {
50 // Selector: supportsInterface(bytes4) 01ffc9a7
51 function supportsInterface(uint32 interfaceId) public view returns (bool) {
52 require(false, stub_error);
53 interfaceId;
54 dummy;
55 return false;
56 }
57}
5833
59contract ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {34contract ERC20 is Dummy, ERC165, ERC20Events {
35 // Selector: name() 06fdde03
36 function name() public view returns (string memory) {
37 require(false, stub_error);
38 dummy;
39 return "";
40 }
41
42 // Selector: symbol() 95d89b41
43 function symbol() public view returns (string memory) {
44 require(false, stub_error);
45 dummy;
46 return "";
47 }
48
49 // Selector: totalSupply() 18160ddd
50 function totalSupply() public view returns (uint256) {
51 require(false, stub_error);
52 dummy;
53 return 0;
54 }
55
60 // Selector: decimals() 313ce56756 // Selector: decimals() 313ce567
61 function decimals() public view returns (uint8) {57 function decimals() public view returns (uint8) {
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
15 string stub_error = "this contract is implemented in native";15 string stub_error = "this contract is implemented in native";
16}16}
17
18contract ERC165 is Dummy {
19 function supportsInterface(bytes4 interfaceID)
20 external
21 view
22 returns (bool)
23 {
24 require(false, stub_error);
25 interfaceID;
26 return true;
27 }
28}
1729
18// Inline30// Inline
19contract ERC721Events {31contract ERC721Events {
39 event MintingFinished();51 event MintingFinished();
40}52}
41
42// Inline
43contract InlineNameSymbol is Dummy {
44 // Selector: name() 06fdde03
45 function name() public view returns (string memory) {
46 require(false, stub_error);
47 dummy;
48 return "";
49 }
50
51 // Selector: symbol() 95d89b41
52 function symbol() public view returns (string memory) {
53 require(false, stub_error);
54 dummy;
55 return "";
56 }
57}
58
59// Inline
60contract InlineTotalSupply is Dummy {
61 // Selector: totalSupply() 18160ddd
62 function totalSupply() public view returns (uint256) {
63 require(false, stub_error);
64 dummy;
65 return 0;
66 }
67}
68
69contract ERC165 is Dummy {
70 // Selector: supportsInterface(bytes4) 01ffc9a7
71 function supportsInterface(uint32 interfaceId) public view returns (bool) {
72 require(false, stub_error);
73 interfaceId;
74 dummy;
75 return false;
76 }
77}
7853
79contract ERC721 is Dummy, ERC165, ERC721Events {54contract ERC721 is Dummy, ERC165, ERC721Events {
80 // Selector: balanceOf(address) 70a0823155 // Selector: balanceOf(address) 70a08231
172 }147 }
173}148}
174149
175contract ERC721Burnable is Dummy {150contract ERC721Burnable is Dummy, ERC165 {
176 // Selector: burn(uint256) 42966c68151 // Selector: burn(uint256) 42966c68
177 function burn(uint256 tokenId) public {152 function burn(uint256 tokenId) public {
178 require(false, stub_error);153 require(false, stub_error);
181 }156 }
182}157}
183158
184contract ERC721Enumerable is Dummy, InlineTotalSupply {159contract ERC721Enumerable is Dummy, ERC165 {
185 // Selector: tokenByIndex(uint256) 4f6ccce7160 // Selector: tokenByIndex(uint256) 4f6ccce7
186 function tokenByIndex(uint256 index) public view returns (uint256) {161 function tokenByIndex(uint256 index) public view returns (uint256) {
187 require(false, stub_error);162 require(false, stub_error);
203 return 0;178 return 0;
204 }179 }
180
181 // Selector: totalSupply() 18160ddd
182 function totalSupply() public view returns (uint256) {
183 require(false, stub_error);
184 dummy;
185 return 0;
186 }
205}187}
206188
207contract ERC721Metadata is Dummy, InlineNameSymbol {189contract ERC721Metadata is Dummy, ERC165 {
190 // Selector: name() 06fdde03
191 function name() public view returns (string memory) {
192 require(false, stub_error);
193 dummy;
194 return "";
195 }
196
197 // Selector: symbol() 95d89b41
198 function symbol() public view returns (string memory) {
199 require(false, stub_error);
200 dummy;
201 return "";
202 }
203
208 // Selector: tokenURI(uint256) c87b56dd204 // Selector: tokenURI(uint256) c87b56dd
209 function tokenURI(uint256 tokenId) public view returns (string memory) {205 function tokenURI(uint256 tokenId) public view returns (string memory) {
214 }210 }
215}211}
216212
217contract ERC721Mintable is Dummy, ERC721MintableEvents {213contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
218 // Selector: mintingFinished() 05d2035b214 // Selector: mintingFinished() 05d2035b
219 function mintingFinished() public view returns (bool) {215 function mintingFinished() public view returns (bool) {
220 require(false, stub_error);216 require(false, stub_error);
253 }249 }
254}250}
255251
256contract ERC721UniqueExtensions is Dummy {252contract ERC721UniqueExtensions is Dummy, ERC165 {
257 // Selector: transfer(address,uint256) a9059cbb253 // Selector: transfer(address,uint256) a9059cbb
258 function transfer(address to, uint256 tokenId) public {254 function transfer(address to, uint256 tokenId) public {
259 require(false, stub_error);255 require(false, stub_error);
262 dummy = 0;258 dummy = 0;
263 }259 }
260
261 // Selector: burnFrom(address,uint256) 79cc6790
262 function burnFrom(address from, uint256 tokenId) public {
263 require(false, stub_error);
264 from;
265 tokenId;
266 dummy = 0;
267 }
264268
265 // Selector: nextTokenId() 75794a3c269 // Selector: nextTokenId() 75794a3c
266 function nextTokenId() public view returns (uint256) {270 function nextTokenId() public view returns (uint256) {
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
88
9}9}
10
11interface ERC165 is Dummy {
12 function supportsInterface(bytes4 interfaceID) external view returns (bool);
13}
1014
11interface ContractHelpers is Dummy {15interface ContractHelpers is Dummy, ERC165 {
12 // Selector: contractOwner(address) 5152b14c16 // Selector: contractOwner(address) 5152b14c
13 function contractOwner(address contractAddress)17 function contractOwner(address contractAddress)
14 external18 external
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
88
9}9}
10
11interface ERC165 is Dummy {
12 function supportsInterface(bytes4 interfaceID) external view returns (bool);
13}
1014
11// Inline15// Inline
12interface ERC20Events {16interface ERC20Events {
18 );22 );
19}23}
20
21// Inline
22interface InlineNameSymbol is Dummy {
23 // Selector: name() 06fdde03
24 function name() external view returns (string memory);
25
26 // Selector: symbol() 95d89b41
27 function symbol() external view returns (string memory);
28}
29
30// Inline
31interface InlineTotalSupply is Dummy {
32 // Selector: totalSupply() 18160ddd
33 function totalSupply() external view returns (uint256);
34}
35
36interface ERC165 is Dummy {
37 // Selector: supportsInterface(bytes4) 01ffc9a7
38 function supportsInterface(uint32 interfaceId) external view returns (bool);
39}
4024
41interface ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {25interface ERC20 is Dummy, ERC165, ERC20Events {
26 // Selector: name() 06fdde03
27 function name() external view returns (string memory);
28
29 // Selector: symbol() 95d89b41
30 function symbol() external view returns (string memory);
31
32 // Selector: totalSupply() 18160ddd
33 function totalSupply() external view returns (uint256);
34
42 // Selector: decimals() 313ce56735 // Selector: decimals() 313ce567
43 function decimals() external view returns (uint8);36 function decimals() external view returns (uint8);
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
1414
15}15}
16
17interface ERC165 is Dummy {
18 function supportsInterface(bytes4 interfaceID) external view returns (bool);
19}
1620
17// Inline21// Inline
18interface ERC721Events {22interface ERC721Events {
38 event MintingFinished();42 event MintingFinished();
39}43}
40
41// Inline
42interface InlineNameSymbol is Dummy {
43 // Selector: name() 06fdde03
44 function name() external view returns (string memory);
45
46 // Selector: symbol() 95d89b41
47 function symbol() external view returns (string memory);
48}
49
50// Inline
51interface InlineTotalSupply is Dummy {
52 // Selector: totalSupply() 18160ddd
53 function totalSupply() external view returns (uint256);
54}
55
56interface ERC165 is Dummy {
57 // Selector: supportsInterface(bytes4) 01ffc9a7
58 function supportsInterface(uint32 interfaceId) external view returns (bool);
59}
6044
61interface ERC721 is Dummy, ERC165, ERC721Events {45interface ERC721 is Dummy, ERC165, ERC721Events {
62 // Selector: balanceOf(address) 70a0823146 // Selector: balanceOf(address) 70a08231
103 returns (address);87 returns (address);
104}88}
10589
106interface ERC721Burnable is Dummy {90interface ERC721Burnable is Dummy, ERC165 {
107 // Selector: burn(uint256) 42966c6891 // Selector: burn(uint256) 42966c68
108 function burn(uint256 tokenId) external;92 function burn(uint256 tokenId) external;
109}93}
11094
111interface ERC721Enumerable is Dummy, InlineTotalSupply {95interface ERC721Enumerable is Dummy, ERC165 {
112 // Selector: tokenByIndex(uint256) 4f6ccce796 // Selector: tokenByIndex(uint256) 4f6ccce7
113 function tokenByIndex(uint256 index) external view returns (uint256);97 function tokenByIndex(uint256 index) external view returns (uint256);
11498
118 view102 view
119 returns (uint256);103 returns (uint256);
104
105 // Selector: totalSupply() 18160ddd
106 function totalSupply() external view returns (uint256);
120}107}
121108
122interface ERC721Metadata is Dummy, InlineNameSymbol {109interface ERC721Metadata is Dummy, ERC165 {
110 // Selector: name() 06fdde03
111 function name() external view returns (string memory);
112
113 // Selector: symbol() 95d89b41
114 function symbol() external view returns (string memory);
115
123 // Selector: tokenURI(uint256) c87b56dd116 // Selector: tokenURI(uint256) c87b56dd
124 function tokenURI(uint256 tokenId) external view returns (string memory);117 function tokenURI(uint256 tokenId) external view returns (string memory);
125}118}
126119
127interface ERC721Mintable is Dummy, ERC721MintableEvents {120interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
128 // Selector: mintingFinished() 05d2035b121 // Selector: mintingFinished() 05d2035b
129 function mintingFinished() external view returns (bool);122 function mintingFinished() external view returns (bool);
130123
142 function finishMinting() external returns (bool);135 function finishMinting() external returns (bool);
143}136}
144137
145interface ERC721UniqueExtensions is Dummy {138interface ERC721UniqueExtensions is Dummy, ERC165 {
146 // Selector: transfer(address,uint256) a9059cbb139 // Selector: transfer(address,uint256) a9059cbb
147 function transfer(address to, uint256 tokenId) external;140 function transfer(address to, uint256 tokenId) external;
141
142 // Selector: burnFrom(address,uint256) 79cc6790
143 function burnFrom(address from, uint256 tokenId) external;
148144
149 // Selector: nextTokenId() 75794a3c145 // Selector: nextTokenId() 75794a3c
150 function nextTokenId() external view returns (uint256);146 function nextTokenId() external view returns (uint256);