Why does Uniswap not have payable functions ? #50
-
At least for the v1 where we know it's weth why not just have |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Great question! This is a common confusing part for engineers.
For example: function doStuff() public payable {
require(msg.value > 1);
} You actually can't ERC20s on the other hand, need to use functions like They don't need to be payable, since they don't use ETH! function doStuff() public {
IERC20(some_address).transferFrom(address_a, address_b, amount);
} Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
Ok! |
Beta Was this translation helpful? Give feedback.
-
thx bro |
Beta Was this translation helpful? Give feedback.
-
thx, gj |
Beta Was this translation helpful? Give feedback.
-
This is a quality solution |
Beta Was this translation helpful? Give feedback.
Great question! This is a common confusing part for engineers.
payable
functions only work foreth
or native gas token functions.For example:
You actually can't
transferFrom
with ETH/Native Gas tokens!ERC20s on the other hand, need to use functions like
transferFrom
since they are smart contracts themselves.They don't need to be payable, since they don't use ETH!
Does that make sense?