mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replace the inconsistent use of u160/Address/h160 with h160 only
This commit is contained in:
committed by
chriseth
parent
73a2843f05
commit
a8197788d0
@@ -47,12 +47,12 @@ protected:
|
||||
BOOST_CHECK(call(_name + "(string)", u256(0x20), _arg.length(), _arg).empty());
|
||||
}
|
||||
|
||||
void callStringAddress(std::string const& _name, std::string const& _arg1, u160 const& _arg2)
|
||||
void callStringAddress(std::string const& _name, std::string const& _arg1, util::h160 const& _arg2)
|
||||
{
|
||||
BOOST_CHECK(call(_name + "(string,address)", u256(0x40), _arg2, _arg1.length(), _arg1).empty());
|
||||
}
|
||||
|
||||
void callStringAddressBool(std::string const& _name, std::string const& _arg1, u160 const& _arg2, bool _arg3)
|
||||
void callStringAddressBool(std::string const& _name, std::string const& _arg1, util::h160 const& _arg2, bool _arg3)
|
||||
{
|
||||
BOOST_CHECK(call(_name + "(string,address,bool)", u256(0x60), _arg2, _arg3, _arg1.length(), _arg1).empty());
|
||||
}
|
||||
@@ -62,15 +62,16 @@ protected:
|
||||
BOOST_CHECK(call(_name + "(string,bytes32)", u256(0x40), _arg2, _arg1.length(), _arg1).empty());
|
||||
}
|
||||
|
||||
u160 callStringReturnsAddress(std::string const& _name, std::string const& _arg)
|
||||
util::h160 callStringReturnsAddress(std::string const& _name, std::string const& _arg)
|
||||
{
|
||||
bytes const& ret = call(_name + "(string)", u256(0x20), _arg.length(), _arg);
|
||||
BOOST_REQUIRE(ret.size() == 0x20);
|
||||
BOOST_CHECK(std::count(ret.begin(), ret.begin() + 12, 0) == 12);
|
||||
return u160(u256(util::h256(ret)));
|
||||
bytes const addr{ret.begin() + 12, ret.end()};
|
||||
return util::h160(addr);
|
||||
}
|
||||
|
||||
std::string callAddressReturnsString(std::string const& _name, u160 const& _arg)
|
||||
std::string callAddressReturnsString(std::string const& _name, util::h160 const& _arg)
|
||||
{
|
||||
bytesConstRef const ret(&call(_name + "(address)", _arg));
|
||||
BOOST_REQUIRE(ret.size() >= 0x40);
|
||||
|
||||
Reference in New Issue
Block a user