check if receipt is for proxy contract

pull/5370/head
Aniket-Engg 2 years ago committed by Aniket
parent 632f7e19e3
commit 605d11be6f
  1. 21
      apps/etherscan/src/app/app.tsx
  2. 3
      apps/etherscan/src/app/types/Receipt.ts
  3. 6
      apps/etherscan/src/app/utils/verify.ts
  4. 2
      apps/etherscan/src/app/views/ReceiptsView.tsx

@ -13,7 +13,7 @@ import { DisplayRoutes } from "./routes"
import { useLocalStorage } from "./hooks/useLocalStorage"
import { getReceiptStatus, getEtherScanApi, getNetworkName } from "./utils"
import { getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus } from "./utils"
import { Receipt, ThemeType } from "./types"
import "./App.css"
@ -102,12 +102,19 @@ const App = () => {
let newReceipts = receipts
for (const item of receiptsNotVerified) {
await new Promise(r => setTimeout(r, 500)) // avoid api rate limit exceed.
console.log('checking receipt', item.guid)
const status = await getReceiptStatus(
item.guid,
apiKey,
getEtherScanApi(networkId)
)
let status
if (item.isProxyContract)
status = await getProxyContractReceiptStatus(
item.guid,
apiKey,
getEtherScanApi(networkId)
)
else
status = await getReceiptStatus(
item.guid,
apiKey,
getEtherScanApi(networkId)
)
if (status.result === "Pass - Verified" || status.result === "Already Verified") {
newReceipts = newReceipts.map((currentReceipt: Receipt) => {
if (currentReceipt.guid === item.guid) {

@ -3,4 +3,7 @@ export type ReceiptStatus = "Pending in queue" | "Pass - Verified" | "Already Ve
export interface Receipt {
guid: string
status: ReceiptStatus
isProxyContract: boolean
message?: string
succeed?: boolean
}

@ -131,7 +131,8 @@ export const verify = async (
guid: result,
status: receiptStatus.result,
message: `Verification process started correctly. Receipt GUID ${result}`,
succeed: true
succeed: true,
isProxyContract
}
onVerifiedContract(returnValue)
return returnValue
@ -143,7 +144,8 @@ export const verify = async (
})
const returnValue = {
message: result,
succeed: false
succeed: false,
isProxyContract
}
resetAfter10Seconds(client, setResults)
return returnValue

@ -25,7 +25,7 @@ export const ReceiptsView: React.FC = () => {
setResults({
succeed: false,
message: "Cannot verify in the selected network"
})
})
return
}
const etherscanApi = getEtherScanApi(networkId)

Loading…
Cancel
Save