git.delta.rocks / unique-network / refs/commits / 99e7a932fe6e

difftreelog

source

crates/evm-coder/tests/a.rs1.4 KiBsourcehistory
1#![allow(dead_code)] // This test only checks that macros is not panicking23use evm_coder::{solidity_interface, types::*, ToLog, execution::Result};4use evm_coder_macros::solidity;56#[solidity_interface]7trait OurInterface {8	fn fn_a(&self, input: uint256) -> Result<bool>;9}1011#[solidity_interface]12trait OurInterface1 {13	fn fn_b(&self, input: uint128) -> Result<uint32>;14}1516#[solidity_interface(is(OurInterface), inline_is(OurInterface1), events(ERC721Log))]17trait OurInterface2 {18	#[solidity(rename_selector = "fnK")]19	fn fn_c(&self, input: uint32) -> Result<uint8>;20	fn fn_d(&self, value: uint32) -> Result<uint32>;2122	fn caller_sensitive(&self, caller: caller) -> Result<uint8>;23	fn payable(&mut self, value: value) -> Result<uint8>;24}2526#[derive(ToLog)]27enum ERC721Log {28	Transfer {29		#[indexed]30		from: address,31		#[indexed]32		to: address,33		value: uint256,34	},35	Eee {36		#[indexed]37		aaa: address,38		bbb: uint256,39	},40}4142#[solidity_interface]43trait ERC20 {44	fn decimals(&self) -> Result<uint8>;45	fn balance_of(&self, owner: address) -> Result<uint256>;46	fn transfer(&mut self, caller: caller, to: address, value: uint256) -> Result<bool>;47	fn transfer_from(48		&mut self,49		caller: caller,50		from: address,51		to: address,52		value: uint256,53	) -> Result<bool>;54	fn approve(&mut self, caller: caller, spender: address, value: uint256) -> Result<bool>;55	fn allowance(&self, owner: address, spender: address) -> Result<uint256>;56}