Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the originating address and deployer address in contracts_v0 #2719

Open
ccerv1 opened this issue Jan 8, 2025 · 0 comments
Open

Include the originating address and deployer address in contracts_v0 #2719

ccerv1 opened this issue Jan 8, 2025 · 0 comments
Assignees
Labels
c:data Gathering data (e.g. indexing)

Comments

@ccerv1
Copy link
Member

ccerv1 commented Jan 8, 2025

From discussion with Agora team about contract verification requirements...

The intended logic of contracts_v0 is to identify the root deployer.

Here is the logic of the model.
Basically:

  • base case: contract is deployed directly by a deployer; return that address
  • factory case: contract is deployed by a factor; return the address of the deployer for the factory
  • proxy case (includes most create2 patterns): contract is deployed via some kind of proxy; return the address that executed the transaction (here is an example of such a case; here is an example of one of the models for determining the relevant address to use in these cases)

However, there is a slight issue with the factory case in the sense that we are getting the originating address not the root deployer address. We actually want both.

Example:

Here is a Velodrome pair on OP Mainnet, which was deployed via one of their factories but signed by someone not associated with Velodrome.

Step 1

If I query:

query {
  oso_contractsV0(
    where: {contractAddress: {_eq: "0x3905870e647c97cb9c8d99db24384f480531b5b9"}}
  ) {
    rootDeployerAddress
    contractAddress
    artifactSource
  }
}

Then I get:

{
  "data": {
    "oso_contractsV0": [
      {
        "rootDeployerAddress": "0x55507d81f85f5c0a80469e3483e716915716d212",
        "contractAddress": "0x3905870e647c97cb9c8d99db24384f480531b5b9",
        "artifactSource": "OPTIMISM"
      }
    ]
  }
}

Step 2

See if the deployer is linked to Velodrome. It should NOT be.

query {
  oso_artifactsByProjectV1(
    limit: 5, 
    where: {artifactName: {_eq: "0x55507d81f85f5c0a80469e3483e716915716d212"}}
  ) {
    projectName
    artifactNamespace
  }
}

Result -- it is NOT.

{
  "data": {
    "oso_artifactsByProjectV1": []
  }
}

Step 3
Confirm that the contract IS linked to Velodrome:

query {
  oso_artifactsByProjectV1(
    limit: 5, 
    where: {artifactName: {_eq: "0x3905870e647c97cb9c8d99db24384f480531b5b9"}}
  ) {
    projectName
    artifactNamespace
  }
}

And we see that it is:

{
  "data": {
    "oso_artifactsByProjectV1": [
      {
        "projectName": "velodrome",
        "artifactNamespace": "optimism"
      }
    ]
  }
}

So, we should update this model so that it includes both the originatingAddress (who signed the transaction to create the contract) and the rootDeployerAddress (who deployed the factory that generated the contract).

@ccerv1 ccerv1 added the c:data Gathering data (e.g. indexing) label Jan 8, 2025
@ccerv1 ccerv1 self-assigned this Jan 8, 2025
@ccerv1 ccerv1 added this to the [c] OP Onchain Builders Metrics milestone Jan 8, 2025
@ccerv1 ccerv1 added this to OSO Jan 8, 2025
@github-project-automation github-project-automation bot moved this to Backlog in OSO Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:data Gathering data (e.g. indexing)
Projects
Status: Backlog
Development

No branches or pull requests

1 participant