【问题标题】:Earning a percentage of the transaction fees generated by a smart contract赚取一定比例的智能合约产生的交易费用
【发布时间】:2021-07-31 02:44:13
【问题描述】:

撤销合约的访问密钥后怎么可能?是否有标准的设计模式可以实现这一点?

【问题讨论】:

    标签: nearprotocol


    【解决方案1】:

    我不知道这里有任何“标准设计模式”。一种方法是使用某种方法,只有某些获得许可的帐户才能调用以从智能合约中检索令牌。您可以在该方法中实现您喜欢的任何逻辑,包括每次可以提取多少 NEAR。

    更具体地说,它看起来像

    pub fn claim_owner_rebate(amount: U128) -> Promise {
       assert_eq!(env::predecessor_id(), self.owner_id);
       // do some stuff to check whether this amount can be withdrawn
       // ...
       Promise::new(env::predecessor_id()).transfer(amount)
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-29
      • 2020-05-26
      • 1970-01-01
      • 2022-01-05
      • 2019-01-10
      • 1970-01-01
      相关资源
      最近更新 更多