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
9b1a60d0
Commit
9b1a60d0
authored
Jan 16, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minimal proxy address
parent
e2da56b5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
2 deletions
+40
-2
info.ts
mocks/contract/info.ts
+7
-0
contract.ts
types/api/contract.ts
+1
-0
ContractCode.pw.tsx
ui/address/contract/ContractCode.pw.tsx
+16
-0
ContractCode.tsx
ui/address/contract/ContractCode.tsx
+16
-2
ContractCode.pw.tsx_default_with-proxy-address-alert-mobile-1.png
...Code.pw.tsx_default_with-proxy-address-alert-mobile-1.png
+0
-0
ContractCode.pw.tsx_default_with-twin-address-alert-mobile-1.png
...tCode.pw.tsx_default_with-twin-address-alert-mobile-1.png
+0
-0
ContractCode.pw.tsx_mobile_with-proxy-address-alert-mobile-1.png
...tCode.pw.tsx_mobile_with-proxy-address-alert-mobile-1.png
+0
-0
ContractCode.pw.tsx_mobile_with-twin-address-alert-mobile-1.png
...ctCode.pw.tsx_mobile_with-twin-address-alert-mobile-1.png
+0
-0
No files found.
mocks/contract/info.ts
View file @
9b1a60d0
...
@@ -52,6 +52,13 @@ export const withTwinAddress: Partial<SmartContract> = {
...
@@ -52,6 +52,13 @@ export const withTwinAddress: Partial<SmartContract> = {
verified_twin_address_hash
:
'
0xa62744bee8646e237441cdbfdedd3458861748a8
'
,
verified_twin_address_hash
:
'
0xa62744bee8646e237441cdbfdedd3458861748a8
'
,
};
};
export
const
withProxyAddress
:
Partial
<
SmartContract
>
=
{
...
verified
,
is_verified
:
false
,
verified_twin_address_hash
:
'
0xa62744bee8646e237441cdbfdedd3458861748a8
'
,
minimal_proxy_address_hash
:
'
0xa62744bee8646e237441cdbfdedd3458861748a8
'
,
};
export
const
selfDestructed
:
Partial
<
SmartContract
>
=
{
export
const
selfDestructed
:
Partial
<
SmartContract
>
=
{
...
verified
,
...
verified
,
is_self_destructed
:
true
,
is_self_destructed
:
true
,
...
...
types/api/contract.ts
View file @
9b1a60d0
...
@@ -32,6 +32,7 @@ export interface SmartContract {
...
@@ -32,6 +32,7 @@ export interface SmartContract {
external_libraries
:
Array
<
SmartContractExternalLibrary
>
|
null
;
external_libraries
:
Array
<
SmartContractExternalLibrary
>
|
null
;
compiler_settings
:
unknown
;
compiler_settings
:
unknown
;
verified_twin_address_hash
:
string
|
null
;
verified_twin_address_hash
:
string
|
null
;
minimal_proxy_address_hash
:
string
|
null
;
}
}
export
type
SmartContractDecodedConstructorArg
=
[
export
type
SmartContractDecodedConstructorArg
=
[
...
...
ui/address/contract/ContractCode.pw.tsx
View file @
9b1a60d0
...
@@ -98,6 +98,22 @@ test('with twin address alert +@mobile', async({ mount, page }) => {
...
@@ -98,6 +98,22 @@ test('with twin address alert +@mobile', async({ mount, page }) => {
await
expect
(
component
.
getByRole
(
'
alert
'
)).
toHaveScreenshot
();
await
expect
(
component
.
getByRole
(
'
alert
'
)).
toHaveScreenshot
();
});
});
test
(
'
with proxy address alert +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
CONTRACT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
contractMock
.
withProxyAddress
),
}));
const
component
=
await
mount
(
<
TestApp
>
<
ContractCode
/>
</
TestApp
>,
{
hooksConfig
},
);
await
expect
(
component
.
getByRole
(
'
alert
'
)).
toHaveScreenshot
();
});
test
(
'
non verified
'
,
async
({
mount
,
page
})
=>
{
test
(
'
non verified
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
CONTRACT_API_URL
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
CONTRACT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
status
:
200
,
...
...
ui/address/contract/ContractCode.tsx
View file @
9b1a60d0
...
@@ -118,11 +118,11 @@ const ContractCode = () => {
...
@@ -118,11 +118,11 @@ const ContractCode = () => {
Warning! Contract bytecode has been changed and does not match the verified one. Therefore, interaction with this smart contract may be risky.
Warning! Contract bytecode has been changed and does not match the verified one. Therefore, interaction with this smart contract may be risky.
</
Alert
>
</
Alert
>
)
}
)
}
{
!
data
.
is_verified
&&
data
.
verified_twin_address_hash
&&
(
{
!
data
.
is_verified
&&
data
.
verified_twin_address_hash
&&
!
data
.
minimal_proxy_address_hash
&&
(
<
Alert
status=
"warning"
whiteSpace=
"pre-wrap"
flexWrap=
"wrap"
>
<
Alert
status=
"warning"
whiteSpace=
"pre-wrap"
flexWrap=
"wrap"
>
<
span
>
Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB
</
span
>
<
span
>
Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB
</
span
>
<
Address
>
<
Address
>
<
AddressIcon
address=
{
{
hash
:
data
.
verified_twin_address_hash
,
is_contract
:
fals
e
,
implementation_name
:
null
}
}
/>
<
AddressIcon
address=
{
{
hash
:
data
.
verified_twin_address_hash
,
is_contract
:
tru
e
,
implementation_name
:
null
}
}
/>
<
AddressLink
hash=
{
data
.
verified_twin_address_hash
}
truncation=
"constant"
ml=
{
2
}
/>
<
AddressLink
hash=
{
data
.
verified_twin_address_hash
}
truncation=
"constant"
ml=
{
2
}
/>
</
Address
>
</
Address
>
<
chakra
.
span
mt=
{
1
}
>
All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with
</
chakra
.
span
>
<
chakra
.
span
mt=
{
1
}
>
All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with
</
chakra
.
span
>
...
@@ -130,6 +130,20 @@ const ContractCode = () => {
...
@@ -130,6 +130,20 @@ const ContractCode = () => {
<
span
>
page
</
span
>
<
span
>
page
</
span
>
</
Alert
>
</
Alert
>
)
}
)
}
{
data
.
minimal_proxy_address_hash
&&
(
<
Alert
status=
"warning"
flexWrap=
"wrap"
whiteSpace=
"pre-wrap"
>
<
span
>
Minimal Proxy Contract for
</
span
>
<
Address
>
<
AddressIcon
address=
{
{
hash
:
data
.
minimal_proxy_address_hash
,
is_contract
:
true
,
implementation_name
:
null
}
}
/>
<
AddressLink
hash=
{
data
.
minimal_proxy_address_hash
}
truncation=
"constant"
ml=
{
2
}
/>
</
Address
>
<
span
>
.
</
span
>
<
Box
>
<
Link
href=
"https://eips.ethereum.org/EIPS/eip-1167"
>
EIP-1167
</
Link
>
<
span
>
- minimal bytecode implementation that delegates all calls to a known address
</
span
>
</
Box
>
</
Alert
>
)
}
</
Flex
>
</
Flex
>
{
data
.
is_verified
&&
(
{
data
.
is_verified
&&
(
<
Grid
templateColumns=
{
{
base
:
'
1fr
'
,
lg
:
'
1fr 1fr
'
}
}
rowGap=
{
4
}
columnGap=
{
6
}
mb=
{
8
}
>
<
Grid
templateColumns=
{
{
base
:
'
1fr
'
,
lg
:
'
1fr 1fr
'
}
}
rowGap=
{
4
}
columnGap=
{
6
}
mb=
{
8
}
>
...
...
ui/address/contract/__screenshots__/ContractCode.pw.tsx_default_with-proxy-address-alert-mobile-1.png
0 → 100644
View file @
9b1a60d0
9.34 KB
ui/address/contract/__screenshots__/ContractCode.pw.tsx_default_with-twin-address-alert-mobile-1.png
View replaced file @
e2da56b5
View file @
9b1a60d0
16.5 KB
|
W:
|
H:
16.5 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/address/contract/__screenshots__/ContractCode.pw.tsx_mobile_with-proxy-address-alert-mobile-1.png
0 → 100644
View file @
9b1a60d0
9.33 KB
ui/address/contract/__screenshots__/ContractCode.pw.tsx_mobile_with-twin-address-alert-mobile-1.png
View replaced file @
e2da56b5
View file @
9b1a60d0
16.9 KB
|
W:
|
H:
16.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