@0x/contracts-zero-ex: Use consistent returndatasize checks in UniswapFeature (#96)

Co-authored-by: Lawrence Forman <me@merklejerk.com>
This commit is contained in:
Lawrence Forman 2021-01-05 14:40:08 -05:00 committed by GitHub
parent f9078bb1c3
commit 2394eb62aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,13 @@
[
{
"version": "0.18.0",
"changes": [
{
"note": "Use consistent returndatasize checks in UniswapFeature",
"pr": 96
}
]
},
{
"version": "0.17.0",
"changes": [

View File

@ -209,8 +209,8 @@ contract UniswapFeature is
if iszero(staticcall(gas(), pair, 0xB00, 0x4, 0xC00, 0x40)) {
bubbleRevert()
}
// Revert if the pair contract does not return two words.
if iszero(eq(returndatasize(), 0x40)) {
// Revert if the pair contract does not return at least two words.
if lt(returndatasize(), 0x40) {
revert(0,0)
}
@ -389,8 +389,8 @@ contract UniswapFeature is
// Call to allowance() failed.
bubbleRevert()
}
// Make sure the allowance call returned a single word.
if iszero(eq(returndatasize(), 0x20)) {
// Make sure the allowance call returned at least a word.
if lt(returndatasize(), 0x20) {
revert(0, 0)
}
// Call succeeded.