Skip to content

Commit

Permalink
Merge pull request ethereum#134 from thanhson1085/master
Browse files Browse the repository at this point in the history
remove nodeId in smart contract
  • Loading branch information
ngtuna authored Aug 14, 2018
2 parents 92a6000 + 96c9a8f commit 4d1aa5e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 206 deletions.
15 changes: 1 addition & 14 deletions contracts/validator/contract/TomoValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ contract TomoValidator {
event Unvote(address _voter, address _candidate, uint256 _cap);
event Propose(address _owner, address _candidate, uint256 _cap);
event Resign(address _owner, address _candidate);
event SetNodeId(address _owner, address _candidate, string _nodeId);
event Withdraw(address _owner, uint256 _blockNumber, uint256 _cap);

struct ValidatorState {
address owner;
string nodeId;
bool isCandidate;
uint256 cap;
mapping(address => uint256) voters;
Expand Down Expand Up @@ -97,7 +95,6 @@ contract TomoValidator {
candidates.push(_candidates[i]);
validatorsState[_candidates[i]] = ValidatorState({
owner: _firstOwner,
nodeId: '',
isCandidate: true,
cap: _caps[i]
});
Expand All @@ -106,11 +103,10 @@ contract TomoValidator {
}
}

function propose(address _candidate, string _nodeId) external payable onlyValidCandidateCap onlyNotCandidate(_candidate) {
function propose(address _candidate) external payable onlyValidCandidateCap onlyNotCandidate(_candidate) {
candidates.push(_candidate);
validatorsState[_candidate] = ValidatorState({
owner: msg.sender,
nodeId: _nodeId,
isCandidate: true,
cap: msg.value
});
Expand All @@ -137,10 +133,6 @@ contract TomoValidator {
return validatorsState[_candidate].cap;
}

function getCandidateNodeId(address _candidate) public view returns(string) {
return validatorsState[_candidate].nodeId;
}

function getCandidateOwner(address _candidate) public view returns(address) {
return validatorsState[_candidate].owner;
}
Expand Down Expand Up @@ -177,11 +169,6 @@ contract TomoValidator {
emit Unvote(msg.sender, _candidate, _cap);
}

function setNodeId(address _candidate, string _nodeId) public onlyOwner(_candidate) {
validatorsState[_candidate].nodeId = _nodeId;
emit SetNodeId(msg.sender, _candidate, _nodeId);
}

function resign(address _candidate) public onlyOwner(_candidate) onlyCandidate(_candidate) {
validatorsState[_candidate].isCandidate = false;
candidateCount = candidateCount - 1;
Expand Down
6 changes: 0 additions & 6 deletions contracts/validator/contract/interfaces/IValidator.sol

This file was deleted.

Loading

0 comments on commit 4d1aa5e

Please sign in to comment.