aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast/AST.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-11-17 09:43:08 +0800
committerGitHub <noreply@github.com>2017-11-17 09:43:08 +0800
commit2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3 (patch)
tree092a1703bf0d44b6eb7af6282b213c098f65ab84 /libsolidity/ast/AST.cpp
parent2927ce0bd43e7d6aa3ba8e13bd123225adf1c7e8 (diff)
parent53796c0fe8bfd6ff2707bd12dd3141169489f763 (diff)
downloaddexon-solidity-2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3.tar
dexon-solidity-2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3.tar.gz
dexon-solidity-2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3.tar.bz2
dexon-solidity-2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3.tar.lz
dexon-solidity-2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3.tar.xz
dexon-solidity-2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3.tar.zst
dexon-solidity-2b5ef80634c94a5cf27f3ce8a85eeb9d713f5ec3.zip
Merge pull request #3031 from wadeAlexC/develop
Improves checksum error message
Diffstat (limited to 'libsolidity/ast/AST.cpp')
-rw-r--r--libsolidity/ast/AST.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index 1048b610..8da6964e 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -583,3 +583,14 @@ bool Literal::passesAddressChecksum() const
solAssert(isHexNumber(), "Expected hex number");
return dev::passesAddressChecksum(value(), true);
}
+
+std::string Literal::getChecksummedAddress() const
+{
+ solAssert(isHexNumber(), "Expected hex number");
+ /// Pad literal to be a proper hex address.
+ string address = value().substr(2);
+ if (address.length() > 40)
+ return string();
+ address.insert(address.begin(), 40 - address.size(), '0');
+ return dev::getChecksummedAddress(address);
+}