diff --git a/docs-sphinx/index.rst b/docs-sphinx/index.rst index 19d912b311..892183435b 100644 --- a/docs-sphinx/index.rst +++ b/docs-sphinx/index.rst @@ -55,6 +55,7 @@ Welcome to AElf's official documentation! Smart Contract API Acs Introduction Command-line Interface + Smart Contract .. toctree:: diff --git a/docs-sphinx/reference/smart-contract/association-contract.md b/docs-sphinx/reference/smart-contract/association-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/configuration-contract.md b/docs-sphinx/reference/smart-contract/configuration-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/consensus-contract.md b/docs-sphinx/reference/smart-contract/consensus-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/cross-chain-contract.md b/docs-sphinx/reference/smart-contract/cross-chain-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/economic-contract.md b/docs-sphinx/reference/smart-contract/economic-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/election-contract.md b/docs-sphinx/reference/smart-contract/election-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/genesis-contract.md b/docs-sphinx/reference/smart-contract/genesis-contract.md new file mode 100644 index 0000000000..bef5c225ed --- /dev/null +++ b/docs-sphinx/reference/smart-contract/genesis-contract.md @@ -0,0 +1,28 @@ +# Overview + +Genesis Contract, also known as the Zero Contract, is mainly used to deploy and maintain smart contracts running on the aelf blockchain. + +# Deploy and update contracts + +There is a critical data structure defined in `aelf/core.proto`, called SmartContractRegistration: + +```C# +message SmartContractRegistration { + // The category of contract code(0: C#). + sint32 category = 1; + // The byte array of the contract code. + bytes code = 2; + // The hash of the contract code. + Hash code_hash = 3; + // Whether it is a system contract. + bool is_system_contract = 4; + // The version of the current contract. + int32 version = 5; + // The version of the contract. + string contract_version = 6; + // The address of the current contract. + Address contract_address = 7; + // Indicates if the contract is the user contract. + bool is_user_contract = 8; +} +``` diff --git a/docs-sphinx/reference/smart-contract/index.rst b/docs-sphinx/reference/smart-contract/index.rst new file mode 100644 index 0000000000..2fd7f01985 --- /dev/null +++ b/docs-sphinx/reference/smart-contract/index.rst @@ -0,0 +1,28 @@ +Smart Contract +=================== + +This section gives the usages, explanations, and implementations of current +system contracts. It’s not meant to be exhaustive. With some useful methods +we give the demo code of interaction, these demos will be useful during +developing user contracts. + + +.. toctree:: + :caption: Smart Contract + :maxdepth: 1 + + Genesis Contract + Consensus Contract + Multi Token Contract + Cross chain Contract + Vote Contract + Profit Contract + Election Contract + Association Contract + Referendum Contract + Parliament Contract + Treasury Contract + Token Holder Contract + Economic Contract + Token Convert Contract + Configuration Contract diff --git a/docs-sphinx/reference/smart-contract/multi-token-contract.md b/docs-sphinx/reference/smart-contract/multi-token-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/parliament-contract.md b/docs-sphinx/reference/smart-contract/parliament-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/profit-contract.md b/docs-sphinx/reference/smart-contract/profit-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/referendum-contract.md b/docs-sphinx/reference/smart-contract/referendum-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/token-convert-contract.md b/docs-sphinx/reference/smart-contract/token-convert-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/token-holder-contract.md b/docs-sphinx/reference/smart-contract/token-holder-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/treasury-contract.md b/docs-sphinx/reference/smart-contract/treasury-contract.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs-sphinx/reference/smart-contract/vote-contract.md b/docs-sphinx/reference/smart-contract/vote-contract.md new file mode 100644 index 0000000000..e69de29bb2