1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
pub use ontio_codegen::base58; pub use ontio_codegen::contract; pub use ontio_codegen::event; #[cfg(test)] mod tests { use crate as ontio_std; use ontio_std::abi::{Decoder, Encoder}; #[derive(Encoder, Decoder)] struct Oep4 { from: u32, to: u32, amt: u32, } #[derive(Encoder, Decoder)] enum Token { Oep4(Oep4), } use ontio_std::prelude::*; #[ontio_std::macros::contract] trait TestContract { fn mut_self(&mut self, owner: Address) -> bool; fn ref_self(&self) -> String; fn multi_param(&mut self, from: Address, to: Address, amount: U128) -> bool; fn ref_param(&mut self, owner: &Address) -> bool; fn slice_param(&mut self, addrs: &[Address]) -> bool; fn mut_param(&mut self, owner: &mut Address) -> bool; fn mut_slice_param(&mut self, owner: &mut [Address]) -> bool; fn str_param(&mut self, owner: &str) -> bool; #[event] fn Event(&self, from: Address, to: Address, amount: U128) {} #[event] fn RefParam(&self, from: &Address, to: Address, amount: U128) {} #[event] fn SliceParam(&self, from: &[Address]) {} } #[test] fn base58() { const _ADDR: Address = ontio_std::macros::base58!("AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM"); } mod notify { use crate as ontio_std; use ontio_std::types::{Address, U128}; #[ontio_std::macros::event] fn transfer(from: &Address, to: &Address, amount: U128) {} #[ontio_std::macros::event] fn transfer_name(from: &Address) {} #[ontio_std::macros::event(name=transfer_test)] fn transfer_name2(from: &Address) {} } #[test] fn event() {} }