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;

Which events (and with which arguments) should these two functions emit?


These two functions are not part of the EIP-1155 (https://eips.ethereum.org/EIPS/eip-1155). In fact, the EIP only defines :

    @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;

However, the method approve you mentioned has been implemented here as an extension to the ERC1155 contract to enable allowance for specific Ids.


The ERC-1155 specification recommends EIP-1761 Scoped Approval Interface as a method to allow specific token approvals: https://eips.ethereum.org/EIPS/eip-1761

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.