首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ERC-1155项活动有待批准

ERC-1155项活动有待批准
EN

Ethereum用户
提问于 2020-10-11 02:10:47
回答 2查看 667关注 0票数 1

ERC-1155:

代码语言:javascript
复制
    function approve(address _spender, uint256 _id, uint256 _currentValue, uint256 _value) external;

    /**
        @dev Allow other accounts/contracts to spend tokens on behalf of msg.sender
        Also, to minimize the risk of the approve/transferFrom attack vector
        (see https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/), this function will throw if the current approved allowance does not equal the expected _currentValue, unless _value is 0
        @param _spender        Address to approve
        @param _ids            IDs of the CryptoItems
        @param _currentValues  Expected current values of allowances per item type
        @param _values         Allowance amounts per item type
    */
    function batchApprove(address _spender, uint256[] calldata _ids, uint256[] calldata _currentValues, uint256[] calldata _values) external;

这两个函数应该发出哪些事件(以及使用哪些参数)?

EN

回答 2

Ethereum用户

回答已采纳

发布于 2021-01-08 12:52:54

这两个功能不是EIP-1155 (https://eips.ethereum.org/EIPS/eip-1155)的一部分.事实上,EIP只定义了:

代码语言:javascript
复制
    /**
    @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
    @dev MUST emit the ApprovalForAll event on success.
    @param _operator  Address to add to the set of authorized operators
    @param _approved  True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;

但是,您提到的方法approve已经实现了这里,作为对ERC1155契约的扩展,以便允许特定Ids使用。

票数 3
EN

Ethereum用户

发布于 2021-08-24 19:04:07

ERC-1155规范推荐EIP-1761作用域审批接口作为允许特定令牌批准的方法:https://eips.ethereum.org/EIPS/eip-1761

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/88250

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档