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

feat: add a mock_call_with to mock a call with associated calldata #2419

Open
enitrat opened this issue Aug 29, 2024 · 0 comments
Open

feat: add a mock_call_with to mock a call with associated calldata #2419

enitrat opened this issue Aug 29, 2024 · 0 comments
Labels
feature New feature request/description new snforge

Comments

@enitrat
Copy link
Contributor

enitrat commented Aug 29, 2024

Which component is your feature related to?

Forge

Feature Request

Today I can mock the returndata of a contract address call, but I cannot specify for which calldata a specific returndata should be returned.

    // Today: will mock all calls to the `storage` entrypoint of `contract_starknet_address`
    start_mock_call::<u256>(contract_starknet_address, selector!("storage"), 0);

What I would like:

let key:u256 = 0xabcd;
let calldata = array![]; 
Serde::serialize(@key, ref calldata);
start_mock_call_with::<u256>(contract_starknet_address, selector!("storage"), calldata.span(), 0);

That allows me to return different values based on the key that I'm querying

@github-actions github-actions bot added the new label Aug 29, 2024
@piotmag769 piotmag769 added snforge feature New feature request/description labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request/description new snforge
Projects
Status: New
Development

No branches or pull requests

2 participants