Skip to content

Commit

Permalink
[dao] Implement DAOSpace (#32)
Browse files Browse the repository at this point in the history
* [genesis_dao] Implement GenesisDao

* Implement Proposal

* Init MemberJoinPlugin

* implement InstallPluginProposalPlugin

* update build

* update build

* Implement DaoAccount and GenesisDao module (#46)

* Implement DaoAccount and GenesisDao module

* Update BuildInfo.yaml

* merge Dao proposal and dao config into genesis dao base code (#47)

Co-authored-by: jolestar <jolestar@gmail.com>

* Update BuildInfo.yaml

* Genesis dao plugin (#49)

* add salary governance

* add salary governance

* Salary governance plugin

* add script tag for plugin functions

* Dao account test (#53)

* Update DaoAccount and write integration test

* update build

* update CI for genesis_dao branch

* Add member event (#55)

* Dao proposal implement (#57)

* dao proposal implementation

* update build files

* fixed merge genesis_dao conflicts

* Genesis dao test (#59)

* [test] Add dao integration test

* fixup

* update build file

* remove XDao module

* checkpoints temp Test (#62)

* Grant plugin (#61)

* add GrantProposalPlugin

* add event struct

* add grant in GenesisDao

* add grant cap

* fix grant plugin

* Rename DaoGrantWithdrawTokenCap

* Add the  plugin code that to convert token to SBT amount (#64)

* Dao proposal test (#66)

* add proposal create and member join test case

* upgrade proof params via rpc raw proofs api

* generate struct tag for dao resource

* add bcs option tuple test case

* add queue proposal action script

* add script signer

* add cast vote scripts

* unify daoT ablity

* fix dao propsosal abort test case

* fix prove (#67)

Co-authored-by: WGB5445 <919603023@qq.com>

* Dao event and get vote info api (#69)

* add dao event and get vote info api

* fix get vote info option when has not vote yet

* no_with_veto counts as no but also adds a veto vote

* event associate with dao id (#71)

* Change some functions into Script methods and fix part of the logic (#65)

* [ Other ] Rename DaoSpace (#72)

* rename DaoSpace

* Fix dir name

* add AnyMemberPlugin Accept

* Rename : DAOSpace

* Rename

Co-authored-by: WGB5445 <WGB98512@163.com>

* Add Grant view and Grant refund  (#73)

* add query_grant

* add refund grant function

* add query_grant_can_withdraw

* add GrantInfo

* [lib] Refactor include source dir

* Fix stake SBT plugin from one stake to multiple stake

* DAOSpace error code (#74)

* [dao] Refactor DAOSpace's error codes

* [refactor] Move VoteStrategy to test dir

* [Feature and test]Add dao_grant test and query_grant_info_total (#76)

* Fixed the problems in PR that relationship between SBT and the staked token

* Add some integration test for StakeToSBTPlugin

* Add some integration test for StakeToSBTPlugin

* Rename Dao to DAO  (#79)

* [daospace] rename Dao to DAO

* update struct tag testcase after change Dao to DAO

* fix test exp

* fix prove and remove Debug print

Co-authored-by: BaiChuan <muzixinly@gmail.com>
Co-authored-by: WGB5445 <919603023@qq.com>

Co-authored-by: Bai Chuan <muzixinly@gmail.com>
Co-authored-by: BobWong <libo.weng@gmail.com>
Co-authored-by: WGB5445 <919603023@qq.com>
Co-authored-by: WGB5445 <WGB98512@163.com>
  • Loading branch information
5 people committed Jul 29, 2022
1 parent d3bb99f commit 0d37c89
Show file tree
Hide file tree
Showing 59 changed files with 5,501 additions and 174 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- main
- genesis_dao

jobs:
build-and-test:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ packages-microsoft-prod.deb

# Move Build Output sources
build/StarcoinFramework/sources/*.move
StarcoinFramework
build/UnitTest

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
Expand Down
38 changes: 37 additions & 1 deletion build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: AccountScripts
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: AnyMemberPlugin
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: Arith
: StarcoinFramework
Expand Down Expand Up @@ -48,6 +51,9 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: Config
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: ConfigProposalPlugin
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: ConsensusConfig
: StarcoinFramework
Expand All @@ -57,6 +63,15 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: CoreAddresses
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: DAOAccount
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: DAORegistry
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: DAOSpace
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: Dao
: StarcoinFramework
Expand Down Expand Up @@ -102,6 +117,9 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: GenesisSignerCapability
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: GrantProposalPlugin
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: Hash
: StarcoinFramework
Expand All @@ -111,12 +129,18 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: IdentifierNFTScripts
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: InstallPluginProposalPlugin
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: LanguageVersion
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: Math
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: MemberProposalPlugin
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: MerkleNFTDistributor
: StarcoinFramework
Expand Down Expand Up @@ -177,6 +201,9 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: Ring
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: SBTVoteStrategy
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: SIP_2
: StarcoinFramework
Expand All @@ -189,6 +216,9 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: STCUSDOracle
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: SalaryGovPlugin
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: SharedEd25519PublicKey
: StarcoinFramework
Expand All @@ -201,6 +231,12 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: Signer
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: SnapshotUtil
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: StakeToSBTPlugin
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: StarcoinVerifier
: StarcoinFramework
Expand Down Expand Up @@ -264,7 +300,7 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: YieldFarmingV2
: StarcoinFramework
source_digest: 9D5BEAD2A40807817B23BF8C474DA0D8ADC2A14B229B1CF06B74F8726614B3F9
source_digest: F9241307430FF1A2E3FD6619CD353E517FA033F5A7F0BC8E8C0A16FBD164E6D5
build_flags:
dev_mode: false
test_mode: false
Expand Down
Binary file modified build/StarcoinFramework/bytecode_modules/BCS.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/Block.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/Genesis.mv
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv
Binary file not shown.
85 changes: 84 additions & 1 deletion build/StarcoinFramework/docs/BCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ published on-chain.
- [Function `to_bytes`](#0x1_BCS_to_bytes)
- [Function `to_address`](#0x1_BCS_to_address)
- [Function `deserialize_option_bytes_vector`](#0x1_BCS_deserialize_option_bytes_vector)
- [Function `deserialize_option_tuple`](#0x1_BCS_deserialize_option_tuple)
- [Function `deserialize_bytes_vector`](#0x1_BCS_deserialize_bytes_vector)
- [Function `deserialize_u64_vector`](#0x1_BCS_deserialize_u64_vector)
- [Function `deserialize_u128_vector`](#0x1_BCS_deserialize_u128_vector)
Expand Down Expand Up @@ -44,6 +45,7 @@ published on-chain.
- [Function `skip_u64`](#0x1_BCS_skip_u64)
- [Function `skip_u32`](#0x1_BCS_skip_u32)
- [Function `skip_u16`](#0x1_BCS_skip_u16)
- [Function `skip_u8`](#0x1_BCS_skip_u8)
- [Function `skip_address`](#0x1_BCS_skip_address)
- [Function `skip_bool`](#0x1_BCS_skip_bool)
- [Function `can_skip`](#0x1_BCS_can_skip)
Expand Down Expand Up @@ -196,6 +198,50 @@ Return the address of key bytes



</details>

<a name="0x1_BCS_deserialize_option_tuple"></a>

## Function `deserialize_option_tuple`



<pre><code><b>public</b> <b>fun</b> <a href="BCS.md#0x1_BCS_deserialize_option_tuple">deserialize_option_tuple</a>(input: &vector&lt;u8&gt;, offset: u64): (<a href="Option.md#0x1_Option_Option">Option::Option</a>&lt;vector&lt;u8&gt;&gt;, <a href="Option.md#0x1_Option_Option">Option::Option</a>&lt;vector&lt;u8&gt;&gt;, u64)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="BCS.md#0x1_BCS_deserialize_option_tuple">deserialize_option_tuple</a>(input: &vector&lt;u8&gt;, offset: u64): (<a href="Option.md#0x1_Option_Option">Option::Option</a>&lt;vector&lt;u8&gt;&gt;, <a href="Option.md#0x1_Option_Option">Option::Option</a>&lt;vector&lt;u8&gt;&gt;, u64) {
<b>let</b> (tag, new_offset) = <a href="BCS.md#0x1_BCS_deserialize_option_tag">deserialize_option_tag</a>(input, offset);
<b>if</b> (!tag) {
<b>return</b> (<a href="Option.md#0x1_Option_none">Option::none</a>&lt;vector&lt;u8&gt;&gt;(), <a href="Option.md#0x1_Option_none">Option::none</a>&lt;vector&lt;u8&gt;&gt;(), new_offset)
} <b>else</b> {
<b>let</b> (bs1, new_offset) = <a href="BCS.md#0x1_BCS_deserialize_bytes">deserialize_bytes</a>(input, new_offset);
<b>let</b> (bs2, new_offset) = <a href="BCS.md#0x1_BCS_deserialize_bytes">deserialize_bytes</a>(input, new_offset);

(<a href="Option.md#0x1_Option_some">Option::some</a>&lt;vector&lt;u8&gt;&gt;(bs1), <a href="Option.md#0x1_Option_some">Option::some</a>&lt;vector&lt;u8&gt;&gt;(bs2), new_offset)
}
}
</code></pre>



</details>

<details>
<summary>Specification</summary>



<pre><code><b>pragma</b> verify = <b>false</b>;
</code></pre>



</details>

<a name="0x1_BCS_deserialize_bytes_vector"></a>
Expand Down Expand Up @@ -840,7 +886,7 @@ Return the address of key bytes


<pre><code><b>fun</b> <a href="BCS.md#0x1_BCS_get_n_bytes">get_n_bytes</a>(input: &vector&lt;u8&gt;, offset: u64, n: u64): vector&lt;u8&gt; {
<b>assert</b>!(((offset + n) &lt;= <a href="Vector.md#0x1_Vector_length">Vector::length</a>(input)) && (offset &lt; offset + n), <a href="Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(<a href="BCS.md#0x1_BCS_ERR_INPUT_NOT_LARGE_ENOUGH">ERR_INPUT_NOT_LARGE_ENOUGH</a>));
<b>assert</b>!(((offset + n) &lt;= <a href="Vector.md#0x1_Vector_length">Vector::length</a>(input)) && (offset &lt;= offset + n), <a href="Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(<a href="BCS.md#0x1_BCS_ERR_INPUT_NOT_LARGE_ENOUGH">ERR_INPUT_NOT_LARGE_ENOUGH</a>));
<b>let</b> i = 0;
<b>let</b> content = <a href="Vector.md#0x1_Vector_empty">Vector::empty</a>&lt;u8&gt;();
<b>while</b> (i &lt; n) {
Expand Down Expand Up @@ -1468,6 +1514,43 @@ Return the address of key bytes



</details>

<a name="0x1_BCS_skip_u8"></a>

## Function `skip_u8`



<pre><code><b>public</b> <b>fun</b> <a href="BCS.md#0x1_BCS_skip_u8">skip_u8</a>(input: &vector&lt;u8&gt;, offset: u64): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="BCS.md#0x1_BCS_skip_u8">skip_u8</a>(input: &vector&lt;u8&gt;, offset: u64): u64 {
<a href="BCS.md#0x1_BCS_can_skip">can_skip</a>(input, offset, 1 );
offset + 1
}
</code></pre>



</details>

<details>
<summary>Specification</summary>



<pre><code><b>pragma</b> verify = <b>false</b>;
</code></pre>



</details>

<a name="0x1_BCS_skip_address"></a>
Expand Down
2 changes: 1 addition & 1 deletion build/StarcoinFramework/docs/Genesis.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ The module for init Genesis
{

};
<a href="StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts_do_upgrade_from_v11_to_v12">StdlibUpgradeScripts::do_upgrade_from_v11_to_v12</a>(&genesis_account);
<a href="StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts_do_upgrade_from_v11_to_v12">StdlibUpgradeScripts::do_upgrade_from_v11_to_v12</a>();
//Start time, <a href="Timestamp.md#0x1_Timestamp_is_genesis">Timestamp::is_genesis</a>() will <b>return</b> <b>false</b>. this call should at the end of genesis init.
<a href="Timestamp.md#0x1_Timestamp_set_time_has_started">Timestamp::set_time_has_started</a>(&genesis_account);
<a href="Account.md#0x1_Account_release_genesis_signer">Account::release_genesis_signer</a>(genesis_account);
Expand Down

0 comments on commit 0d37c89

Please sign in to comment.