- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下问题:
fungible Token example和 NEP-21本身。
escrow allowances > 0
时可能出现这种情况。 , 但是 account balance = 0
.account_id
存在与否。为什么?它安全吗? inc_allowance/dec_allowance
? let owner_id = env::predecessor_account_id();
将自动创建新帐户,新的托管津贴(如果不存在)。这个逻辑正确吗?为什么?
get_account
总是创建一个新帐户。看起来是多余的。 fn get_account(&self, owner_id: &AccountId) -> Account {
assert!(env::is_valid_account_id(owner_id.as_bytes()), "Owner's account ID is invalid");
let account_hash = env::sha256(owner_id.as_bytes());
self.accounts.get(&account_hash).unwrap_or_else(|| Account::new(account_hash))
}
将为新
owner_id
创建“始终”新帐户.并且有可能永远不会使用该帐户。那么用
get_account
默默地“创建”一个帐户真的很实用吗? ?
transfer_from
从不检查 owner_id
作为帐户的真正所有者。是否有逻辑来保护仅由真实所有者进行的转让? 最佳答案
It's a possible situation when escrow allowances > 0, but account balance = 0. Is it legal flow and why?
It never checks account_id exists or not. Why? Is it secure?
Anyone can call: inc_allowance/dec_allowance?
And for let owner_id = env::predecessor_account_id(); will be created new account, new escrow allowance automatically (if not exist). Is that logic correct and why?
get_account always created a new account. It looks redundant.
transfer_from is never check owner_id as the real owner of the account. Is there logic to protect transferring only by real owners?
env::predecessor_account_id()
应该等于
owner_id
.因此,收据/交易必须是从所有者的帐户发送的。
Why fungible token doesn't have a name/title?
Do the NEAR Protocol have some standard or logic for Fungible Tokens exchange?
关于smartcontracts - NEAR 协议(protocol)可替代代币逻辑 NEP-21,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66144719/
我是一名优秀的程序员,十分优秀!