Closed salparadi closed 9 months ago
This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.
This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.
This PR was closed because it has been inactive for 35 days.
What I did
Allowed unverified Uniswap v3 contracts that are designated as "similar code" to pull a generic Uniswap v3 ABI instead of failing.
How I did it
Created a new
Client
for theproxy
endpoint. Specifically to pass in atx_hash
. I recognize there are other data pieces you would want to pass in toproxy
actions, but for this use case this seemed simplest.Created a new
GetTransactionByHashResponse
dataclassCreated a new
get_transaction_by_hash
function which returnsGetTransactionByHashResponse
Adjusted the
ape_etherscan/explorer/get_contract_type
function to run a check if theabi
is not properly returned by thegetsourcecode
endpoint (the response is not JSON).If it is not valid JSON, meaning it is a string saying
Contract source code not verified
, get the contract creation data, which gives us the transaction hash of the contract creation.call the
proxy/eth_getTransactionByHash
endpoint using the new Proxy Client and retrieve the transaction informationCheck the
to
field from the transaction against the known Uniswap V3: Positions NFT address, which is theto
address of all Uniswap v3 pool initializations.Load the generic Uniswap v3 ABI constant from
ape_etherscan/utils
Continue the
get_contract_type
logic.How to verify it
Load an ape console and try to get an unverified Uniswap v3 contract. Example:
contract = Contract('0x86E69D1AE728c9Cd229F07bBf34E01bF27258354')
It should have no errors and the contract should be available.
Checklist