Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, what is principle of cross contract call in wasmi? #733

Closed
lyh169 opened this issue Jun 12, 2023 · 0 comments
Closed

Hi, what is principle of cross contract call in wasmi? #733

lyh169 opened this issue Jun 12, 2023 · 0 comments

Comments

@lyh169
Copy link

lyh169 commented Jun 12, 2023

Hi, what is principle of cross contract call in wasmi?, like this contract, when i call "fn inc(&mut self)", this call opcode is from which "ReturnCallIndirect", "ReturnCall", "ReturnCallIndirect", "CallInternal", "Call", "CallIndirect" ? and by the way the wasmi principle of cross contract call is the same with evm? Thanks

#[ink::contract]
pub mod caller {
    use dyn_traits::Increment;

    /// The caller of the incrementer smart contract.
    #[ink(storage)]
    pub struct Caller {
        /// Here we accept a type which implements the `Incrementer` ink! trait.
        incrementer: ink::contract_ref!(Increment),
    }

    impl Caller {
        /// Creates a new caller smart contract around the `incrementer` account id.
        #[ink(constructor)]
        pub fn new(incrementer: AccountId) -> Self {
            Self {
                incrementer: incrementer.into(),
            }
        }
    }

    impl Increment for Caller {
        #[ink(message)]
        fn inc(&mut self) {
            self.incrementer.inc()
        }

        #[ink(message)]
        fn get(&self) -> u64 {
            self.incrementer.get()
        }
    }
}
@lyh169 lyh169 closed this as completed Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant