mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
remove nodeId in smart contract
This commit is contained in:
parent
3c1405fb14
commit
35013571d5
2 changed files with 15 additions and 199 deletions
|
|
@ -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;
|
||||
|
|
@ -97,7 +95,6 @@ contract TomoValidator {
|
|||
candidates.push(_candidates[i]);
|
||||
validatorsState[_candidates[i]] = ValidatorState({
|
||||
owner: _firstOwner,
|
||||
nodeId: '',
|
||||
isCandidate: true,
|
||||
cap: _caps[i]
|
||||
});
|
||||
|
|
@ -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
|
||||
});
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue