TealScript - How to work with uint64 and uint256 and how to do conversions between them?
Hi, what is the best practice to work with bigints in the tealscript?
for example:
how to properly write this method?
@abi.readonly
multiplier(param1: uint64, param2: uint64,param3: uint64) : uint256{
return param1*param2*param3;
}
currently the build fails with the error
Error: Type mismatch: got uint64 expected uint256
TEALScript can not process ReturnStatement at contracts\contract.algo.ts:463:4
contracts\contract.algo.ts:464: return param1 * param2 * param3;
You need to be explicit with the return type.
@abi.readonly
multiplier(param1: uint64, param2: uint64, param3: uint64): uint256 {
const p1 = param1 as uint256;
const p2 = param2 as uint256;
const p3 = param3 as uint256;
return p1 * p2 * p3;
}