Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
915e2191
Commit
915e2191
authored
Jun 06, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth bytecode db verification notice
parent
2fea665e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
7 deletions
+52
-7
info.ts
mocks/contract/info.ts
+5
-0
contract.ts
types/api/contract.ts
+1
-0
ContractCode.pw.tsx
ui/address/contract/ContractCode.pw.tsx
+17
-0
ContractCode.tsx
ui/address/contract/ContractCode.tsx
+29
-7
ContractCode.pw.tsx_default_verified-via-eth-bytecode-db-1.png
...actCode.pw.tsx_default_verified-via-eth-bytecode-db-1.png
+0
-0
ContractCode.pw.tsx_default_verified-via-sourcify-1.png
..._/ContractCode.pw.tsx_default_verified-via-sourcify-1.png
+0
-0
No files found.
mocks/contract/info.ts
View file @
915e2191
...
...
@@ -51,6 +51,11 @@ export const verifiedViaSourcify: Partial<SmartContract> = {
sourcify_repo_url
:
'
https://repo.sourcify.dev/contracts//full_match/99/0x51891596E158b2857e5356DC847e2D15dFbCF2d0/
'
,
};
export
const
verifiedViaEthBytecodeDb
:
Partial
<
SmartContract
>
=
{
...
verified
,
is_verified_via_eth_bytecode_db
:
true
,
};
export
const
withTwinAddress
:
Partial
<
SmartContract
>
=
{
...
verified
,
is_verified
:
false
,
...
...
types/api/contract.ts
View file @
915e2191
...
...
@@ -15,6 +15,7 @@ export interface SmartContract {
name
:
string
|
null
;
verified_at
:
string
|
null
;
is_verified
:
boolean
|
null
;
is_verified_via_eth_bytecode_db
:
boolean
|
null
;
is_changed_bytecode
:
boolean
|
null
;
// sourcify info >>>
is_verified_via_sourcify
:
boolean
|
null
;
...
...
ui/address/contract/ContractCode.pw.tsx
View file @
915e2191
...
...
@@ -98,6 +98,23 @@ test('verified via sourcify', async({ mount, page }) => {
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
1200
,
height
:
110
}
});
});
test
(
'
verified via eth bytecode db
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
CONTRACT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
contractMock
.
verifiedViaEthBytecodeDb
),
}));
await
page
.
route
(
'
https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**
'
,
(
route
)
=>
route
.
abort
());
await
mount
(
<
TestApp
>
<
ContractCode
addressHash=
{
addressHash
}
noSocket
/>
</
TestApp
>,
{
hooksConfig
},
);
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
1200
,
height
:
110
}
});
});
test
(
'
self destructed
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
CONTRACT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
...
...
ui/address/contract/ContractCode.tsx
View file @
915e2191
...
...
@@ -121,20 +121,42 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
));
})();
const verificationAlert = (() => {
if (data?.is_verified_via_eth_bytecode_db) {
return (
<Alert status="warning" whiteSpace="pre-wrap" flexWrap="wrap">
<span>This contract has been { data.is_partially_verified ? 'partially ' : '' }verified using </span>
<LinkExternal
href="https://docs.blockscout.com/about/features/ethereum-bytecode-database-microservice"
fontSize="md"
>
Blockscout Bytecode Database
</LinkExternal>
</Alert>
);
}
if (data?.is_verified_via_sourcify) {
return (
<Alert status="warning" whiteSpace="pre-wrap" flexWrap="wrap">
<span>This contract has been { data.is_partially_verified ? 'partially ' : '' }verified via Sourcify. </span>
{ data.sourcify_repo_url && <LinkExternal href={ data.sourcify_repo_url } fontSize="md">View contract in Sourcify repository</LinkExternal> }
</Alert>
);
}
return null;
})();
return (
<>
<Flex flexDir="column" rowGap={ 2 } mb={ 6 } _empty={{ display: 'none' }}>
{ data?.is_verified && (
<Skeleton isLoaded={ !isPlaceholderData }>
<Alert status="success">Contract Source Code Verified (
Exact
Match)</Alert>
<Alert status="success">Contract Source Code Verified (
{ data.is_partially_verified ? 'Partial' : 'Exact' }
Match)</Alert>
</Skeleton>
) }
{ data?.is_verified_via_sourcify && (
<Alert status="warning" whiteSpace="pre-wrap" flexWrap="wrap">
<span>This contract has been { data.is_partially_verified ? 'partially ' : '' }verified via Sourcify. </span>
{ data.sourcify_repo_url && <LinkExternal href={ data.sourcify_repo_url } fontSize="md">View contract in Sourcify repository</LinkExternal> }
</Alert>
) }
{ verificationAlert }
{ (data?.is_changed_bytecode || isChangedBytecodeSocket) && (
<Alert status="warning">
Warning! Contract bytecode has been changed and does not match the verified one. Therefore, interaction with this smart contract may be risky.
...
...
ui/address/contract/__screenshots__/ContractCode.pw.tsx_default_verified-via-eth-bytecode-db-1.png
0 → 100644
View file @
915e2191
11.9 KB
ui/address/contract/__screenshots__/ContractCode.pw.tsx_default_verified-via-sourcify-1.png
View replaced file @
2fea665e
View file @
915e2191
13 KB
|
W:
|
H:
12.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment