These decorators are pre-defined by ICONService for interacting between SCOREs-users or SCOREs-SCOREs.

eventlog(func=None, *, indexed=0)

Functions with @eventlog decorator will include logs in its TxResult as ‘eventlogs’. If indexed parameter is set in the decorator, designated number of parameters in the order of declaration will be indexed and included in the Bloom filter. Indexed parameters and non-indexed parameters are separately stored in TxResult. Possible data types for function parameters are primitive types (int, str, bytes, bool, Address).

It is recommended to declare a function without implementation body. Even if the function has a body, it does not be executed. When declaring a function, type hinting is a must. Without type hinting, transaction will fail. The default value for the parameter can be set. At most 3 parameters can be indexed, And index can’t exceed the number of parameters(will raise an error).

Parameters:indexed – the number of indexed parameters count(maximum 3)
external(func=None, *, readonly=False)

A decorator for the function whether the function exposes externally. If declared to the function, EOA or another SCORE can call it. These functions are registered on the exportable API list. Any attempt to call a non-external function from outside the contract will fail.

If a function is decorated with ‘readonly’ parameters, i.e., @external(readonly=True), the function will have read-only access to the state DB. This is similar to view keyword in Solidity. If the read-only external function is also decorated with @payable, the function call will fail. Duplicate declaration of @external will raise an exception on import time.

Parameters:readonly – True if the function have read-only access to the state DB.

A decorator for the functions of InterfaceScore.

If other SCORE has the function whose signature is the same as defined with @interface decorator, the function can be invoked via InterfaceScore class instance


A decorator for the external function.

If the decorator is declared to the external function, it can receive the ICXs and process further works for it. If ICXs (msg.value) are passed to a non-payable function, that transaction will fail.