I want to add multicall for sway farm game

We want to deploy a multicall contract, plant and harvest 10 seed with only 1 button but I keep getting same error and I don’t know how to fix it

Here is my multicall contract


use std::{
    logging::log,
    result::Result,
};

    abi GameContract {
        #[storage(read, write)]
        fn plant_seed_at_index(food_type: FoodType, index: u64);
    }

    pub enum FoodType {
        Tomatoes: (),
    }

    abi Multicall {
        fn plant_all_seeds(indexes: Vec<u64>);
    }

impl Multicall for Contract {

    fn plant_all_seeds(indexes: Vec<u64>) {
        let game = abi(GameContract, 0x4a6914d9ee51445a57cfddf8690eb3f072933925d6cdfa6c1e5f953dd5b8e610);
        let food_type = FoodType::Tomatoes;

        for index in indexes.iter() {
            game.plant_seed_at_index(food_type, index);
        }

    }
}

The error I get is: Function call failed. Error: Log type with logId ‘9629041069892043071’ doesn’t exist in the ABI.
We can call functions without logs but when we want to call a function which is logging something It gives ABI error.

it seems that the Log doesn’t exists in the ABI. Could you please confirm if the ABI is updated and complied with the latest versions?

Why should I add log to ABI? I’m just sending an external call. We kind of solved the problem by adding log ABI content to our multicall-contract-abi.json file but I figured out swayfarm game takes the parameters as msg.sender(). So the msg.sender becomes our multicall contract and that way, It makes it impossible to make an external call to swayfarm contract how we needed with multicall. I wonder can I do it with predicates or something like that?

1 Like

if it accepts msg.sender() as a params, then I don’t think predicates would be useful as predicates are stateless and cant have access to blockchain directly and thus cant have msg.sender. Also, we don’t have delegatecall, so I believe you could maybe load code of the contract with LDC as the simple proxy does it.

Or another way could be to use the proxy contract to make an external calls and the external contract could be modified to accept the sender’s address explicitly as a paramter.

It makes sense. I don’t know If I still want to do that but I will check If I can do that. I appreciate your help.

1 Like