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

Storing the result of an abi() declaration in storage or configurables #5950

Open
Braqzen opened this issue May 2, 2024 · 1 comment
Open

Comments

@Braqzen
Copy link
Contributor

Braqzen commented May 2, 2024

Solidity permits the instantiation and storage of types which can be called directly.
This would be a useful but low priority UX feature for Sway.

use interface::MyExternalContractAbi;
use std::constants::ZERO_B256;

storage {
    target: MyExternalContractAbi = // something here
}

impl MyContract for Contract {
    #[storage(write)]
    fn constructor() {
        storage.target.write(abi(MyExternalContractAbi, ZERO_B256)); 
    }

    #[storage(read)]
    fn call() {
        storage.target.read().call_some_function();
    }
}

Storage may not be a good idea because of read costs but some may want to switch the instance.
Configurables would also be useful.

@Braqzen
Copy link
Contributor Author

Braqzen commented May 2, 2024

This may or may not be a duplicate issue that I would have likely raised some time ago.

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