Skip to content

Commit

Permalink
Refactor operator onboarding (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsudmi authored Dec 19, 2021
1 parent 531a8b1 commit e230076
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 765 deletions.
9 changes: 9 additions & 0 deletions subgraphs/ethereum/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ type ValidatorRegistration @entity {

"The validator withdrawal credentials"
withdrawalCredentials: Bytes!

"The registration index (little endian)"
index: Bytes!

"The block number the registration was created at"
createdAtBlock: BigInt!

"The timestamp the registration was created at"
createdAtTimestamp: BigInt!
}

"""
Expand Down
3 changes: 3 additions & 0 deletions subgraphs/ethereum/src/mappings/validatorRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export function handleDepositEvent(event: DepositEvent): void {
if (validator == null) {
validator = new ValidatorRegistration(publicKey);
validator.withdrawalCredentials = event.params.withdrawal_credentials;
validator.index = event.params.index;
validator.createdAtBlock = event.block.number;
validator.createdAtTimestamp = event.block.timestamp;
validator.save();
}

Expand Down
8 changes: 4 additions & 4 deletions subgraphs/stakewise/config/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"startBlock": "4468087"
},
"poolValidators": {
"address": "0x0d92156861a0bc7037cc21470327bd3bc750eb1d",
"startBlock": "5905172"
"address": "0x908c06affda0ffdbb4578629aa8ccff372e510b6",
"startBlock": "6049456"
},
"merkleDistributor": {
"address": "0x6ef0172b79131c66c7012db3545d637b116feb12",
Expand All @@ -17,8 +17,8 @@
"startBlock": "4623211"
},
"oracles": {
"address": "0x06b0c9476315634dcc59aa3f3f7d5df6fecbaa90",
"startBlock": "5905173"
"address": "0x4bbaa17efd71683dcb9c769dd38e7674994fe38d",
"startBlock": "6049460"
},
"stakeWiseToken": {
"address": "0x0e2497aacec2755d831e4afdea25b4ef1b823855",
Expand Down
266 changes: 92 additions & 174 deletions subgraphs/stakewise/packages/abis/Oracles.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,4 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "oracle",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "publicKey",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "nonce",
"type": "uint256"
}
],
"name": "FinalizeValidatorVoteSubmitted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "oracle",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "publicKey",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "nonce",
"type": "uint256"
}
],
"name": "InitializeValidatorVoteSubmitted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -162,6 +88,43 @@
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "oracle",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "publicKey",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "nonce",
"type": "uint256"
}
],
"name": "RegisterValidatorVoteSubmitted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -391,56 +354,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bytes32",
"name": "withdrawalCredentials",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "depositDataRoot",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "publicKey",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "signature",
"type": "bytes"
}
],
"internalType": "struct IPoolValidators.DepositData",
"name": "depositData",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "merkleProof",
"type": "bytes32[]"
},
{
"internalType": "bytes[]",
"name": "signatures",
"type": "bytes[]"
}
],
"name": "finalizeValidator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -583,56 +496,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bytes32",
"name": "withdrawalCredentials",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "depositDataRoot",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "publicKey",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "signature",
"type": "bytes"
}
],
"internalType": "struct IPoolValidators.DepositData",
"name": "depositData",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "merkleProof",
"type": "bytes32[]"
},
{
"internalType": "bytes[]",
"name": "signatures",
"type": "bytes[]"
}
],
"name": "initializeValidator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -723,6 +586,61 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bytes32",
"name": "withdrawalCredentials",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "depositDataRoot",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "publicKey",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "signature",
"type": "bytes"
}
],
"internalType": "struct IPoolValidators.DepositData",
"name": "depositData",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "merkleProof",
"type": "bytes32[]"
},
{
"internalType": "bytes32",
"name": "validatorsDepositCount",
"type": "bytes32"
},
{
"internalType": "bytes[]",
"name": "signatures",
"type": "bytes[]"
}
],
"name": "registerValidator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down
Loading

0 comments on commit e230076

Please sign in to comment.