Skip to content

TokenApproval

A token approval is a record that an address other than the owner of a token balance, has been granted authority to transfer tokens on the owners behalf.

The approved "operator" (or "spender") account might be a smart contract, or another individual.

FireFly provides APIs for initiating and tracking approvals, which token connectors integrate with the implementation of the underlying token.

The off-chain index maintained in FireFly for allowance allows you to quickly find the most recent allowance event associated with a pair of keys, using the subject field, combined with the active field. When a new Token Approval event is delivered to FireFly Core by the Token Connector, any previous approval for the same subject is marked "active": false, and the new approval is marked with "active": true

The token connector is responsible for the format of the subject field to reflect the owner / operator (spender) relationship.

Example

{
    "localId": "1cd3e2e2-dd6a-441d-94c5-02439de9897b",
    "pool": "1244ecbe-5862-41c3-99ec-4666a18b9dd5",
    "connector": "erc20_erc721",
    "key": "0x55860105d6a675dbe6e4d83f67b834377ba677ad",
    "operator": "0x30017fd084715e41aa6536ab777a8f3a2b11a5a1",
    "approved": true,
    "info": {
        "owner": "0x55860105d6a675dbe6e4d83f67b834377ba677ad",
        "spender": "0x30017fd084715e41aa6536ab777a8f3a2b11a5a1",
        "value": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
    },
    "namespace": "ns1",
    "protocolId": "000000000032/000000/000000",
    "subject": "0x55860105d6a675dbe6e4d83f67b834377ba677ad:0x30017fd084715e41aa6536ab777a8f3a2b11a5a1",
    "active": true,
    "created": "2022-05-16T01:23:15Z",
    "tx": {
        "type": "token_approval",
        "id": "4b6e086d-0e31-482d-9683-cd18b2045031"
    }
}

Field Descriptions

Field Name Description Type
localId The UUID of this token approval, in the local FireFly node UUID
pool The UUID the token pool this approval applies to UUID
connector The name of the token connector, as specified in the FireFly core configuration file. Required on input when there are more than one token connectors configured string
key The blockchain signing key for the approval request. On input defaults to the first signing key of the organization that operates the node string
operator The blockchain identity that is granted the approval string
approved Whether this record grants permission for an operator to perform actions on the token balance (true), or revokes permission (false) bool
info Token connector specific information about the approval operation, such as whether it applied to a limited balance of a fungible token. See your chosen token connector documentation for details JSONObject
namespace The namespace for the approval, which must match the namespace of the token pool string
protocolId An alphanumerically sortable string that represents this event uniquely with respect to the blockchain string
subject A string identifying the parties and entities in the scope of this approval, as provided by the token connector string
active Indicates if this approval is currently active (only one approval can be active per subject) bool
message The UUID of a message that has been correlated with this approval using the data field of the approval in a compatible token connector UUID
messageHash The hash of a message that has been correlated with this approval using the data field of the approval in a compatible token connector Bytes32
created The creation time of the token approval FFTime
tx If submitted via FireFly, this will reference the UUID of the FireFly transaction (if the token connector in use supports attaching data) TransactionRef
blockchainEvent The UUID of the blockchain event UUID
config Input only field, with token connector specific configuration of the approval. See your chosen token connector documentation for details JSONObject

TransactionRef

Field Name Description Type
type The type of the FireFly transaction FFEnum:
id The UUID of the FireFly transaction UUID