📢 Gate廣場獨家活動: #PUBLIC创作大赛# 正式開啓!
參與 Gate Launchpool 第 297 期 — PublicAI (PUBLIC),並在 Gate廣場發布你的原創內容,即有機會瓜分 4,000 枚 $PUBLIC 獎勵池!
🎨 活動時間
2025年8月18日 10:00 – 2025年8月22日 16:00 (UTC)
📌 參與方式
在 Gate廣場發布與 PublicAI (PUBLIC) 或當前 Launchpool 活動相關的原創內容
內容需不少於 100 字(可爲分析、教程、創意圖文、測評等)
添加話題: #PUBLIC创作大赛#
帖子需附帶 Launchpool 參與截圖(如質押記錄、領取頁面等)
🏆 獎勵設置(總計 4,000 枚 $PUBLIC)
🥇 一等獎(1名):1,500 $PUBLIC
🥈 二等獎(3名):每人 500 $PUBLIC
🥉 三等獎(5名):每人 200 $PUBLIC
📋 評選標準
內容質量(相關性、清晰度、創意性)
互動熱度(點讚、評論)
含有 Launchpool 參與截圖的帖子將優先考慮
📄 注意事項
所有內容須爲原創,嚴禁抄襲或虛假互動
獲獎用戶需完成 Gate廣場實名認證
Gate 保留本次活動的最終解釋權
Sputnik-DAO工廠合約: 統一創建與管理DAO實例的核心機制
Sputnik-DAO 工廠合約解析
Sputnik-DAO採用創建型工廠設計模式實現了該平台下去中心化自治組織(DAO)的統一創建與管理。本文將詳細介紹Sputnik-DAO平台工廠模式(sputnikdao-factory)的設計實現。
1. 工廠合約結構
工廠合約狀態主要由兩部分組成:
rust pub struct SputnikDAOFactory { factory_manager: FactoryManager, daos: UnorderedSet, }
2. 創建DAO
創建DAO實例使用create()方法:
rust #[payable] pub fn create(&mut self, name: AccountId, args: Base64VecU8) { // 構造DAO帳戶地址 let account_id: AccountId = format!("{}.{}", name, env::current_account_id()) .parse() .unwrap();
}
factory_manager.create_contract的主要步驟:
回調函數on_create的處理:
3. 更新DAO
工廠合約提供update()接口更新DAO:
rust pub fn update(&self, account_id: AccountId, code_hash: Base58CryptoHash) { let caller_id = env::predecessor_account_id(); assert!( caller_id == self.get_owner() || caller_id == account_id, "Must be updated by the factory owner or the DAO itself" ); assert!( self.daos.contains(&account_id), "Must be contract created by factory" ); self.factory_manager .update_contract(account_id, code_hash, "update"); }
update_contract()會調用DAO合約的update()函數進行升級。
4. 安全性分析
Sputnik-DAO工廠合約通過權限控制、錯誤處理等機制保證了合約的安全性。