Skip to content

Commit

Permalink
feat: add getValidatorAgent view function and update abi file (#572)
Browse files Browse the repository at this point in the history
* feat: add getValidatorAgent view function and abi file

* update abi

---------

Co-authored-by: Roshan <[email protected]>
  • Loading branch information
cosinlink and pythonberg1997 authored Jul 18, 2024
1 parent f2617f8 commit f1f21ce
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
86 changes: 86 additions & 0 deletions abi/stakehub.abi
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "agentToOperator",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "blackList",
Expand Down Expand Up @@ -447,6 +466,25 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getValidatorAgent",
"inputs": [
{
"name": "operatorAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getValidatorBasicInfo",
Expand Down Expand Up @@ -1032,6 +1070,19 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "updateAgent",
"inputs": [
{
"name": "newAgent",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "updateParam",
Expand Down Expand Up @@ -1088,6 +1139,31 @@
],
"stateMutability": "view"
},
{
"type": "event",
"name": "AgentChanged",
"inputs": [
{
"name": "operatorAddress",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "oldAgent",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newAgent",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "BlackListed",
Expand Down Expand Up @@ -1656,6 +1732,11 @@
"name": "InBlackList",
"inputs": []
},
{
"type": "error",
"name": "InvalidAgent",
"inputs": []
},
{
"type": "error",
"name": "InvalidCommission",
Expand All @@ -1681,6 +1762,11 @@
"name": "InvalidSynPackage",
"inputs": []
},
{
"type": "error",
"name": "InvalidValidator",
"inputs": []
},
{
"type": "error",
"name": "InvalidValue",
Expand Down
14 changes: 14 additions & 0 deletions contracts/BC_fusion/StakeHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,20 @@ contract StakeHub is System, Initializable, Protectable {
return _validators[operatorAddress].commission;
}

/**
* @param operatorAddress the operator address of the validator
*
* @return the agent of a validator
*/
function getValidatorAgent(address operatorAddress)
external
view
validatorExist(operatorAddress)
returns (address)
{
return _validators[operatorAddress].agent;
}

/**
* @dev this function will be used by Parlia consensus engine.
*
Expand Down

0 comments on commit f1f21ce

Please sign in to comment.