From 4264625c69a30c4534e977ce3ca709bb95103dad Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sun, 5 Feb 2017 20:21:14 +0000 Subject: Implement address.transfer() --- libsolidity/ast/Types.cpp | 4 +++- libsolidity/ast/Types.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 96b3ed17..7fccccbc 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -464,7 +464,8 @@ MemberList::MemberMap IntegerType::nativeMembers(ContractDefinition const*) cons {"call", make_shared(strings(), strings{"bool"}, FunctionType::Location::Bare, true, false, true)}, {"callcode", make_shared(strings(), strings{"bool"}, FunctionType::Location::BareCallCode, true, false, true)}, {"delegatecall", make_shared(strings(), strings{"bool"}, FunctionType::Location::BareDelegateCall, true)}, - {"send", make_shared(strings{"uint"}, strings{"bool"}, FunctionType::Location::Send)} + {"send", make_shared(strings{"uint"}, strings{"bool"}, FunctionType::Location::Send)}, + {"transfer", make_shared(strings{"uint"}, strings(), FunctionType::Location::Transfer)} }; else return MemberList::MemberMap(); @@ -2097,6 +2098,7 @@ string FunctionType::identifier() const case Location::BareDelegateCall: id += "baredelegatecall"; break; case Location::Creation: id += "creation"; break; case Location::Send: id += "send"; break; + case Location::Transfer: id += "transfer"; break; case Location::SHA3: id += "sha3"; break; case Location::Selfdestruct: id += "selfdestruct"; break; case Location::Revert: id += "revert"; break; diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 3546e522..022b67c4 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -826,6 +826,7 @@ public: BareDelegateCall, ///< DELEGATECALL without function hash Creation, ///< external call using CREATE Send, ///< CALL, but without data and gas + Transfer, ///< CALL, but without data and throws on error SHA3, ///< SHA3 Selfdestruct, ///< SELFDESTRUCT Revert, ///< REVERT -- cgit From 81006dae98ee18c33994af0274de10857774ff70 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 6 Feb 2017 16:54:05 +0000 Subject: Support gas modifier on addr.transfer() --- libsolidity/ast/Types.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 7fccccbc..3e3a3818 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2315,9 +2315,10 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con case Location::Bare: case Location::BareCallCode: case Location::BareDelegateCall: + case Location::Transfer: { MemberList::MemberMap members; - if (m_location != Location::BareDelegateCall && m_location != Location::DelegateCall) + if (m_location != Location::BareDelegateCall && m_location != Location::DelegateCall && m_location != Location::Transfer) { if (m_isPayable) members.push_back(MemberList::Member( -- cgit From 4d290e551c2d563671f9d56744883d3f3dff98ec Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 24 Feb 2017 00:27:36 +0000 Subject: Disallow setting .gas() on .transfer() --- libsolidity/ast/Types.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 3e3a3818..7fccccbc 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2315,10 +2315,9 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con case Location::Bare: case Location::BareCallCode: case Location::BareDelegateCall: - case Location::Transfer: { MemberList::MemberMap members; - if (m_location != Location::BareDelegateCall && m_location != Location::DelegateCall && m_location != Location::Transfer) + if (m_location != Location::BareDelegateCall && m_location != Location::DelegateCall) { if (m_isPayable) members.push_back(MemberList::Member( -- cgit