Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOON-1868] pre-define solidity contract instances and address #1861

Merged
merged 4 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions precompiles/proxy/Proxy.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.3;

/// @dev The Proxy contract's address.
address constant PROXY_ADDRESS = 0x000000000000000000000000000000000000080b;

/// @dev The Proxy contract's instance.
Proxy constant PROXY_CONTRACT = Proxy(PROXY_ADDRESS);

/// @author The Moonbeam Team
/// @title Pallet Proxy Interface
/// @title The interface through which solidity contracts will interact with the Proxy pallet
Expand Down
74 changes: 71 additions & 3 deletions tests/contracts/compiled/Collective.json

Large diffs are not rendered by default.

70 changes: 69 additions & 1 deletion tests/contracts/compiled/CollectivePrecompile.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions tests/contracts/compiled/Democracy.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/contracts/compiled/Proxy.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@
}
},
"ewasm": { "wasm": "" },
"metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"enum Proxy.ProxyType\",\"name\":\"proxyType\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"addProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"real\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"enum Proxy.ProxyType\",\"name\":\"proxyType\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"isProxy\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"exists\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"removeProxies\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"enum Proxy.ProxyType\",\"name\":\"proxyType\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"removeProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Moonbeam Team\",\"custom:address\":\"0x000000000000000000000000000000000000080b\",\"kind\":\"dev\",\"methods\":{\"addProxy(address,uint8,uint32)\":{\"custom:selector\":\"74a34dd3\",\"details\":\"Register a proxy account for the sender that is able to make calls on its behalf\",\"params\":{\"delay\":\"The announcement period required of the initial proxy, will generally be zero\",\"delegate\":\"The account that the caller would like to make a proxy\",\"proxyType\":\"The permissions allowed for this proxy account\"}},\"isProxy(address,address,uint8,uint32)\":{\"custom:selector\":\"e26d38ed\",\"details\":\"Checks if the caller has an account proxied with a given proxy type\",\"params\":{\"delay\":\"The announcement period required of the initial proxy, will generally be zero\",\"delegate\":\"The account that the caller has maybe proxied\",\"proxyType\":\"The permissions allowed for the proxy\",\"real\":\"The real account that maybe has a proxy\"},\"returns\":{\"exists\":\"True if a proxy exists, False otherwise\"}},\"removeProxies()\":{\"custom:selector\":\"14a5b5fa\",\"details\":\"Unregister all proxy accounts for the sender\"},\"removeProxy(address,uint8,uint32)\":{\"custom:selector\":\"fef3f708\",\"details\":\"Register a proxy account for the sender that is able to make calls on its behalf\",\"params\":{\"delay\":\"The announcement period required of the initial proxy, will generally be zero\",\"delegate\":\"The account that the caller would like to remove as a proxy\",\"proxyType\":\"The permissions currently enabled for the removed proxy account\"}}},\"title\":\"Pallet Proxy InterfaceThe interface through which solidity contracts will interact with the Proxy pallet\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"main.sol\":\"Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"main.sol\":{\"keccak256\":\"0xbc6d6095525dcc50a9476c22106a02824f5490b405926756bf083705c5e4761b\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://495a59fc9f5a9b55ace6b413dc9125e104b244ba29efd763a8f6d28080c468c4\",\"dweb:/ipfs/QmXPcF7T6AahNSWir61rQTZQt4q7tUYhrG3kwuGufdmo7b\"]}},\"version\":1}",
"metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"enum Proxy.ProxyType\",\"name\":\"proxyType\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"addProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"real\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"enum Proxy.ProxyType\",\"name\":\"proxyType\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"isProxy\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"exists\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"removeProxies\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"enum Proxy.ProxyType\",\"name\":\"proxyType\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"removeProxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Moonbeam Team\",\"custom:address\":\"0x000000000000000000000000000000000000080b\",\"kind\":\"dev\",\"methods\":{\"addProxy(address,uint8,uint32)\":{\"custom:selector\":\"74a34dd3\",\"details\":\"Register a proxy account for the sender that is able to make calls on its behalf\",\"params\":{\"delay\":\"The announcement period required of the initial proxy, will generally be zero\",\"delegate\":\"The account that the caller would like to make a proxy\",\"proxyType\":\"The permissions allowed for this proxy account\"}},\"isProxy(address,address,uint8,uint32)\":{\"custom:selector\":\"e26d38ed\",\"details\":\"Checks if the caller has an account proxied with a given proxy type\",\"params\":{\"delay\":\"The announcement period required of the initial proxy, will generally be zero\",\"delegate\":\"The account that the caller has maybe proxied\",\"proxyType\":\"The permissions allowed for the proxy\",\"real\":\"The real account that maybe has a proxy\"},\"returns\":{\"exists\":\"True if a proxy exists, False otherwise\"}},\"removeProxies()\":{\"custom:selector\":\"14a5b5fa\",\"details\":\"Unregister all proxy accounts for the sender\"},\"removeProxy(address,uint8,uint32)\":{\"custom:selector\":\"fef3f708\",\"details\":\"Register a proxy account for the sender that is able to make calls on its behalf\",\"params\":{\"delay\":\"The announcement period required of the initial proxy, will generally be zero\",\"delegate\":\"The account that the caller would like to remove as a proxy\",\"proxyType\":\"The permissions currently enabled for the removed proxy account\"}}},\"title\":\"Pallet Proxy InterfaceThe interface through which solidity contracts will interact with the Proxy pallet\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"main.sol\":\"Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"main.sol\":{\"keccak256\":\"0x52d1150af1b55f675eca17a80de77376dd2ff5c0a026f39f1e4c2f7a35c2fcda\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://ba66313ca6068b411ca1cd567a4cb72695d165f5c2cee033250fea8c4e745706\",\"dweb:/ipfs/QmWpArcumx5vByd7TPcNQ9WqdTQChCQSkHS9xpKWpt397v\"]}},\"version\":1}",
"storageLayout": { "storage": [], "types": null },
"userdoc": { "kind": "user", "methods": {}, "version": 1 }
},
"sourceCode": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.3;\n\n/// @author The Moonbeam Team\n/// @title Pallet Proxy Interface\n/// @title The interface through which solidity contracts will interact with the Proxy pallet\n/// @custom:address 0x000000000000000000000000000000000000080b\ninterface Proxy {\n /// @dev Defines the proxy permission types.\n /// The values start at `0` (most permissive) and are represented as `uint8`\n enum ProxyType {\n Any,\n NonTransfer,\n Governance,\n Staking,\n CancelProxy,\n Balances,\n AuthorMapping,\n IdentityJudgement\n }\n\n /// @dev Register a proxy account for the sender that is able to make calls on its behalf\n /// @custom:selector 74a34dd3\n /// @param delegate The account that the caller would like to make a proxy\n /// @param proxyType The permissions allowed for this proxy account\n /// @param delay The announcement period required of the initial proxy, will generally be zero\n function addProxy(\n address delegate,\n ProxyType proxyType,\n uint32 delay\n ) external;\n\n /// @dev Register a proxy account for the sender that is able to make calls on its behalf\n /// @custom:selector fef3f708\n /// @param delegate The account that the caller would like to remove as a proxy\n /// @param proxyType The permissions currently enabled for the removed proxy account\n /// @param delay The announcement period required of the initial proxy, will generally be zero\n function removeProxy(\n address delegate,\n ProxyType proxyType,\n uint32 delay\n ) external;\n\n /// @dev Unregister all proxy accounts for the sender\n /// @custom:selector 14a5b5fa\n function removeProxies() external;\n\n /// @dev Checks if the caller has an account proxied with a given proxy type\n /// @custom:selector e26d38ed\n /// @param real The real account that maybe has a proxy\n /// @param delegate The account that the caller has maybe proxied\n /// @param proxyType The permissions allowed for the proxy\n /// @param delay The announcement period required of the initial proxy, will generally be zero\n /// @return exists True if a proxy exists, False otherwise\n function isProxy(\n address real,\n address delegate,\n ProxyType proxyType,\n uint32 delay\n ) external view returns (bool exists);\n}\n"
"sourceCode": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.3;\n\naddress constant PROXY_ADDRESS = 0x000000000000000000000000000000000000080b;\nProxy constant PROXY_CONTRACT = Proxy(PROXY_ADDRESS);\n\n/// @author The Moonbeam Team\n/// @title Pallet Proxy Interface\n/// @title The interface through which solidity contracts will interact with the Proxy pallet\n/// @custom:address 0x000000000000000000000000000000000000080b\ninterface Proxy {\n /// @dev Defines the proxy permission types.\n /// The values start at `0` (most permissive) and are represented as `uint8`\n enum ProxyType {\n Any,\n NonTransfer,\n Governance,\n Staking,\n CancelProxy,\n Balances,\n AuthorMapping,\n IdentityJudgement\n }\n\n /// @dev Register a proxy account for the sender that is able to make calls on its behalf\n /// @custom:selector 74a34dd3\n /// @param delegate The account that the caller would like to make a proxy\n /// @param proxyType The permissions allowed for this proxy account\n /// @param delay The announcement period required of the initial proxy, will generally be zero\n function addProxy(\n address delegate,\n ProxyType proxyType,\n uint32 delay\n ) external;\n\n /// @dev Register a proxy account for the sender that is able to make calls on its behalf\n /// @custom:selector fef3f708\n /// @param delegate The account that the caller would like to remove as a proxy\n /// @param proxyType The permissions currently enabled for the removed proxy account\n /// @param delay The announcement period required of the initial proxy, will generally be zero\n function removeProxy(\n address delegate,\n ProxyType proxyType,\n uint32 delay\n ) external;\n\n /// @dev Unregister all proxy accounts for the sender\n /// @custom:selector 14a5b5fa\n function removeProxies() external;\n\n /// @dev Checks if the caller has an account proxied with a given proxy type\n /// @custom:selector e26d38ed\n /// @param real The real account that maybe has a proxy\n /// @param delegate The account that the caller has maybe proxied\n /// @param proxyType The permissions allowed for the proxy\n /// @param delay The announcement period required of the initial proxy, will generally be zero\n /// @return exists True if a proxy exists, False otherwise\n function isProxy(\n address real,\n address delegate,\n ProxyType proxyType,\n uint32 delay\n ) external view returns (bool exists);\n}\n"
}
17,066 changes: 8,127 additions & 8,939 deletions tests/contracts/compiled/ProxyLeaderDemo.json

Large diffs are not rendered by default.

Loading