{"id":22994306,"url":"https://github.com/jccdex/jcc-moac-multisig-wallet","last_synced_at":"2025-08-13T22:31:35.978Z","repository":{"id":35686586,"uuid":"204195652","full_name":"JCCDex/jcc-moac-multisig-wallet","owner":"JCCDex","description":"Multisig wallet for MOAC","archived":false,"fork":false,"pushed_at":"2023-06-21T23:05:26.000Z","size":2675,"stargazers_count":3,"open_issues_count":16,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-02T07:21:59.934Z","etag":null,"topics":["contract","dapp","moac","multisig","multisig-wallet","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JCCDex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-24T18:18:55.000Z","updated_at":"2019-12-11T02:41:36.000Z","dependencies_parsed_at":"2024-12-15T05:17:57.309Z","dependency_job_id":"3af3e593-c830-4af4-b87c-f1f6a6d4d97e","html_url":"https://github.com/JCCDex/jcc-moac-multisig-wallet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JCCDex/jcc-moac-multisig-wallet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-multisig-wallet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-multisig-wallet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-multisig-wallet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-multisig-wallet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JCCDex","download_url":"https://codeload.github.com/JCCDex/jcc-moac-multisig-wallet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCCDex%2Fjcc-moac-multisig-wallet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270329112,"owners_count":24565770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contract","dapp","moac","multisig","multisig-wallet","solidity"],"created_at":"2024-12-15T05:17:44.499Z","updated_at":"2025-08-13T22:31:35.293Z","avatar_url":"https://github.com/JCCDex.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jcc-moac-multisig-wallet\n\n[![Build Status](https://travis-ci.com/JCCDex/jcc-moac-multisig-wallet.svg?branch=master)](https://travis-ci.com/JCCDex/jcc-moac-multisig-wallet)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\n## DAPP基本功能\n\n1. 管理员只能初始化投票条件、决定是否接受存款以及合约自杀\n2. 锁仓资金从哪里来，提现就回到哪里去，任何人都无权修改钱包地址\n3. 投票人可以就投票生效百分比发起提案并投票\n4. 投票人可以提名新投票人和罢免投票人提案，合约底线是不少于3个投票人，生效不得低于50%\n5. 锁仓人可以在锁仓后发起提现提案，只有投票通过后，才能转移资金\n6. 一旦投票形成决议，任何人都能发起执行，将提案生效，这个过程可以利用预言机机制自动执行\n\n## 合约接口说明\n\n* configOnce 管理员特权，只能在初始化投票人和投票规则时使用一次\n* getStopDeposit/setStopDeposit 获取锁仓标识和设置锁仓标识， 设置只有管理员可以操作，禁止锁仓后，不接受存款\n* createPercentProposal 投票生效百分比规则提案\n* createVoterProposal 报名成为投票人的提案，任何人都可以发起提案申请成为投票人\n* createRecallProposal 罢免投票人的提案，只有投票人才能发起提案\n* createWithdrawProposal 发起提现的提案，只有锁仓的用户才有资格发起\n* voteTopic 投票人投票\n* batchVoteTopic 批量投票，其实就是调用voteTopic,只要有一个投票失败，就立刻返回false，终止批量投票\n* deposit 锁仓\n* getBalance 获取用户的提现额度\n* getDepositBalance/getWithdrawBalance 获取用户的已存款和已提现金额，二者相差即为用户可提现金额\n* getDepositCount/getWithdrawCount 锁仓和提现的钱包数量统计\n* getDepositList/getWithdrawList 锁仓和提现的钱包明细清单\n* getPercent 获取投票生效的百分比规则\n* getVoters/isVoter 获取所有投票人信息/判断自己是否是投票人\n* getVotingCount/getVotedCount 全部待决提案数量/全部已决提案数量\n* getMyVotingCount/getMyVotedCount 我发起的待决提案数量/已决提案数量\n* getAllVotingTopicIds/getAllMyVotingTopicIds 全部待决提案索引/我发起的待决提案索引\n* getVotedTopicIds/getMyVotedTopicIds 已决提案索引/我发起的已决提案索引\n* getTopic 获取提案详细信息\n* getDetailIdxs 获得提案投票详情信息索引\n* getVoteDetail 投票详情\n* getVoteDetailsByTopic 获取指定提案下所有的投票详情信息\n* haveExpire 扫描有无需要执行的待决提案\n* processExpire 处理待决提案，任何人都有权处理，最佳办法是通过预言机执行\n* jccMoacAlarmCallback 墨客预言机回调接口\n* setAlarm 在预言机设置周期任务\n* removeAlarm 在预言机删除周期任务\n\n## 合约流程\n\n1. 创建合约\n2. 管理员调用configureOnce设置初始投票比例、投票人数和投票人\n3. 锁仓人员可以打款\n4. 管理员设置打款结束标志，进入锁仓状态\n5. 在第3步开始投票人可以发起修改投票比例，增选投票人，罢免投票人提案并进行投票表决\n6. 锁仓人员在锁仓状态下才能发起提现提案，供投票人进行表决\n7. 只要提案符合通过标准，任何人都能发起执行\n\n## 合约相关gas消耗清单\n\n参见 [chain3的estimateGas问题](https://github.com/MOACChain/chain3/issues/15)\n\n1. 创建合约大约需要430万\n2. configureOnce初始化有5个参与者，需要25万\n3. deposit需要8.6万\n4. setStopDeposit 需要2.3万\n5. createPercentProposal发起投票百分比提案 22万\n6. createRecallProposal 罢免投票人 24万\n7. createVoterProposal 罢免投票人 24万\n8. createVoterProposal 罢免投票人 24万\n9. voteTopic 投票 14万\n10. processExpire 处理两个提案 14万 处理5个提现请求70万\n11. createWithdrawProposal 21万\n\n以上为实际记录的gas，实际运行时请增加20%比较保险\n\n## truffle提速的技巧\n\n运行 truffle watch\n\n然后在另外一个console运行truffle test，不需要重复编译合约，直接运行测试。\n\n## 合约地址\n\n测试网络: 0x959fe8e1b07ce9b376f8ab76de6bdfae78c25e3a\n\n主网: 0x23d5505451833d70d74d47834ed415329c8a0e96\n\n## 合约部署后的常用配置指令\n\n部署好后，对初始投票人和投票比例做初始化，只能调用一次\n\n```bash\n# 初始化5个钱包作为投票人，表决比例是50%，后续其他的投票人通过发起申请和投票即可当选\njcc_moac_tool --abi JccMoacMultiSig.json --contractAddr \"多签名合约地址\" --method \"configureOnce\" --parameters '5,50,[\"0x780d9da80c427defd49d458b365e0e77808f5086\", \"0x6afc5acd3f1db92e18094e1f6b8a878b27665f51\", \"0xf0fb6874e0da30c8108d3de55c1fec00f82faba2\", \"0x329a1891fba80498525e70d285d39d8091add46e\", \"0x60e78bd0f249125d5c266b5e3ca8ff73da0e7ef6\"]' --gas_limit 280000\n\n\n# 在预言机合约设置多签钱包合约地址为白名单\njcc_moac_tool --abi JccMoacAlarm.json --contractAddr 预言机合约地址 --method \"addContract\" --parameters '\"多签名钱包合约地址\"' --gas_limit 55000\n\n# 在多签名钱包中注册定时任务到预言机合约：周期性任务，300秒执行一次\njcc_moac_tool --abi JccMoacMultiSig.json --contractAddr \"多签名钱包合约地址\" --method \"setAlarm\" --parameters '\"预言机合约地址\",1,300' --gas_limit 200000\n\n# 停止锁仓充值，停止充值后，无法充值，用户可以提出提现的提案；如果允许充值，则禁止发起提现提案\n./src/jcc_moac_tool --abi JccMoacMultiSig.json --contractAddr \"多签名钱包合约地址\" --method \"setStopDeposit\" --parameters true --gas_limit 23000\n\n# 允许充值锁仓\n./src/jcc_moac_tool --abi JccMoacMultiSig.json --contractAddr \"多签名钱包合约地址\" --method \"setStopDeposit\" --parameters false --gas_limit 23000\n\n# 当前投票人列表\njcc_moac_tool --abi JccMoacMultiSig.json --contractAddr \"多签名钱包合约地址\" --method \"getVoters\"\n\n# 发起投票百分比提案\njcc_moac_tool --abi JccMoacMultiSig.json --contractAddr \"多签名钱包合约地址\" --method \"createPercentProposal\" --parameters '提案编号,时间戳,截止时间,百分比' --gas_limit 300000 --keystore keystore文件 --password 口令\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjccdex%2Fjcc-moac-multisig-wallet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjccdex%2Fjcc-moac-multisig-wallet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjccdex%2Fjcc-moac-multisig-wallet/lists"}