From e618173d44fb4e57b8c735cb3eda6844de22d930 Mon Sep 17 00:00:00 2001 From: 0xpause Date: Tue, 22 Nov 2022 22:58:22 +0800 Subject: [PATCH] fix stake plugin for compatibility (#218) --- sources/daospaceplugin/StakeToSBTPlugin.move | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sources/daospaceplugin/StakeToSBTPlugin.move b/sources/daospaceplugin/StakeToSBTPlugin.move index a3ef1002..365815b2 100644 --- a/sources/daospaceplugin/StakeToSBTPlugin.move +++ b/sources/daospaceplugin/StakeToSBTPlugin.move @@ -17,6 +17,7 @@ module StarcoinFramework::StakeToSBTPlugin { const ERR_PLUGIN_CONFIG_INIT_REPEATE: u64 = 1005; const ERR_PLUGIN_ITEM_CANT_FOUND: u64 = 1006; const ERR_PLUGIN_NO_MATCH_LOCKTIME: u64 = 1007; + const ERR_DEPRECATED_METHOD: u64 = 1008; struct StakeToSBTPlugin has store, drop {} @@ -120,7 +121,12 @@ module StarcoinFramework::StakeToSBTPlugin { accept_token(AcceptTokenCap {}); } - fun install_event() { + /// Deprecated + public fun install_event() { + abort Errors::deprecated(ERR_DEPRECATED_METHOD) + } + + fun install_event_inner() { if (!DAOSpace::exist_plugin_event()) { let witness = StakeToSBTPlugin {}; let plugin_event_cap = @@ -158,7 +164,7 @@ module StarcoinFramework::StakeToSBTPlugin { weight_vec: Vector::empty>() }); - install_event(); + install_event_inner(); let witness = StakeToSBTPlugin {}; let plugin_event_cap = DAOSpace::acquire_plugin_event_cap(&witness); @@ -222,7 +228,7 @@ module StarcoinFramework::StakeToSBTPlugin { }); stake_list.next_id = id; - install_event(); + install_event_inner(); let witness = StakeToSBTPlugin {}; let plugin_event_cap = DAOSpace::acquire_plugin_event_cap(&witness); @@ -300,7 +306,7 @@ module StarcoinFramework::StakeToSBTPlugin { Account::deposit(member, unstake_item(member, poped_item)); - install_event(); + install_event_inner(); let witness = StakeToSBTPlugin {}; let plugin_event_cap = DAOSpace::acquire_plugin_event_cap(&witness); @@ -431,7 +437,7 @@ module StarcoinFramework::StakeToSBTPlugin { }); }; - install_event(); + install_event_inner(); let witness = StakeToSBTPlugin {}; let plugin_event_cap = DAOSpace::acquire_plugin_event_cap(&witness);