You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should do a sanity check in case msg.value is bigger than 0 and recipient is different than 0. In this case, the user could wrongly send ether to the contract while configuring the ether receiver to be himself (0 = swap.allowed, 1<>255 = swap.owner).
if (value > 0 && recipient == 0) {
if (value * 1e12 != msg.value) revert InvalidValue();
}
Big thanks to @blackbeard002 for pointing out this possibility.
Describe Preferred Solution
Assuming no ethers are being transferred, the value variable inside the config should always match 0. So there should also be a revert to trigger in this case.
We should think of a way to revert in case msg.value differs from value but won't revert when they are both equals 0.
msg.value should never be bigger than 0 when the recipient is different than 0. (meaning the swap.allowed will send the ether)
The text was updated successfully, but these errors were encountered:
Refactor Request
Describe the Refactor Request
We should do a sanity check in case
msg.value
is bigger than 0 andrecipient
is different than 0. In this case, the user could wrongly send ether to the contract while configuring the ether receiver to be himself (0 = swap.allowed, 1<>255 = swap.owner).Big thanks to @blackbeard002 for pointing out this possibility.
Describe Preferred Solution
Assuming no ethers are being transferred, the
value
variable inside theconfig
should always match 0. So there should also be a revert to trigger in this case.msg.value
differs fromvalue
but won't revert when they are both equals 0.msg.value
should never be bigger than 0 when the recipient is different than 0. (meaning the swap.allowed will send the ether)The text was updated successfully, but these errors were encountered: