diff --git a/contracts/SmartPool.sol b/contracts/SmartPool.sol index b0b8b7e..037f38a 100644 --- a/contracts/SmartPool.sol +++ b/contracts/SmartPool.sol @@ -302,14 +302,10 @@ library RLP { /// @param self The RLPItem. /// @return The decoded string. function toAddress(RLPItem memory self) internal pure returns (address data) { - if(!isData(self)) - revert(); - var (rStartPos, len) = _decode(self); - if (len != 20) + var (, len) = _decode(self); + if (len > 20) revert(); - assembly { - data := div(mload(rStartPos), exp(256, 12)) - } + return address(toUint(self)); } // Get the payload offset.