Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
Use the implementation fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszradomski committed Oct 30, 2023
1 parent c42a700 commit 67956e6
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions packages/frontend/src/api/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,15 @@ function getProxyDetails(contract: ContractParameters): {
implementations: string[]
} {
const proxyFields: FieldProps[] = []
const implementations: string[] = []
const implementations: string[] = contract.implementations?.map(a => a.toString()) ?? []
switch (contract.upgradeability.type) {
case 'immutable':
break
case 'gnosis safe':
implementations.push(contract.upgradeability.masterCopy.toString())
break
case 'EIP1967 proxy':
proxyFields.push({
name: 'admin',
value: contract.upgradeability.admin.toString(),
})
implementations.push(contract.upgradeability.implementation.toString())
break
case 'ZeppelinOS proxy':
if (contract.upgradeability.admin) {
Expand All @@ -124,47 +120,19 @@ function getProxyDetails(contract: ContractParameters): {
value: contract.upgradeability.admin.toString(),
})
}
implementations.push(contract.upgradeability.implementation.toString())
break
case 'StarkWare proxy':
implementations.push(contract.upgradeability.implementation.toString())
break
case 'StarkWare diamond':
implementations.push(
contract.upgradeability.implementation.toString(),
...Object.values(contract.upgradeability.facets).map((f) =>
f.toString(),
),
)
break
case 'Arbitrum proxy':
case 'new Arbitrum proxy':
proxyFields.push({
name: 'admin',
value: contract.upgradeability.admin.toString(),
})
implementations.push(
contract.upgradeability.userImplementation.toString(),
contract.upgradeability.adminImplementation.toString(),
)
break
case 'resolved delegate proxy':
proxyFields.push({
name: 'addressManager',
value: contract.upgradeability.addressManager.toString(),
})
implementations.push(contract.upgradeability.implementation.toString())
break
case 'EIP897 proxy':
implementations.push(contract.upgradeability.implementation.toString())
break
case 'call implementation proxy':
implementations.push(contract.upgradeability.implementation.toString())
break
case 'EIP2535 diamond proxy':
implementations.push(
...contract.upgradeability.facets.map((f) => f.toString()),
)
break
}

Expand Down

0 comments on commit 67956e6

Please sign in to comment.