Hey guys, does anyone know how to handle an interface that having a function with uint256[size] as parameter but the size of the array is different for different contract that it will provide interface for and it is dynamically obtained on chain.
Jun 24, 2021, 1:22 PM
Keep the array dynamic as well
function test(uint256[] memory)
Jun 24, 2021, 1:29 PM
I mean in the interface
Jun 24, 2021, 1:29 PM
Define interface like this
Or does interface does not support dynamic array...
Jun 24, 2021, 1:30 PM
That is what im worried about
Im trying to interface with curve pools
And each pool may have different size array as argument
In their add_liquidity function
How do i create a common interfce
Jun 24, 2021, 1:32 PM
Yes interface does support dynamic arrays
Just checked
Jun 24, 2021, 1:33 PM
My interface looks like
function add_liquidity(uint256[] calldata, uint256) external;
function add_liquidity(uint256[] calldata, uint256) external;
But this is not working
Jun 24, 2021, 1:34 PM
That should work. Take a look at uniswaps interface
Jun 24, 2021, 1:35 PM
ok
Jun 24, 2021, 1:35 PM
If you used 100 gas, you are only eligible for a refund of 50
Note that this is not the limit, the total amount actually used by the contract call
Jun 24, 2021, 1:43 PM
thanks for answering Mr Robot, but I am not sure what you mean exactly by ^^ ... can you rephrase ? thanks
and yes, i recall the 50% now from the whole gst / chi thing
Jun 24, 2021, 1:46 PM
You can set a gas limit of 200k or 500k, but actual gas used may be 120k or something lower than the set limit. And refund is capped as 50% of this total used amount. Suppose the gas limit is 100k and total gas used was 56k and you are eligible for a refund of 30k, you won't get 30k, only 56k/2 as max refund
Jun 24, 2021, 1:48 PM
understood thanks
very helpful
Jun 24, 2021, 1:49 PM
This is set because if the refund is higher than actual gas cost, miners will end up paying for your transaction instead of getting reward. And miners wouldn't like that, would they?🙃
Jun 24, 2021, 1:49 PM
*waves fist*
Jun 24, 2021, 1:50 PM