I'm trying to create a contract which calls boolean method on another contract. However, for some reason it doesn't work.
Here is an example:
pragma solidity ^0.4.23;
contract Season {
address[] public requests;
constructor() public {
requests.push(new Request());
}
function getRequestsByFilter() public view returns(bool) {
Request r = Request(requests[0]);
bool ret = r.isMatch();
return ret;
}
}
contract Request {
function isMatch() public pure returns(bool) {
return true;
}
}
It compiles fine but if you call R.foo
from web3.js you get false
instead of true
.
Here is what I see in UI:
I don't understand why it happens and how can I call this method.
Here is smaller example:
pragma solidity ^0.4.23;
contract Season {
function getRequestsByFilter() public returns(bool) {
Request r = new Request();
bool ret = r.isMatch();
return ret;
}
}
contract Request {
function isMatch() public pure returns(bool) {
return true;
}
}
isMatch
function always return true for any input. However, I'm surprised it works for you. I'm running parity 1.9.5 and it doesn't work there. I'm using this OSS plaground.