Skip to content

Commit

Permalink
rename totalusedVoteCount totalReceivedVoteCount instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
neo hong committed Jul 19, 2021
1 parent 44966ca commit bfbcd7f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
20 changes: 10 additions & 10 deletions libsolidity/analysis/GlobalContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ namespace dev
addIsSRCandidateMethod();
addVoteCountMethod();
addTotalVoteCountMethod();
addTotalReceivedVoteCountMethod();
addTotalUsedVoteCountMethod();
addReceivedVoteCountMethod();
addUsedVoteCountMethod();
}

void GlobalContext::addVerifyMintProofMethod() {
Expand Down Expand Up @@ -490,8 +490,8 @@ namespace dev
));
}

void GlobalContext::addTotalReceivedVoteCountMethod() {
// uint totalReceivedVoteCount(address)
void GlobalContext::addReceivedVoteCountMethod() {
// uint receivedVoteCount(address)
TypePointers parameterTypes;
parameterTypes.push_back(TypeProvider::address());

Expand All @@ -502,12 +502,12 @@ namespace dev
strings returnParameterNames;
returnParameterNames.push_back("result");

m_magicVariables.push_back(make_shared<MagicVariableDeclaration>("totalReceivedVoteCount", TypeProvider::function(
m_magicVariables.push_back(make_shared<MagicVariableDeclaration>("receivedVoteCount", TypeProvider::function(
parameterTypes,
returnParameterTypes,
parameterNames,
returnParameterNames,
FunctionType::Kind::totalReceivedVoteCount,
FunctionType::Kind::receivedVoteCount,
false,
StateMutability::View,
nullptr,
Expand All @@ -518,8 +518,8 @@ namespace dev
));
}

void GlobalContext::addTotalUsedVoteCountMethod() {
// uint addTotalUsedVoteCount(address)
void GlobalContext::addUsedVoteCountMethod() {
// uint usedVoteCount(address)
TypePointers parameterTypes;
parameterTypes.push_back(TypeProvider::address());

Expand All @@ -530,12 +530,12 @@ namespace dev
strings returnParameterNames;
returnParameterNames.push_back("result");

m_magicVariables.push_back(make_shared<MagicVariableDeclaration>("totalUsedVoteCount", TypeProvider::function(
m_magicVariables.push_back(make_shared<MagicVariableDeclaration>("usedVoteCount", TypeProvider::function(
parameterTypes,
returnParameterTypes,
parameterNames,
returnParameterNames,
FunctionType::Kind::totalUsedVoteCount,
FunctionType::Kind::usedVoteCount,
false,
StateMutability::View,
nullptr,
Expand Down
4 changes: 2 additions & 2 deletions libsolidity/analysis/GlobalContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class GlobalContext: private boost::noncopyable
void addIsSRCandidateMethod();
void addVoteCountMethod();
void addTotalVoteCountMethod();
void addTotalReceivedVoteCountMethod();
void addTotalUsedVoteCountMethod();
void addReceivedVoteCountMethod();
void addUsedVoteCountMethod();
};

}
Expand Down
8 changes: 4 additions & 4 deletions libsolidity/ast/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2757,8 +2757,8 @@ string FunctionType::richIdentifier() const
case Kind::isSrCandidate: id += "isSrCandidate"; break;
case Kind::voteCount: id += "voteCount"; break;
case Kind::totalVoteCount: id += "totalVoteCount"; break;
case Kind::totalReceivedVoteCount: id += "totalReceivedVoteCount"; break;
case Kind::totalUsedVoteCount: id += "totalUsedVoteCount"; break;
case Kind::receivedVoteCount: id += "receivedVoteCount"; break;
case Kind::usedVoteCount: id += "usedVoteCount"; break;
}
id += "_" + stateMutabilityToString(m_stateMutability);
id += identifierList(m_parameterTypes) + "returns" + identifierList(m_returnParameterTypes);
Expand Down Expand Up @@ -3169,8 +3169,8 @@ bool FunctionType::isBareCall() const
case Kind::isSrCandidate:
case Kind::voteCount:
case Kind::totalVoteCount:
case Kind::totalReceivedVoteCount:
case Kind::totalUsedVoteCount:
case Kind::receivedVoteCount:
case Kind::usedVoteCount:
case Kind::SHA256:
case Kind::RIPEMD160:
return true;
Expand Down
4 changes: 2 additions & 2 deletions libsolidity/ast/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,8 @@ class FunctionType: public Type
isSrCandidate, ///< Judge witness whether or not
voteCount, ///< get vote count
totalVoteCount, /// get total vote count
totalReceivedVoteCount, /// get total received vote count
totalUsedVoteCount, /// get total used vote count
receivedVoteCount, /// get total received vote count
usedVoteCount, /// get total used vote count
Log0,
Log1,
Log2,
Expand Down
16 changes: 8 additions & 8 deletions libsolidity/codegen/ExpressionCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,8 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
case FunctionType::Kind::isSrCandidate:
case FunctionType::Kind::voteCount:
case FunctionType::Kind::totalVoteCount:
case FunctionType::Kind::totalReceivedVoteCount:
case FunctionType::Kind::totalUsedVoteCount:
case FunctionType::Kind::receivedVoteCount:
case FunctionType::Kind::usedVoteCount:
{
_functionCall.expression().accept(*this);
static map<FunctionType::Kind, u256> const contractAddresses{
Expand All @@ -933,8 +933,8 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
{FunctionType::Kind::rewardBalance, 16777221},
{FunctionType::Kind::isSrCandidate, 16777222},
{FunctionType::Kind::voteCount, 16777223},
{FunctionType::Kind::totalUsedVoteCount, 16777224},
{FunctionType::Kind::totalReceivedVoteCount, 16777225},
{FunctionType::Kind::usedVoteCount, 16777224},
{FunctionType::Kind::receivedVoteCount, 16777225},
{FunctionType::Kind::totalVoteCount, 16777226}
};
m_context << contractAddresses.at(function.kind());
Expand Down Expand Up @@ -1358,8 +1358,8 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
case FunctionType::Kind::isSrCandidate:
case FunctionType::Kind::voteCount:
case FunctionType::Kind::totalVoteCount:
case FunctionType::Kind::totalReceivedVoteCount:
case FunctionType::Kind::totalUsedVoteCount:
case FunctionType::Kind::receivedVoteCount:
case FunctionType::Kind::usedVoteCount:
case FunctionType::Kind::SHA256:
case FunctionType::Kind::RIPEMD160:
default:
Expand Down Expand Up @@ -2224,8 +2224,8 @@ void ExpressionCompiler::appendExternalFunctionCall(
|| _functionType.kind() == FunctionType::Kind::isSrCandidate
|| _functionType.kind() == FunctionType::Kind::voteCount
|| _functionType.kind() == FunctionType::Kind::totalVoteCount
|| _functionType.kind() == FunctionType::Kind::totalReceivedVoteCount
|| _functionType.kind() == FunctionType::Kind::totalUsedVoteCount
|| _functionType.kind() == FunctionType::Kind::receivedVoteCount
|| _functionType.kind() == FunctionType::Kind::usedVoteCount
)
// This would be the only combination of padding and in-place encoding,
// but all parameters of ecrecover are value types anyway.
Expand Down

0 comments on commit bfbcd7f

Please sign in to comment.