git.delta.rocks / unique-network / refs/commits / d412fe4701e1

difftreelog

source

crates/evm-coder/tests/a.rs1.6 KiBsourcehistory
1#![allow(dead_code)] // This test only checks that macros is not panicking23use evm_coder::{solidity_interface, types::*, ToLog};4use evm_coder_macros::solidity;56#[solidity_interface]7trait OurInterface {8	type Error;9	fn fn_a(&self, input: uint256) -> Result<bool, Self::Error>;10}1112#[solidity_interface]13trait OurInterface1 {14	type Error;15	fn fn_b(&self, input: uint128) -> Result<uint32, Self::Error>;16}1718#[solidity_interface(is(OurInterface), inline_is(OurInterface1), events(ERC721Log))]19trait OurInterface2 {20	type Error;21	#[solidity(rename_selector = "fnK")]22	fn fn_c(&self, input: uint32) -> Result<uint8, Self::Error>;23	fn fn_d(&self, value: uint32) -> Result<uint32, Self::Error>;2425	fn caller_sensitive(&self, caller: caller) -> Result<uint8, Self::Error>;26	fn payable(&mut self, value: value) -> Result<uint8, Self::Error>;27}2829#[derive(ToLog)]30enum ERC721Log {31	Transfer {32		#[indexed]33		from: address,34		#[indexed]35		to: address,36		value: uint256,37	},38	Eee {39		#[indexed]40		aaa: address,41		bbb: uint256,42	},43}4445#[solidity_interface]46trait ERC20 {47	type Error;4849	fn decimals(&self) -> Result<uint8, Self::Error>;50	fn balance_of(&self, owner: address) -> Result<uint256, Self::Error>;51	fn transfer(52		&mut self,53		caller: caller,54		to: address,55		value: uint256,56	) -> Result<bool, Self::Error>;57	fn transfer_from(58		&mut self,59		caller: caller,60		from: address,61		to: address,62		value: uint256,63	) -> Result<bool, Self::Error>;64	fn approve(65		&mut self,66		caller: caller,67		spender: address,68		value: uint256,69	) -> Result<bool, Self::Error>;70	fn allowance(&self, owner: address, spender: address) -> Result<uint256, Self::Error>;71}