Events
待批准的 ERC-1155 事件
ERC-1155:
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;
這兩個函式應該發出哪些事件(以及使用哪些參數)?
這兩個函式不屬於 EIP-1155 ( https://eips.ethereum.org/EIPS/eip-1155 )。實際上,EIP 只定義了:
/** @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 契約的擴展,以允許特定 ID。