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

export-abi differs from Solidity in terms of state mutability of functions emitting log #26

Open
afosan opened this issue Jan 27, 2024 · 0 comments

Comments

@afosan
Copy link
Contributor

afosan commented Jan 27, 2024

It seems abis generated by export-abi command can have pure or view state mutability for functions emitting a log (which would be state changing, payable or nonpayable, in Solidity).

I have created a minimal example here. Copy pasting the relevant parts below as well.

Contract functions.

#[external]
impl Contract {
    pub fn with_mutable_reference_to_self(&mut self) -> Result<(), Vec<u8>> {
        evm::log(Event {});
        Ok(())
    }

    pub fn with_reference_to_self(&self) -> Result<(), Vec<u8>> {
        evm::log(Event {});
        Ok(())
    }

    pub fn without_self() -> Result<(), Vec<u8>> {
        evm::log(Event {});
        Ok(())
    }
}

Output of cargo stylus export-abi.

interface IContract {
    function withMutableReferenceToSelf() external;

    function withReferenceToSelf() external view;

    function withoutSelf() external pure;
}
@afosan afosan changed the title export-abi differs from Solidity in terms of state mutability of functions emitting log export-abi differs from Solidity in terms of state mutability of functions emitting log Jan 27, 2024
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