function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}

function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}

Oct 13, 2020, 3:02 PM
anyone understsands what 0x values do
?
are they just function signatures i am unable to understand
Oct 13, 2020, 3:02 PM
yes
Oct 13, 2020, 3:26 PM
Ok 👍 ?. What's going on there ?.
Oct 13, 2020, 3:26 PM
i dono, i think it should be the same as doing ERC20(token).transferFrom...
Oct 13, 2020, 3:28 PM
Ok but they use safetransfer library
Oct 13, 2020, 3:28 PM
so read about the safetransfer library, its first time i see that, i'll have to educate myself about it
Oct 13, 2020, 3:29 PM
Cool
So I created contracts , pair was also created fine , problem is coming in adding liquidity and executing swap . Everytime I add try and liquidity on test enviorment I get an error. I think it's something to do with this , not sure what's going , because if the contracts are deployed and created , I should be able to add liquidity which seems to be an issue God knows .
Oct 13, 2020, 3:31 PM
how are you trying to add liquidity? share your code for that
Oct 13, 2020, 3:35 PM
use the updated safeerc20 code
Much more understandable
Oct 13, 2020, 5:50 PM

© 2024 Draquery.com All rights reserved.