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

Genesis dao plugin #49

Merged
merged 10 commits into from
Jul 1, 2022
Merged

Genesis dao plugin #49

merged 10 commits into from
Jul 1, 2022

Conversation

welbon
Copy link
Contributor

@welbon welbon commented Jun 30, 2022

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Other information

Copy link
Member

@jolestar jolestar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉是不是应该有个 resource 来代表雇佣合同?未来这个 resource 也可以用在金融场景里,比如基于雇佣合同的无抵押贷款。

sources/genesis_dao/GenesisDao.move Outdated Show resolved Hide resolved
Comment on lines 407 to 410
let nft_update_cap = &mut borrow_global_mut<DaoNFTUpdateCapHolder<DaoT>>(dao_address).cap;
let borrow_nft = IdentifierNFT::borrow_out<DaoMember<DaoT>, DaoMemberBody<DaoT>>(nft_update_cap, member_addr);
let nft = IdentifierNFT::borrow_nft_mut(&mut borrow_nft);
let body = NFT::borrow_body_mut_with_cap(nft_update_cap, nft);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉这里应该不需要 mut,但可能有些只读的方法没有提供。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里改好了

DaoT,
ConfigProposalPlugin,
ConfigProposalAction<ConfigT>>(&proposal_cap, &sender, proposal_id);
Config::publish_new_config<ConfigT>(&sender, config);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个配置的 ModifyCapability 会写到 sender 账号下,但这个 sender 可以是任何人,所以这里有问题。感觉这个配置需要写到 Dao 的账号下。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里想过要这样存,但是plugin拿不到Dao账号的signer,或者GenesisDAO提供一个存储配置的接口

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GenesisDao::set_custom_config 增加了一个这样的接口


//assert!(now_seconds() - receive.last_receive_time > config.period,
// Errors::invalid_state(ERR_PLUGIN_RECEIVE_TIME_NOT_REACHED))
sbt * ((Timestamp::now_seconds() - receive.last_receive_time) as u128) / (period as u128)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

工资基于 sbt 计算吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对,工资基于SBT,这里的算法先暂时用个最简单的。

@welbon
Copy link
Contributor Author

welbon commented Jun 30, 2022

  1. 雇佣合同的话,什么样的形式好呢?NFT?里面存一个ifps的链接?
  2. 每个人的工资应该是保密的,目前可能做不到合同和工资的保密性。想到一个方法即sbt存工资的magic number,通过signer和magic number来算出对应的工资,这种办法不知道是否可行?

@jolestar
Copy link
Member

  1. 雇佣合同的话,什么样的形式好呢?NFT?里面存一个ifps的链接?
  2. 每个人的工资应该是保密的,目前可能做不到合同和工资的保密性。想到一个方法即sbt存工资的magic number,通过signer和magic number来算出对应的工资,这种办法不知道是否可行?
  1. 感觉是不可转让的 NFT ?其实不一定要有个或者法律文本合同。
  2. Dao 的工资感觉没办法保密,保密估计要想 layer2 的方案。Dao 里大家都要透明化。

@jolestar
Copy link
Member

jolestar commented Jul 1, 2022

这个我先合并进去,之后看插件放在哪里合适。部分插件可能不需要在 StarcoinFramework 里。

@jolestar jolestar merged commit e3306a6 into genesis_dao Jul 1, 2022
@jolestar jolestar deleted the genesis_dao_plugin branch July 1, 2022 02:07
jolestar added a commit that referenced this pull request Jul 29, 2022
* [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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants