# Day10. 使用 javascript 建構 DAO **Published by:** [Samumu.eth](https://paragraph.com/@samumu/) **Published on:** 2022-02-26 **URL:** https://paragraph.com/@samumu/day10-javascript-dao ## Content 撤銷角色如果你還記得,實際上你仍然擁有ERC20合同的"鑄造"權,這意味著如果你願意,你可以去創建更多的代幣,這可能會嚇壞你的DAO的成員。因為你可以去鑄造像十億個代幣給自己。 所以,最好是完全撤銷「鑄造」角色。 這樣,只有投票合約才能鑄造新的代幣。將以下內容添加到scripts/11-revoke-roles.js:import sdk from "./1-initialize-sdk.js"; const tokenModule = sdk.getTokenModule( process.env.TOKEN_MODULE_ADDRESS, ); (async () => { try { console.log( "👀 Roles that exist right now:", await tokenModule.getAllRoleMembers() ); // Revoke all the superpowers your wallet had over the ERC20 contract. await tokenModule.revokeAllRolesFromAddress(process.env.WALLET_ADDRESS); console.log( "🎉 Roles after revoking ourselves", await tokenModule.getAllRoleMembers() ); console.log("✅ Successfully revoked our superpowers from the ERC-20 contract"); } catch (error) { console.error("Failed to revoke ourselves from the DAO treasury", error); } })(); 運行node scripts/11-revoke-roles.js,得到:buildspace-dao-starter % node scripts/11-revoke-roles.js 👀 Roles that exist right now: { admin: [ '0xF79A3bb8d5b93686c4068E2A97eAeC5fE4843E7D' ], minter: [ '0xF79A3bb8d5b93686c4068E2A97eAeC5fE4843E7D', '0xFE667920172882D0695E199b361E94325F0641B6' ], pauser: [ '0xF79A3bb8d5b93686c4068E2A97eAeC5fE4843E7D' ], transfer: [ '0xF79A3bb8d5b93686c4068E2A97eAeC5fE4843E7D' ] } 🎉 Roles after revoking ourselves { admin: [], minter: [ '0xFE667920172882D0695E199b361E94325F0641B6' ], pauser: [], transfer: [] } ✅ Successfully revoked our superpowers from the ERC-20 contract 自定義你的DAO你可以花一些時間自定義一下你的 Web 應用,例如更改一些顏色、更改一些文字,甚至有心力的話也可以延伸一些互動方式與功能,這系列教程是非常基礎的,尤其對於那些學習過 React js 的人來說,但反過來說,因為 thirdWeb 幾乎幫我們做了所有創建、部署合約、與合約互動等所有事,所以我們基本上沒有學到Solidity等合約基礎 也許你覺得慶幸,但這並不是我的主要目的(讓你不用學Solidity, rust 等常見合約語言),我希望各位讀者能透過這系列的實作先了解 Web3 應用的程式架構,大致了解前後端與合約要如何交互,並且透過快速完成一個 DAO 獲得一些更深入學習的動力 ## Publication Information - [Samumu.eth](https://paragraph.com/@samumu/): Publication homepage - [All Posts](https://paragraph.com/@samumu/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@samumu): Subscribe to updates - [Twitter](https://twitter.com/SamumuClan): Follow on Twitter