I have two functions on contract:
function 1 receives bytes params
variable
function foo1(bytes memory params)
function 2 receives two params: address param1, uint256 param2
function foo2(address param1, uint256 param2)
my goals somehow pass params as bytes to foo1
, decode it on function, and pass decoded params to foo2
like:
function foo2(address param1, uint256 param2) {
// do something
}
function decode(bytes params) private returns(???){
// decode
}
function foo1(bytes params) public {
var decodedParams = fromBytes(params)
foo2(decodedParams.param1, decodedParams.param2)
}
from frontend I expect something like:
const params = toBytes({param1: '0xAddRess', param2: 1})
myContract.foo1(params)