Attribute Macro near_sdk::ext_contract

source ·
#[ext_contract]
Expand description

ext_contract takes a Rust Trait and converts it to a module with static methods. Each of these static methods takes positional arguments defined by the Trait, then the receiver_id, the attached deposit and the amount of gas and returns a new Promise.

§Examples

use near_sdk::ext_contract;

#[ext_contract(ext_calculator)]
trait Calculator {
    fn mult(&self, a: u64, b: u64) -> u128;
    fn sum(&self, a: u128, b: u128) -> u128;
}