pub trait Nep141Hook<T: Default = ()> {
    fn before_transfer(&mut self, _transfer: &Nep141Transfer) -> T { ... }
    fn after_transfer(&mut self, _transfer: &Nep141Transfer, _state: T) { ... }
}
Expand description

Contracts may implement this trait to inject code into NEP-141 functions.

T is an optional value for passing state between different lifecycle hooks. This may be useful for charging callers for storage usage, for example.

Provided Methods§

Executed before a token transfer is conducted

May return an optional state value which will be passed along to the following after_transfer.

Executed after a token transfer is conducted

Receives the state value returned by before_transfer.

Implementors§