function x(uint256 _value) public {
limit += _value;
if(limit >= 5){
myMethod();
limit = 0;
}
}
I have a method like that(x function). if limit is smaller then 5 everything is OK but the last caller (for example contract has 3 and he will send 2-3 value) it will continue to if statement and it will run myMethod(); so the last caller should pay more gas then other callers. myMethod(); is calling another method from another contract with importing and giving contract address. (is it mean more gas?)
I want to do if the code will continue to if statement I want to pay gas fee of myMethod(); Is it possible?
function x(uint256 _value) public {
limit += _value;
if(limit >= 5){
msg.sender = address(this); // or msg.sender = owner;
myMethod();
limit = 0;
}
}
Or can I create automatic function without call on the contract. Directly :
if(limit>=5){
myMethod();
}
Without method, directly call on contract //I know it is not possible but is there any diffrent method for that?