Teloscan read and write contract should handle tuple parameters for contracts that require them.
Teloscan Read and Write Contract Should Handle Tuple Parameters for Contracts that Require Them
Problem:
I've been trying out the prerelease Teloscan a bit and noticed a few issues.
Similar to the old version, it seems Teloscan can't handle tuple parameters when performing Read and Write operations on a contract. For example, for the contract 0x7D24DE60A68ae47BE4E852cf03Dd4d8588B489Ec (AlgebraEternalFarming), the getRewardInfo function only retrieves a single field for tokenId (uint256) when the ABI looks like this:
{
"name": "getRewardInfo",
"type": "function",
"inputs": [
{
"name": "key",
"type": "tuple",
"components": [
{ "name": "rewardToken", "type": "address", "internalType": "contract IERC20Minimal" },
{ "name": "bonusRewardToken", "type": "address", "internalType": "contract IERC20Minimal" },
{ "name": "pool", "type": "address", "internalType": "contract IAlgebraPool" },
{ "name": "nonce", "type": "uint256", "internalType": "uint256" }
],
"internalType": "struct IncentiveKey"
},
{ "name": "tokenId", "type": "uint256", "internalType": "uint256" }
],
"outputs": [
{ "name": "reward", "type": "uint256", "internalType": "uint256" },
{ "name": "bonusReward", "type": "uint256", "internalType": "uint256" }
],
"stateMutability": "view"
}
Due to this limitation, it is not possible to call such functions from Teloscan.
Acceptance Criteria:
- Update Teloscan to handle tuple parameters correctly in both Read and Write operations.
- Ensure the system can parse and pass tuple components accurately when interacting with contracts.
- Add test cases to validate that tuple parameters are supported for all contract interactions.
Notes:
In the IncentiveKey.sol file is defined the IncentiveKey struct as:
struct IncentiveKey {
IERC20Minimal rewardToken;
IERC20Minimal bonusRewardToken;
IAlgebraPool pool;
uint256 nonce;
}
In the AlgebraEternalFarming.sol is defined the getRewardInfo function as:
function getRewardInfo(IncentiveKey memory key, uint256 tokenId) external view override returns (uint256 reward, uint256 bonusReward) {
bytes32 incentiveId = IncentiveId.compute(key);
Farm memory farm = _getFarm(tokenId, incentiveId);
IAlgebraEternalVirtualPool virtualPool = IAlgebraEternalVirtualPool(incentives[incentiveId].virtualPoolAddress);
(reward, bonusReward, , ) = _getNewRewardsForFarm(virtualPool, farm);
}
Example on how it can be done (best solution): https://explorer.mantle.xyz/address/0xe2eb7d3e55612Fe94E3b4E07d65087B379a730aB?tab=read_contract
This is how etherscan does it (puajjj) https://ethereum.stackexchange.com/questions/109283/tuple-for-a-function-input-how-to-use-it