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
forge(verify): OKLink support #7586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should #7373 be closed in favor of this?
already closed, as request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is the oklink API different from etherscan?
if it's the same, we can likely reuse a lot of code
yes, it is almost the same, except for the headers |
but for the headers, i find that the function i needed is from another crate. so i decide to copy it inside the verify function. |
are the headers strictly required? if the API is compatible we can drastically simplify this, starting with a match here: foundry/crates/verify/src/provider.rs Lines 32 to 37 in 3581076
if we need the headers then we can also add support for this by configuring the here foundry/crates/verify/src/provider.rs Lines 66 to 69 in 30f145f
|
yes, header is strictly required. and the headers' field name is changed to the main problem is that:
to avoid this problem, inside this PR, i reuse some function from etherscan folder, and not use by doing this, the modification to ur original code is minimal. all the modification is located in my oklink.rs file. |
I don't want to have effectively have the same code twice, if all we need is a few additional headers. this can easily be supported by: adding helper functions to set default headers here: install default headers to the client here: then the
can have an additional map of headers that are then installed via the builder here: foundry/crates/verify/src/etherscan/mod.rs Line 302 in 68006b6
|
Can you also please look at #7733, should the API URL just be |
emm, the API url should be https://www.oklink.com/api/v5/explorer/AMOY_TESTNET/api/contract/verifysourcecode |
i have discussed with our team member. the oklink API is not 100% compactable with etherscan API. since the etherscan API will change from time to time, oklink API may not keep up with it. |
hi @mattsse the block_explore code layout has been transformed a lot. |
close this PR in favor of #7915 |
Motivation
To add support for the OKLink explorer contract verification. since the OKLink use almost the same API as the etherscan does for the contract verification part. the only difference is that the OKLink requires the
Ok-Access-Key
pass in the header, while etherscan requires thex-apiKey
pass in the header.Solution
So, basically i reuse lots of code from etherscan part, and modify accordingly, by adding the specific header.
Reference
Closes #7724