difftreelog
feat regenerate solidity stubs
in: master
15 files changed
.maintain/scripts/compile_stub.shdiffbeforeafterboth--- a/.maintain/scripts/compile_stub.sh
+++ b/.maintain/scripts/compile_stub.sh
@@ -6,9 +6,9 @@
tmp=$(mktemp -d)
cd $tmp
cp $dir/$INPUT input.sol
-solcjs --optimize --bin input.sol
+solcjs --optimize --bin input.sol -o $PWD
mv input_sol_$(basename $OUTPUT .raw).bin out.bin
xxd -r -p out.bin out.raw
-mv out.raw $dir/$OUTPUT
\ No newline at end of file
+mv out.raw $dir/$OUTPUT
.maintain/scripts/generate_api.shdiffbeforeafterboth--- a/.maintain/scripts/generate_api.sh
+++ b/.maintain/scripts/generate_api.sh
@@ -9,4 +9,4 @@
prettier --use-tabs $raw > $formatted
solhint --fix $formatted
-mv $formatted $OUTPUT
\ No newline at end of file
+mv $formatted $OUTPUT
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -8,25 +8,26 @@
.PHONY: regenerate_solidity
regenerate_solidity:
- PACKAGE=pallet-nft NAME=eth::erc::fungible_iface OUTPUT=./tests/src/eth/api/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
- PACKAGE=pallet-nft NAME=eth::erc::nft_iface OUTPUT=./tests/src/eth/api/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
+ PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=./tests/src/eth/api/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
+ PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=./tests/src/eth/api/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=./tests/src/eth/api/ContractHelpers.sol ./.maintain/scripts/generate_api.sh
- PACKAGE=pallet-nft NAME=eth::erc::fungible_impl OUTPUT=./pallets/nft/src/eth/stubs/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
- PACKAGE=pallet-nft NAME=eth::erc::nft_impl OUTPUT=./pallets/nft/src/eth/stubs/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
+ PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=./pallets/fungible/src/stubs/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
+ PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=./pallets/nonfungible/src/stubs/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=./pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol ./.maintain/scripts/generate_api.sh
-NFT_EVM_STUBS=./pallets/nft/src/eth/stubs
+FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs
+NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs
CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/
-$(NFT_EVM_STUBS)/UniqueFungible.raw: $(NFT_EVM_STUBS)/UniqueFungible.sol
+$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw: $(FUNGIBLE_EVM_STUBS)/UniqueFungible.sol
INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh
-$(NFT_EVM_STUBS)/UniqueNFT.raw: $(NFT_EVM_STUBS)/UniqueNFT.sol
+$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw: $(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.sol
INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh
$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw: $(CONTRACT_HELPERS_STUBS)/ContractHelpers.sol
INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh
-evm_stubs: $(NFT_EVM_STUBS)/UniqueFungible.raw $(NFT_EVM_STUBS)/UniqueNFT.raw $(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw
+evm_stubs: $(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw $(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw $(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw
.PHONY: _bench
_bench:
crates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -714,9 +714,9 @@
)*),
};
if is_impl {
- 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());
+ 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());
} else {
- tc.collect("// Common stubs holder\ninterface Dummy {\n}\ninterface ERC165 {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n".into());
+ tc.collect("// Common stubs holder\ninterface Dummy {\n}\ninterface ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n".into());
}
#(
#solidity_generators
pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Common stubs holder7contract Dummy {8 uint8 dummy;9 string stub_error = "this contract is implemented in native";10}1112contract ContractHelpers is Dummy {13 // Selector: contractOwner(address) 5152b14c14 function contractOwner(address contractAddress)15 public16 view17 returns (address)18 {19 require(false, stub_error);20 contractAddress;21 dummy;22 return 0x0000000000000000000000000000000000000000;23 }2425 // Selector: sponsoringEnabled(address) 6027dc6126 function sponsoringEnabled(address contractAddress)27 public28 view29 returns (bool)30 {31 require(false, stub_error);32 contractAddress;33 dummy;34 return false;35 }3637 // Selector: toggleSponsoring(address,bool) fcac6d8638 function toggleSponsoring(address contractAddress, bool enabled) public {39 require(false, stub_error);40 contractAddress;41 enabled;42 dummy = 0;43 }4445 // Selector: setSponsoringRateLimit(address,uint32) 77b6c90846 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)47 public48 {49 require(false, stub_error);50 contractAddress;51 rateLimit;52 dummy = 0;53 }5455 // Selector: getSponsoringRateLimit(address) 610cfabd56 function getSponsoringRateLimit(address contractAddress)57 public58 view59 returns (uint32)60 {61 require(false, stub_error);62 contractAddress;63 dummy;64 return 0;65 }6667 // Selector: allowed(address,address) 5c65816568 function allowed(address contractAddress, address user)69 public70 view71 returns (bool)72 {73 require(false, stub_error);74 contractAddress;75 user;76 dummy;77 return false;78 }7980 // Selector: allowlistEnabled(address) c772ef6c81 function allowlistEnabled(address contractAddress)82 public83 view84 returns (bool)85 {86 require(false, stub_error);87 contractAddress;88 dummy;89 return false;90 }9192 // Selector: toggleAllowlist(address,bool) 36de20f593 function toggleAllowlist(address contractAddress, bool enabled) public {94 require(false, stub_error);95 contractAddress;96 enabled;97 dummy = 0;98 }99100 // Selector: toggleAllowed(address,address,bool) 4706cc1c101 function toggleAllowed(102 address contractAddress,103 address user,104 bool allowed105 ) public {106 require(false, stub_error);107 contractAddress;108 user;109 allowed;110 dummy = 0;111 }112}1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Common stubs holder7contract Dummy {8 uint8 dummy;9 string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13 function supportsInterface(bytes4 interfaceID)14 external15 view16 returns (bool)17 {18 require(false, stub_error);19 interfaceID;20 return true;21 }22}2324contract ContractHelpers is Dummy, ERC165 {25 // Selector: contractOwner(address) 5152b14c26 function contractOwner(address contractAddress)27 public28 view29 returns (address)30 {31 require(false, stub_error);32 contractAddress;33 dummy;34 return 0x0000000000000000000000000000000000000000;35 }3637 // Selector: sponsoringEnabled(address) 6027dc6138 function sponsoringEnabled(address contractAddress)39 public40 view41 returns (bool)42 {43 require(false, stub_error);44 contractAddress;45 dummy;46 return false;47 }4849 // Selector: toggleSponsoring(address,bool) fcac6d8650 function toggleSponsoring(address contractAddress, bool enabled) public {51 require(false, stub_error);52 contractAddress;53 enabled;54 dummy = 0;55 }5657 // Selector: setSponsoringRateLimit(address,uint32) 77b6c90858 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)59 public60 {61 require(false, stub_error);62 contractAddress;63 rateLimit;64 dummy = 0;65 }6667 // Selector: getSponsoringRateLimit(address) 610cfabd68 function getSponsoringRateLimit(address contractAddress)69 public70 view71 returns (uint32)72 {73 require(false, stub_error);74 contractAddress;75 dummy;76 return 0;77 }7879 // Selector: allowed(address,address) 5c65816580 function allowed(address contractAddress, address user)81 public82 view83 returns (bool)84 {85 require(false, stub_error);86 contractAddress;87 user;88 dummy;89 return false;90 }9192 // Selector: allowlistEnabled(address) c772ef6c93 function allowlistEnabled(address contractAddress)94 public95 view96 returns (bool)97 {98 require(false, stub_error);99 contractAddress;100 dummy;101 return false;102 }103104 // Selector: toggleAllowlist(address,bool) 36de20f5105 function toggleAllowlist(address contractAddress, bool enabled) public {106 require(false, stub_error);107 contractAddress;108 enabled;109 dummy = 0;110 }111112 // Selector: toggleAllowed(address,address,bool) 4706cc1c113 function toggleAllowed(114 address contractAddress,115 address user,116 bool allowed117 ) public {118 require(false, stub_error);119 contractAddress;120 user;121 allowed;122 dummy = 0;123 }124}pallets/fungible/Cargo.tomldiffbeforeafterboth--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -18,8 +18,8 @@
pallet-common = { default-features = false, path = '../common' }
nft-data-structs = { default-features = false, path = '../../primitives/nft' }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
+pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
-pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
scale-info = { version = "1.0.0", default-features = false, features = [
"derive",
@@ -36,6 +36,7 @@
"pallet-common/std",
"evm-coder/std",
"ethereum/std",
+ "pallet-evm-coder-substrate/std",
'frame-benchmarking/std',
]
runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -111,7 +111,7 @@
#[solidity_interface(name = "UniqueFungible", is(ERC20))]
impl<T: Config> FungibleHandle<T> {}
-generate_stubgen!(get_impl, UniqueFungibleCall, true);
+generate_stubgen!(gen_impl, UniqueFungibleCall, true);
generate_stubgen!(gen_iface, UniqueFungibleCall, false);
impl<T: Config> CommonEvmHandler for FungibleHandle<T> {
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -9,6 +9,18 @@
string stub_error = "this contract is implemented in native";
}
+contract ERC165 is Dummy {
+ function supportsInterface(bytes4 interfaceID)
+ external
+ view
+ returns (bool)
+ {
+ require(false, stub_error);
+ interfaceID;
+ return true;
+ }
+}
+
// Inline
contract ERC20Events {
event Transfer(address indexed from, address indexed to, uint256 value);
@@ -19,8 +31,7 @@
);
}
-// Inline
-contract InlineNameSymbol is Dummy {
+contract ERC20 is Dummy, ERC165, ERC20Events {
// Selector: name() 06fdde03
function name() public view returns (string memory) {
require(false, stub_error);
@@ -34,29 +45,14 @@
dummy;
return "";
}
-}
-// Inline
-contract InlineTotalSupply is Dummy {
// Selector: totalSupply() 18160ddd
function totalSupply() public view returns (uint256) {
require(false, stub_error);
dummy;
return 0;
}
-}
-contract ERC165 is Dummy {
- // Selector: supportsInterface(bytes4) 01ffc9a7
- function supportsInterface(uint32 interfaceId) public view returns (bool) {
- require(false, stub_error);
- interfaceId;
- dummy;
- return false;
- }
-}
-
-contract ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {
// Selector: decimals() 313ce567
function decimals() public view returns (uint8) {
require(false, stub_error);
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -15,6 +15,18 @@
string stub_error = "this contract is implemented in native";
}
+contract ERC165 is Dummy {
+ function supportsInterface(bytes4 interfaceID)
+ external
+ view
+ returns (bool)
+ {
+ require(false, stub_error);
+ interfaceID;
+ return true;
+ }
+}
+
// Inline
contract ERC721Events {
event Transfer(
@@ -37,43 +49,6 @@
// Inline
contract ERC721MintableEvents {
event MintingFinished();
-}
-
-// Inline
-contract InlineNameSymbol is Dummy {
- // Selector: name() 06fdde03
- function name() public view returns (string memory) {
- require(false, stub_error);
- dummy;
- return "";
- }
-
- // Selector: symbol() 95d89b41
- function symbol() public view returns (string memory) {
- require(false, stub_error);
- dummy;
- return "";
- }
-}
-
-// Inline
-contract InlineTotalSupply is Dummy {
- // Selector: totalSupply() 18160ddd
- function totalSupply() public view returns (uint256) {
- require(false, stub_error);
- dummy;
- return 0;
- }
-}
-
-contract ERC165 is Dummy {
- // Selector: supportsInterface(bytes4) 01ffc9a7
- function supportsInterface(uint32 interfaceId) public view returns (bool) {
- require(false, stub_error);
- interfaceId;
- dummy;
- return false;
- }
}
contract ERC721 is Dummy, ERC165, ERC721Events {
@@ -172,7 +147,7 @@
}
}
-contract ERC721Burnable is Dummy {
+contract ERC721Burnable is Dummy, ERC165 {
// Selector: burn(uint256) 42966c68
function burn(uint256 tokenId) public {
require(false, stub_error);
@@ -181,7 +156,7 @@
}
}
-contract ERC721Enumerable is Dummy, InlineTotalSupply {
+contract ERC721Enumerable is Dummy, ERC165 {
// Selector: tokenByIndex(uint256) 4f6ccce7
function tokenByIndex(uint256 index) public view returns (uint256) {
require(false, stub_error);
@@ -202,9 +177,30 @@
dummy;
return 0;
}
+
+ // Selector: totalSupply() 18160ddd
+ function totalSupply() public view returns (uint256) {
+ require(false, stub_error);
+ dummy;
+ return 0;
+ }
}
-contract ERC721Metadata is Dummy, InlineNameSymbol {
+contract ERC721Metadata is Dummy, ERC165 {
+ // Selector: name() 06fdde03
+ function name() public view returns (string memory) {
+ require(false, stub_error);
+ dummy;
+ return "";
+ }
+
+ // Selector: symbol() 95d89b41
+ function symbol() public view returns (string memory) {
+ require(false, stub_error);
+ dummy;
+ return "";
+ }
+
// Selector: tokenURI(uint256) c87b56dd
function tokenURI(uint256 tokenId) public view returns (string memory) {
require(false, stub_error);
@@ -214,7 +210,7 @@
}
}
-contract ERC721Mintable is Dummy, ERC721MintableEvents {
+contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
// Selector: mintingFinished() 05d2035b
function mintingFinished() public view returns (bool) {
require(false, stub_error);
@@ -253,7 +249,7 @@
}
}
-contract ERC721UniqueExtensions is Dummy {
+contract ERC721UniqueExtensions is Dummy, ERC165 {
// Selector: transfer(address,uint256) a9059cbb
function transfer(address to, uint256 tokenId) public {
require(false, stub_error);
@@ -262,6 +258,14 @@
dummy = 0;
}
+ // Selector: burnFrom(address,uint256) 79cc6790
+ function burnFrom(address from, uint256 tokenId) public {
+ require(false, stub_error);
+ from;
+ tokenId;
+ dummy = 0;
+ }
+
// Selector: nextTokenId() 75794a3c
function nextTokenId() public view returns (uint256) {
require(false, stub_error);
tests/src/eth/api/ContractHelpers.soldiffbeforeafterboth--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -8,7 +8,11 @@
}
-interface ContractHelpers is Dummy {
+interface ERC165 is Dummy {
+ function supportsInterface(bytes4 interfaceID) external view returns (bool);
+}
+
+interface ContractHelpers is Dummy, ERC165 {
// Selector: contractOwner(address) 5152b14c
function contractOwner(address contractAddress)
external
tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -8,6 +8,10 @@
}
+interface ERC165 is Dummy {
+ function supportsInterface(bytes4 interfaceID) external view returns (bool);
+}
+
// Inline
interface ERC20Events {
event Transfer(address indexed from, address indexed to, uint256 value);
@@ -18,27 +22,16 @@
);
}
-// Inline
-interface InlineNameSymbol is Dummy {
+interface ERC20 is Dummy, ERC165, ERC20Events {
// Selector: name() 06fdde03
function name() external view returns (string memory);
// Selector: symbol() 95d89b41
function symbol() external view returns (string memory);
-}
-// Inline
-interface InlineTotalSupply is Dummy {
// Selector: totalSupply() 18160ddd
function totalSupply() external view returns (uint256);
-}
-
-interface ERC165 is Dummy {
- // Selector: supportsInterface(bytes4) 01ffc9a7
- function supportsInterface(uint32 interfaceId) external view returns (bool);
-}
-interface ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {
// Selector: decimals() 313ce567
function decimals() external view returns (uint8);
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -14,6 +14,10 @@
}
+interface ERC165 is Dummy {
+ function supportsInterface(bytes4 interfaceID) external view returns (bool);
+}
+
// Inline
interface ERC721Events {
event Transfer(
@@ -36,26 +40,6 @@
// Inline
interface ERC721MintableEvents {
event MintingFinished();
-}
-
-// Inline
-interface InlineNameSymbol is Dummy {
- // Selector: name() 06fdde03
- function name() external view returns (string memory);
-
- // Selector: symbol() 95d89b41
- function symbol() external view returns (string memory);
-}
-
-// Inline
-interface InlineTotalSupply is Dummy {
- // Selector: totalSupply() 18160ddd
- function totalSupply() external view returns (uint256);
-}
-
-interface ERC165 is Dummy {
- // Selector: supportsInterface(bytes4) 01ffc9a7
- function supportsInterface(uint32 interfaceId) external view returns (bool);
}
interface ERC721 is Dummy, ERC165, ERC721Events {
@@ -103,12 +87,12 @@
returns (address);
}
-interface ERC721Burnable is Dummy {
+interface ERC721Burnable is Dummy, ERC165 {
// Selector: burn(uint256) 42966c68
function burn(uint256 tokenId) external;
}
-interface ERC721Enumerable is Dummy, InlineTotalSupply {
+interface ERC721Enumerable is Dummy, ERC165 {
// Selector: tokenByIndex(uint256) 4f6ccce7
function tokenByIndex(uint256 index) external view returns (uint256);
@@ -117,14 +101,23 @@
external
view
returns (uint256);
+
+ // Selector: totalSupply() 18160ddd
+ function totalSupply() external view returns (uint256);
}
-interface ERC721Metadata is Dummy, InlineNameSymbol {
+interface ERC721Metadata is Dummy, ERC165 {
+ // Selector: name() 06fdde03
+ function name() external view returns (string memory);
+
+ // Selector: symbol() 95d89b41
+ function symbol() external view returns (string memory);
+
// Selector: tokenURI(uint256) c87b56dd
function tokenURI(uint256 tokenId) external view returns (string memory);
}
-interface ERC721Mintable is Dummy, ERC721MintableEvents {
+interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
// Selector: mintingFinished() 05d2035b
function mintingFinished() external view returns (bool);
@@ -142,10 +135,13 @@
function finishMinting() external returns (bool);
}
-interface ERC721UniqueExtensions is Dummy {
+interface ERC721UniqueExtensions is Dummy, ERC165 {
// Selector: transfer(address,uint256) a9059cbb
function transfer(address to, uint256 tokenId) external;
+ // Selector: burnFrom(address,uint256) 79cc6790
+ function burnFrom(address from, uint256 tokenId) external;
+
// Selector: nextTokenId() 75794a3c
function nextTokenId() external view returns (uint256);