diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ed3d0a8e58b..91a7f891006 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -26,11 +26,14 @@ importers:
specifier: ^2.6.5
version: 2.6.5(react@18.2.0)(typescript@5.3.3)(viem@2.7.11)
'@walletconnect/ethereum-provider':
- specifier: ^2.11.1
- version: 2.11.1(react@18.2.0)
+ specifier: ^2.11.2
+ version: 2.11.2(react@18.2.0)
+ '@walletconnect/modal':
+ specifier: ^2.6.2
+ version: 2.6.2(react@18.2.0)
'@web3modal/wagmi':
- specifier: ^4.0.5
- version: 4.0.5(@wagmi/connectors@4.1.14)(@wagmi/core@2.6.5)(typescript@5.3.3)(viem@2.7.11)
+ specifier: ^4.0.9
+ version: 4.0.9(@wagmi/connectors@4.1.14)(@wagmi/core@2.6.5)(typescript@5.3.3)(viem@2.7.11)
'@zerodevx/svelte-toast':
specifier: ^0.9.5
version: 0.9.5(svelte@4.2.11)
@@ -3011,10 +3014,6 @@ packages:
'@jridgewell/sourcemap-codec': 1.4.15
dev: true
- /@lit-labs/ssr-dom-shim@1.1.2:
- resolution: {integrity: sha512-jnOD+/+dSrfTWYfSXBXlo5l5f0q1UuJo3tkbMDCYA2lKUYq79jaxqtGEvnRoh049nt1vdo1+45RinipU6FGY2g==}
- dev: false
-
/@lit-labs/ssr-dom-shim@1.2.0:
resolution: {integrity: sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==}
dev: false
@@ -3022,7 +3021,7 @@ packages:
/@lit/reactive-element@1.6.3:
resolution: {integrity: sha512-QuTgnG52Poic7uM1AN5yJ09QMe0O28e10XzSvWDz02TJiiKee4stsiownEIadWm8nYzyDAyT+gKzUoZmiWQtsQ==}
dependencies:
- '@lit-labs/ssr-dom-shim': 1.1.2
+ '@lit-labs/ssr-dom-shim': 1.2.0
dev: false
/@lit/reactive-element@2.0.4:
@@ -3302,6 +3301,7 @@ packages:
/@motionone/vue@10.16.4:
resolution: {integrity: sha512-z10PF9JV6SbjFq+/rYabM+8CVlMokgl8RFGvieSGNTmrkQanfHn+15XBrhG3BgUfvmTeSeyShfOHpG0i9zEdcg==}
+ deprecated: Motion One for Vue is deprecated. Use Oku Motion instead https://oku-ui.com/motion
dependencies:
'@motionone/dom': 10.16.4
tslib: 2.6.2
@@ -3741,6 +3741,7 @@ packages:
dependencies:
is-glob: 4.0.3
micromatch: 4.0.5
+ napi-wasm: 1.1.0
dev: false
bundledDependencies:
- napi-wasm
@@ -4969,7 +4970,7 @@ packages:
resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==}
dependencies:
'@types/minimatch': 5.1.2
- '@types/node': 20.10.4
+ '@types/node': 20.11.19
dev: true
/@types/glob@8.1.0:
@@ -5747,6 +5748,45 @@ packages:
- utf-8-validate
dev: false
+ /@walletconnect/core@2.11.2:
+ resolution: {integrity: sha512-bB4SiXX8hX3/hyBfVPC5gwZCXCl+OPj+/EDVM71iAO3TDsh78KPbrVAbDnnsbHzZVHlsMohtXX3j5XVsheN3+g==}
+ dependencies:
+ '@walletconnect/heartbeat': 1.2.1
+ '@walletconnect/jsonrpc-provider': 1.0.13
+ '@walletconnect/jsonrpc-types': 1.0.3
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/jsonrpc-ws-connection': 1.0.14
+ '@walletconnect/keyvaluestorage': 1.1.1
+ '@walletconnect/logger': 2.0.1
+ '@walletconnect/relay-api': 1.0.9
+ '@walletconnect/relay-auth': 1.0.4
+ '@walletconnect/safe-json': 1.0.2
+ '@walletconnect/time': 1.0.2
+ '@walletconnect/types': 2.11.2
+ '@walletconnect/utils': 2.11.2
+ events: 3.3.0
+ isomorphic-unfetch: 3.1.0
+ lodash.isequal: 4.5.0
+ uint8arrays: 3.1.1
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - encoding
+ - supports-color
+ - utf-8-validate
+ dev: false
+
/@walletconnect/crypto@1.0.3:
resolution: {integrity: sha512-+2jdORD7XQs76I2Odgr3wwrtyuLUXD/kprNVsjWRhhhdO9Mt6WqVzOPu0/t7OHSmgal8k7SoBQzUc5hu/8zL/g==}
dependencies:
@@ -5840,6 +5880,40 @@ packages:
- utf-8-validate
dev: false
+ /@walletconnect/ethereum-provider@2.11.2(react@18.2.0):
+ resolution: {integrity: sha512-BUDqee0Uy2rCZVkW5Ao3q6Ado/3fePYnFdryVF+YL6bPhj+xQZ5OfKodl+uvs7Rwq++O5wTX2RqOTzpW7+v+Mg==}
+ dependencies:
+ '@walletconnect/jsonrpc-http-connection': 1.0.7
+ '@walletconnect/jsonrpc-provider': 1.0.13
+ '@walletconnect/jsonrpc-types': 1.0.3
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/modal': 2.6.2(react@18.2.0)
+ '@walletconnect/sign-client': 2.11.2
+ '@walletconnect/types': 2.11.2
+ '@walletconnect/universal-provider': 2.11.2
+ '@walletconnect/utils': 2.11.2
+ events: 3.3.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@types/react'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - encoding
+ - react
+ - supports-color
+ - utf-8-validate
+ dev: false
+
/@walletconnect/events@1.0.1:
resolution: {integrity: sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ==}
dependencies:
@@ -6117,6 +6191,37 @@ packages:
- utf-8-validate
dev: false
+ /@walletconnect/sign-client@2.11.2:
+ resolution: {integrity: sha512-MfBcuSz2GmMH+P7MrCP46mVE5qhP0ZyWA0FyIH6/WuxQ6G+MgKsGfaITqakpRPsykWOJq8tXMs3XvUPDU413OQ==}
+ dependencies:
+ '@walletconnect/core': 2.11.2
+ '@walletconnect/events': 1.0.1
+ '@walletconnect/heartbeat': 1.2.1
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/logger': 2.0.1
+ '@walletconnect/time': 1.0.2
+ '@walletconnect/types': 2.11.2
+ '@walletconnect/utils': 2.11.2
+ events: 3.3.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - encoding
+ - supports-color
+ - utf-8-validate
+ dev: false
+
/@walletconnect/time@1.0.2:
resolution: {integrity: sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g==}
dependencies:
@@ -6173,6 +6278,31 @@ packages:
- supports-color
dev: false
+ /@walletconnect/types@2.11.2:
+ resolution: {integrity: sha512-p632MFB+lJbip2cvtXPBQslpUdiw1sDtQ5y855bOlAGquay+6fZ4h1DcDePeKQDQM3P77ax2a9aNPZxV6y/h1Q==}
+ dependencies:
+ '@walletconnect/events': 1.0.1
+ '@walletconnect/heartbeat': 1.2.1
+ '@walletconnect/jsonrpc-types': 1.0.3
+ '@walletconnect/keyvaluestorage': 1.1.1
+ '@walletconnect/logger': 2.0.1
+ events: 3.3.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - supports-color
+ dev: false
+
/@walletconnect/universal-provider@2.11.0:
resolution: {integrity: sha512-zgJv8jDvIMP4Qse/D9oIRXGdfoNqonsrjPZanQ/CHNe7oXGOBiQND2IIeX+tS0H7uNA0TPvctljCLiIN9nw4eA==}
dependencies:
@@ -6235,6 +6365,37 @@ packages:
- utf-8-validate
dev: false
+ /@walletconnect/universal-provider@2.11.2:
+ resolution: {integrity: sha512-cNtIn5AVoDxKAJ4PmB8m5adnf5mYQMUamEUPKMVvOPscfGtIMQEh9peKsh2AN5xcRVDbgluC01Id545evFyymw==}
+ dependencies:
+ '@walletconnect/jsonrpc-http-connection': 1.0.7
+ '@walletconnect/jsonrpc-provider': 1.0.13
+ '@walletconnect/jsonrpc-types': 1.0.3
+ '@walletconnect/jsonrpc-utils': 1.0.8
+ '@walletconnect/logger': 2.0.1
+ '@walletconnect/sign-client': 2.11.2
+ '@walletconnect/types': 2.11.2
+ '@walletconnect/utils': 2.11.2
+ events: 3.3.0
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - bufferutil
+ - encoding
+ - supports-color
+ - utf-8-validate
+ dev: false
+
/@walletconnect/utils@2.11.0:
resolution: {integrity: sha512-hxkHPlTlDQILHfIKXlmzgNJau/YcSBC3XHUSuZuKZbNEw3duFT6h6pm3HT/1+j1a22IG05WDsNBuTCRkwss+BQ==}
dependencies:
@@ -6301,6 +6462,39 @@ packages:
- supports-color
dev: false
+ /@walletconnect/utils@2.11.2:
+ resolution: {integrity: sha512-LyfdmrnZY6dWqlF4eDrx5jpUwsB2bEPjoqR5Z6rXPiHJKUOdJt7az+mNOn5KTSOlRpd1DmozrBrWr+G9fFLYVw==}
+ dependencies:
+ '@stablelib/chacha20poly1305': 1.0.1
+ '@stablelib/hkdf': 1.0.1
+ '@stablelib/random': 1.0.2
+ '@stablelib/sha256': 1.0.1
+ '@stablelib/x25519': 1.0.3
+ '@walletconnect/relay-api': 1.0.9
+ '@walletconnect/safe-json': 1.0.2
+ '@walletconnect/time': 1.0.2
+ '@walletconnect/types': 2.11.2
+ '@walletconnect/window-getters': 1.0.1
+ '@walletconnect/window-metadata': 1.0.1
+ detect-browser: 5.3.0
+ query-string: 7.1.3
+ uint8arrays: 3.1.1
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@react-native-async-storage/async-storage'
+ - '@upstash/redis'
+ - '@vercel/kv'
+ - supports-color
+ dev: false
+
/@walletconnect/window-getters@1.0.1:
resolution: {integrity: sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q==}
dependencies:
@@ -6314,83 +6508,90 @@ packages:
tslib: 1.14.1
dev: false
- /@web3modal/common@4.0.5:
- resolution: {integrity: sha512-RQKyqJi3T+Ti57XEkb/4dYbrWMdGduZUacb1k+5H7GU4+Ev3HXjOdp2bcPqfEyr1DYKD/IsW/q/0oqXatwEeUQ==}
+ /@web3modal/common@4.0.9:
+ resolution: {integrity: sha512-EeolVpjWvL43M3Zyk4ZHPGhTrX4ibp6sYGbMuEEpZL6prJl/24uquuCBJYolQFOYcpgcv8IKiI7Ls3qUquxf/g==}
dependencies:
dayjs: 1.11.10
dev: false
- /@web3modal/core@4.0.5(react@18.2.0):
- resolution: {integrity: sha512-1QQHa8aNF1KX6ZAKBUU6UE4kwIa9x3FWX7Ak9eER/bTvmgyu2abJe3IwWPEt++nAjbvMKbIO6cATUXfSVk1Zyw==}
+ /@web3modal/core@4.0.9(react@18.2.0):
+ resolution: {integrity: sha512-RDC2Acknxa74ytV+4W0DBOioTz2s4RheaEL9V4t0q3Se3wP4aQUw2JojUpjQJFWSnTptZs1uPRCGonWRXnKxKw==}
dependencies:
- '@web3modal/common': 4.0.5
- '@web3modal/wallet': 4.0.5
+ '@web3modal/common': 4.0.9
+ '@web3modal/wallet': 4.0.9
valtio: 1.11.2(react@18.2.0)
transitivePeerDependencies:
- '@types/react'
- react
dev: false
- /@web3modal/polyfills@4.0.5:
- resolution: {integrity: sha512-2jnu4CEVnhatq/Bzyk4IgkPVGY3GgD13hZAPCx8mztZzPkrbKrSKfuq2KTVuTjw392DPp7EMmxmm8SSFnjwzuA==}
+ /@web3modal/polyfills@4.0.9:
+ resolution: {integrity: sha512-qGWiVMjrppTMzZnHYAyqdo2Vcj1yBtjS8gfZMYJrUELAIvmc3suQUbB/7YmZ2GrihGyhCOyO48+BKfEHKBXDvw==}
dependencies:
buffer: 6.0.3
dev: false
- /@web3modal/scaffold-react@4.0.5(react-dom@18.2.0)(react@18.2.0):
- resolution: {integrity: sha512-4JQhLHH+IRjpsRbVtt2skaxzTKYqpLTr7zTMZyTECgOXpWyOtTCN0vgc2YatWbct972sZlJ0V8llIwDiGodHgA==}
+ /@web3modal/scaffold-react@4.0.9(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-p/nv3hb8bmgk45sxQ1xYaior+9cOJwJQ6R8/Nw8ldShWT4egoxT9tfxi2S3S8RJskJra+n+wZncZp5qPaEXErQ==}
peerDependencies:
react: '>=17'
react-dom: '>=17'
dependencies:
- '@web3modal/scaffold': 4.0.5(react@18.2.0)
+ '@web3modal/scaffold': 4.0.9(react@18.2.0)
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
transitivePeerDependencies:
- '@types/react'
dev: false
- /@web3modal/scaffold-utils@4.0.5(react@18.2.0):
- resolution: {integrity: sha512-FUjtpnf22TEgYpsG6oom1YtyDeydkWFmdXxf+xbnp+SlxuMpff9iF22bWIw1uM5eZYFQH3nIyDozCbOD/grQ+Q==}
+ /@web3modal/scaffold-utils@4.0.9(react@18.2.0):
+ resolution: {integrity: sha512-4sbRv61jeL9ydEZ818GJ0meXolgMCNtdULxyyd0HgCdZUd8NgZjaalYNSVBttIXLYgFbCgy/ccl3pv8xySaAeQ==}
dependencies:
- '@web3modal/polyfills': 4.0.5
- '@web3modal/scaffold': 4.0.5(react@18.2.0)
+ '@web3modal/polyfills': 4.0.9
+ '@web3modal/scaffold': 4.0.9(react@18.2.0)
valtio: 1.11.2(react@18.2.0)
transitivePeerDependencies:
- '@types/react'
- react
dev: false
- /@web3modal/scaffold-vue@4.0.5(react@18.2.0)(vue@3.4.19):
- resolution: {integrity: sha512-FrFDoqGRATPfNYdYug6vX0g79HdL8u08QcC3ZTix1yv2iYz424X7tSm+zQ0FBh7DnZPMYIximSNy1jrEw1wPoQ==}
+ /@web3modal/scaffold-vue@4.0.9(react@18.2.0)(vue@3.4.19):
+ resolution: {integrity: sha512-/HxEvHMCMadHbXeZNMsEqmkyI/MwRpDQVC+B9AyHjVQO781gVUME++1vQFxxx8ThuFOU3NI3HMhqbTLe+DJGVw==}
peerDependencies:
vue: '>=3'
dependencies:
- '@web3modal/scaffold': 4.0.5(react@18.2.0)
+ '@web3modal/scaffold': 4.0.9(react@18.2.0)
vue: 3.4.19(typescript@5.3.3)
transitivePeerDependencies:
- '@types/react'
- react
dev: false
- /@web3modal/scaffold@4.0.5(react@18.2.0):
- resolution: {integrity: sha512-K2j/fmUAPyZ6M5DvOAf88qcubrB//ulkOIS1ZX7R7g8isp9z7AtWn2c0b/O+l9CEeiKn0ZSIa7VF7GrUFDZ8vQ==}
+ /@web3modal/scaffold@4.0.9(react@18.2.0):
+ resolution: {integrity: sha512-zja2yhom3kfw5Sqn0MYvUKTtRuS8r2TIBWuB5ZwcrJ7+HnBwHSg0GQhW3FPilzturpeQR9rMySHzdWBioDBT6g==}
dependencies:
- '@web3modal/common': 4.0.5
- '@web3modal/core': 4.0.5(react@18.2.0)
- '@web3modal/ui': 4.0.5
+ '@web3modal/common': 4.0.9
+ '@web3modal/core': 4.0.9(react@18.2.0)
+ '@web3modal/ui': 4.0.9
lit: 3.1.0
transitivePeerDependencies:
- '@types/react'
- react
dev: false
- /@web3modal/siwe@4.0.5(typescript@5.3.3):
- resolution: {integrity: sha512-JxYoM0rvgekpvd2Wyw1mtq7mbv8JBsbP22K5Evf4ZUupVAgoeNHDGCBKK8nKwdwMuc2AfsAcdNqx+rwS6N9WLQ==}
+ /@web3modal/siwe@4.0.9(typescript@5.3.3):
+ resolution: {integrity: sha512-OB4z/lTHCAm3bjiuyPz4uBib46YU6kzp4eeSnAWZzAHj9mQnB4DZOoCdFQvFn+N1n3CzTZaMxz3CYjYn2A+Qhw==}
requiresBuild: true
+ peerDependenciesMeta:
+ react:
+ optional: true
+ react-dom:
+ optional: true
+ vue:
+ optional: true
dependencies:
- '@web3modal/core': 4.0.5(react@18.2.0)
- '@web3modal/scaffold-utils': 4.0.5(react@18.2.0)
+ '@web3modal/core': 4.0.9(react@18.2.0)
+ '@web3modal/scaffold-utils': 4.0.9(react@18.2.0)
optionalDependencies:
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
@@ -6401,30 +6602,39 @@ packages:
dev: false
optional: true
- /@web3modal/ui@4.0.5:
- resolution: {integrity: sha512-IGNzHtRWZjbjv/8s7kbVknrlV/R0OrVTmlrQMa4H16kEuInWBZkKjfJ6zlqEKNrhppJ01Ft11h4d3NWscu47fg==}
+ /@web3modal/ui@4.0.9:
+ resolution: {integrity: sha512-dzagpe7KVOeqY2KzGeu1+sPW17GGUdxwHirIbgceoFQvWaAYW4RTbj32ow1Uc7N4WspKzRg6AdA7nB4znyNqxg==}
dependencies:
lit: 3.1.0
qrcode: 1.5.3
dev: false
- /@web3modal/wagmi@4.0.5(@wagmi/connectors@4.1.14)(@wagmi/core@2.6.5)(typescript@5.3.3)(viem@2.7.11):
- resolution: {integrity: sha512-uUwhpv3gnq0SmXwO1YdbTVSZfZfgjEdp7lsc6u+Uoxv5Bw5XFkIV6FsSlQFk7SU3So+GEGa/u9iNejnl40hQUA==}
+ /@web3modal/wagmi@4.0.9(@wagmi/connectors@4.1.14)(@wagmi/core@2.6.5)(typescript@5.3.3)(viem@2.7.11):
+ resolution: {integrity: sha512-YrPBRIrT7LJKf1hnKB4QfHH4F6MeO3gwNkT3FlOuZcXK1s0awVaAZJG8Puys4Dg2EqJc8pDnKwcwjqGp+vjlHg==}
peerDependencies:
'@wagmi/connectors': '>=4.0.0'
'@wagmi/core': '>=2.0.0'
viem: '>=2.0.0'
+ peerDependenciesMeta:
+ '@web3modal/siwe':
+ optional: true
+ react:
+ optional: true
+ react-dom:
+ optional: true
+ vue:
+ optional: true
dependencies:
'@wagmi/connectors': 4.1.14(@wagmi/core@2.6.5)(react-dom@18.2.0)(react-native@0.73.4)(react@18.2.0)(typescript@5.3.3)(viem@2.7.11)
'@wagmi/core': 2.6.5(react@18.2.0)(typescript@5.3.3)(viem@2.7.11)
- '@web3modal/polyfills': 4.0.5
- '@web3modal/scaffold': 4.0.5(react@18.2.0)
- '@web3modal/scaffold-react': 4.0.5(react-dom@18.2.0)(react@18.2.0)
- '@web3modal/scaffold-utils': 4.0.5(react@18.2.0)
- '@web3modal/scaffold-vue': 4.0.5(react@18.2.0)(vue@3.4.19)
+ '@web3modal/polyfills': 4.0.9
+ '@web3modal/scaffold': 4.0.9(react@18.2.0)
+ '@web3modal/scaffold-react': 4.0.9(react-dom@18.2.0)(react@18.2.0)
+ '@web3modal/scaffold-utils': 4.0.9(react@18.2.0)
+ '@web3modal/scaffold-vue': 4.0.9(react@18.2.0)(vue@3.4.19)
viem: 2.7.11(typescript@5.3.3)(zod@3.22.4)
optionalDependencies:
- '@web3modal/siwe': 4.0.5(typescript@5.3.3)
+ '@web3modal/siwe': 4.0.9(typescript@5.3.3)
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
vue: 3.4.19(typescript@5.3.3)
@@ -6433,8 +6643,8 @@ packages:
- typescript
dev: false
- /@web3modal/wallet@4.0.5:
- resolution: {integrity: sha512-rw9LtXX7azOjpV/WWh2KRG4zlvXW+tE+QRxl0b12S4WgQXLoteqzAFiumvg/H4fBf73WFJ6Bos3g7Mf4M8Dp6A==}
+ /@web3modal/wallet@4.0.9:
+ resolution: {integrity: sha512-MU70GyFzhoVKclkdTwx89KDz6F8R77EtTO1Xw4D5qejTqwFtOAnupQQisv5HIu3v+GfpLeSUwyBaHzE25xeAmA==}
requiresBuild: true
dependencies:
zod: 3.22.4
@@ -6876,7 +7086,7 @@ packages:
resolution: {integrity: sha512-UW+Mz8LG/sPSU8jRDCjVr6J/ZKAGpHfwrZ6kWTG5qCxIEiXdVshqGnu5vEZA8S1y6X4aCSbQZ0/EEsfvEvBiSg==}
engines: {node: '>= 0.4'}
dependencies:
- call-bind: 1.0.5
+ call-bind: 1.0.7
define-properties: 1.2.1
es-abstract: 1.22.3
es-array-method-boxes-properly: 1.0.0
@@ -7332,7 +7542,6 @@ packages:
function-bind: 1.1.2
get-intrinsic: 1.2.4
set-function-length: 1.2.1
- dev: false
/caller-callsite@2.0.0:
resolution: {integrity: sha512-JuG3qI4QOftFsZyOn1qq87fq5grLIyk1JYd5lJmdA+fG7aQ9pA/i3JIJGcO3q0MrRcHlOt1U+ZeHW8Dq9axALQ==}
@@ -8170,7 +8379,6 @@ packages:
es-define-property: 1.0.0
es-errors: 1.3.0
gopd: 1.0.1
- dev: false
/define-lazy-prop@2.0.0:
resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==}
@@ -8550,12 +8758,10 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
get-intrinsic: 1.2.4
- dev: false
/es-errors@1.3.0:
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
engines: {node: '>= 0.4'}
- dev: false
/es-set-tostringtag@2.0.2:
resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==}
@@ -9828,7 +10034,6 @@ packages:
has-proto: 1.0.3
has-symbols: 1.0.3
hasown: 2.0.1
- dev: false
/get-port-please@3.1.2:
resolution: {integrity: sha512-Gxc29eLs1fbn6LQ4jSU4vXjlwyZhF5HsGuMAa7gqBP4Rw4yxxltyDUuF5MBclFzDTXO+ACchGQoeela4DSfzdQ==}
@@ -10006,7 +10211,7 @@ packages:
dir-glob: 3.0.1
fast-glob: 3.3.2
glob: 7.2.3
- ignore: 5.3.0
+ ignore: 5.3.1
merge2: 1.4.1
slash: 3.0.0
dev: true
@@ -10199,7 +10404,6 @@ packages:
resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
dependencies:
es-define-property: 1.0.0
- dev: false
/has-proto@1.0.1:
resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==}
@@ -10208,7 +10412,6 @@ packages:
/has-proto@1.0.3:
resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==}
engines: {node: '>= 0.4'}
- dev: false
/has-symbols@1.0.3:
resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==}
@@ -10246,7 +10449,6 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
function-bind: 1.1.2
- dev: false
/he@1.2.0:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
@@ -11503,7 +11705,7 @@ packages:
/lit-element@3.3.3:
resolution: {integrity: sha512-XbeRxmTHubXENkV4h8RIPyr8lXc+Ff28rkcQzw3G6up2xg5E8Zu1IgOWIwBLEQsu3cOVFqdYwiVi0hv0SlpqUA==}
dependencies:
- '@lit-labs/ssr-dom-shim': 1.1.2
+ '@lit-labs/ssr-dom-shim': 1.2.0
'@lit/reactive-element': 1.6.3
lit-html: 2.8.0
dev: false
@@ -12339,6 +12541,10 @@ packages:
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
+ /napi-wasm@1.1.0:
+ resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==}
+ dev: false
+
/natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
dev: true
@@ -12565,7 +12771,7 @@ packages:
engines: {node: '>= 0.8'}
dependencies:
array.prototype.reduce: 1.0.6
- call-bind: 1.0.5
+ call-bind: 1.0.7
define-properties: 1.2.1
es-abstract: 1.22.3
safe-array-concat: 1.0.1
@@ -12825,7 +13031,7 @@ packages:
got: 12.6.1
registry-auth-token: 5.0.2
registry-url: 6.0.1
- semver: 7.5.4
+ semver: 7.6.0
dev: true
/param-case@3.0.4:
@@ -14164,7 +14370,6 @@ packages:
get-intrinsic: 1.2.4
gopd: 1.0.1
has-property-descriptors: 1.0.2
- dev: false
/set-function-name@2.0.1:
resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==}
@@ -16470,7 +16675,7 @@ packages:
pify: 4.0.1
recursive-readdir: 2.2.3
sc-istanbul: 0.4.6
- semver: 7.5.4
+ semver: 7.6.0
shelljs: 0.8.5
web3-utils: 1.10.3
transitivePeerDependencies:
From b151bcb2e159ece03da3c2014e35dbbbed7d8410 Mon Sep 17 00:00:00 2001
From: Korbinian
Date: Thu, 22 Feb 2024 19:23:42 +0100
Subject: [PATCH 06/12] fix(bridge-ui): incorrectly detecting bridged tokens
(#16007)
---
.../src/components/TokenDropdown/TokenDropdown.svelte | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/bridge-ui/src/components/TokenDropdown/TokenDropdown.svelte b/packages/bridge-ui/src/components/TokenDropdown/TokenDropdown.svelte
index b2f23933788..6f929afde84 100644
--- a/packages/bridge-ui/src/components/TokenDropdown/TokenDropdown.svelte
+++ b/packages/bridge-ui/src/components/TokenDropdown/TokenDropdown.svelte
@@ -98,7 +98,10 @@
}
if (tokenInfo.canonical && tokenInfo.bridged) {
// double check we have the correct address for the destination chain and it is not 0x0
- if (value?.addresses[destChain.id] !== tokenInfo.canonical?.address) {
+ if (
+ value?.addresses[destChain.id] !== tokenInfo.canonical?.address &&
+ value?.addresses[destChain.id] !== zeroAddress
+ ) {
log('selected token is bridged', value?.addresses[destChain.id]);
$selectedTokenIsBridged = true;
} else {
From 4d2372c1a86350e830a3cec19ba30d752f7fb3aa Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 22 Feb 2024 19:28:34 +0100
Subject: [PATCH 07/12] chore(main): release bridge-ui 2.9.1 (#15952)
Co-authored-by: teko <160625009+taiko-kitty@users.noreply.github.com>
---
.release-please-manifest.json | 2 +-
packages/bridge-ui/CHANGELOG.md | 11 +++++++++++
packages/bridge-ui/package.json | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 0d98e5560e1..0d19ed968f5 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,6 +1,6 @@
{
"packages/branding": "0.3.0",
- "packages/bridge-ui": "2.9.0",
+ "packages/bridge-ui": "2.9.1",
"packages/eventindexer": "0.13.0",
"packages/fork-diff": "0.4.0",
"packages/guardian-prover-health-check": "0.1.0",
diff --git a/packages/bridge-ui/CHANGELOG.md b/packages/bridge-ui/CHANGELOG.md
index 0c120efe35b..8f8390975f6 100644
--- a/packages/bridge-ui/CHANGELOG.md
+++ b/packages/bridge-ui/CHANGELOG.md
@@ -1,5 +1,16 @@
# Changelog
+## [2.9.1](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v2.9.0...bridge-ui-v2.9.1) (2024-02-22)
+
+
+### Bug Fixes
+
+* **bridge-ui:** add dependency ([#15999](https://github.com/taikoxyz/taiko-mono/issues/15999)) ([14484a0](https://github.com/taikoxyz/taiko-mono/commit/14484a00c1d59332361fba32b74d39db2ae4b864))
+* **bridge-ui:** fix wrong balance updates on network switch ([#15980](https://github.com/taikoxyz/taiko-mono/issues/15980)) ([b556e00](https://github.com/taikoxyz/taiko-mono/commit/b556e000b25fc8d5405cba77f3eebb4152dc1497))
+* **bridge-ui:** incorrectly detecting bridged tokens ([#16007](https://github.com/taikoxyz/taiko-mono/issues/16007)) ([b151bcb](https://github.com/taikoxyz/taiko-mono/commit/b151bcb2e159ece03da3c2014e35dbbbed7d8410))
+* **bridge-ui:** transactions view styling ([#15997](https://github.com/taikoxyz/taiko-mono/issues/15997)) ([620a22d](https://github.com/taikoxyz/taiko-mono/commit/620a22dcb1ce77a9335dff8bbe0546c4c5065b23))
+* fix typos in tests and comments ([#15028](https://github.com/taikoxyz/taiko-mono/issues/15028)) ([54bf597](https://github.com/taikoxyz/taiko-mono/commit/54bf597c89a7f22161eeeffd13c20fe0acb4e2d7))
+
## [2.9.0](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v2-v2.8.0...bridge-ui-v2-v2.9.0) (2023-10-18)
diff --git a/packages/bridge-ui/package.json b/packages/bridge-ui/package.json
index 9e4309c4515..3d8d12f7811 100644
--- a/packages/bridge-ui/package.json
+++ b/packages/bridge-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "bridge-ui",
- "version": "2.9.0",
+ "version": "2.9.1",
"private": true,
"scripts": {
"dev": "vite dev",
From a9f60b8c114dfd277e8dc227e7fbbe8716698d53 Mon Sep 17 00:00:00 2001
From: arul armstrong <33225342+arularmstrong@users.noreply.github.com>
Date: Fri, 23 Feb 2024 05:50:21 +0530
Subject: [PATCH 08/12] fix(bridge-ui): renamed configuredCustomToken to
configuredCustomTokens (#15905)
Co-authored-by: Korbinian
---
packages/bridge-ui/config/sample/configuredBridges.example | 4 ++--
...uredCustomToken.example => configuredCustomTokens.example} | 0
...omToken.schema.json => configuredCustomTokens.schema.json} | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename packages/bridge-ui/config/sample/{configuredCustomToken.example => configuredCustomTokens.example} (100%)
rename packages/bridge-ui/config/schemas/{configuredCustomToken.schema.json => configuredCustomTokens.schema.json} (100%)
diff --git a/packages/bridge-ui/config/sample/configuredBridges.example b/packages/bridge-ui/config/sample/configuredBridges.example
index 9c3f23b2322..a75586d44a6 100644
--- a/packages/bridge-ui/config/sample/configuredBridges.example
+++ b/packages/bridge-ui/config/sample/configuredBridges.example
@@ -36,7 +36,7 @@
"signalServiceAddress": "",
"hops": [
{
- "chaind: ,
+ "chaind": ,
"crossChainSyncAddress": "",
"signalServiceAddress": "",
}
@@ -55,7 +55,7 @@
"signalServiceAddress": "",
"hops": [
{
- "chaind: ,
+ "chaind": ,
"crossChainSyncAddress": "",
"signalServiceAddress": "",
}
diff --git a/packages/bridge-ui/config/sample/configuredCustomToken.example b/packages/bridge-ui/config/sample/configuredCustomTokens.example
similarity index 100%
rename from packages/bridge-ui/config/sample/configuredCustomToken.example
rename to packages/bridge-ui/config/sample/configuredCustomTokens.example
diff --git a/packages/bridge-ui/config/schemas/configuredCustomToken.schema.json b/packages/bridge-ui/config/schemas/configuredCustomTokens.schema.json
similarity index 100%
rename from packages/bridge-ui/config/schemas/configuredCustomToken.schema.json
rename to packages/bridge-ui/config/schemas/configuredCustomTokens.schema.json
From 0496ff40e374354b83d17121e4760391fed90a31 Mon Sep 17 00:00:00 2001
From: Korbinian
Date: Fri, 23 Feb 2024 03:40:10 +0100
Subject: [PATCH 09/12] fix(bridge-ui): add injected provider to connectors
(#16008)
Co-authored-by: David
---
packages/bridge-ui/src/libs/connect/web3modal.ts | 2 ++
packages/bridge-ui/src/libs/wagmi/client.ts | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/packages/bridge-ui/src/libs/connect/web3modal.ts b/packages/bridge-ui/src/libs/connect/web3modal.ts
index 431bd88c854..bfcb1cc5f91 100644
--- a/packages/bridge-ui/src/libs/connect/web3modal.ts
+++ b/packages/bridge-ui/src/libs/connect/web3modal.ts
@@ -10,6 +10,8 @@ const chainImages = getChainImages();
export const web3modal = createWeb3Modal({
wagmiConfig: config,
projectId,
+ featuredWalletIds: [],
+ excludeWalletIds: ['c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96'],
// chains,
chainImages,
themeVariables: {
diff --git a/packages/bridge-ui/src/libs/wagmi/client.ts b/packages/bridge-ui/src/libs/wagmi/client.ts
index 8f00a8071c0..449f758d6c9 100644
--- a/packages/bridge-ui/src/libs/wagmi/client.ts
+++ b/packages/bridge-ui/src/libs/wagmi/client.ts
@@ -1,4 +1,4 @@
-import { walletConnect } from '@wagmi/connectors';
+import { injected, walletConnect } from '@wagmi/connectors';
import { createConfig, getPublicClient, http, reconnect } from '@wagmi/core';
import { PUBLIC_WALLETCONNECT_PROJECT_ID } from '$env/static/public';
@@ -15,7 +15,7 @@ const transports = chains.reduce((acc, { id }) => ({ ...acc, [id]: http() }), {}
export const config = createConfig({
//@ts-ignore
chains: [...chains],
- connectors: [walletConnect({ projectId })],
+ connectors: [walletConnect({ projectId, showQrModal: false }), injected()],
transports,
});
From e1f21c12cb1347fef6f7795cfd1b55e2f172312f Mon Sep 17 00:00:00 2001
From: Daniel Wang <99078276+dantaik@users.noreply.github.com>
Date: Fri, 23 Feb 2024 15:10:34 +0800
Subject: [PATCH 10/12] fix(protocol): fix LibTrieProof.verifyMerkleProof by
RLP-encoding the byte32 value first (#16018)
---
.../protocol/contracts/libs/LibTrieProof.sol | 16 +-
.../contracts/signal/SignalService.sol | 2 +-
.../thirdparty/optimism/rlp/RLPWriter.sol | 163 ++++++++++++++++++
.../protocol/test/libs/LibTrieProof.t.sol | 40 +++++
4 files changed, 213 insertions(+), 8 deletions(-)
create mode 100644 packages/protocol/contracts/thirdparty/optimism/rlp/RLPWriter.sol
diff --git a/packages/protocol/contracts/libs/LibTrieProof.sol b/packages/protocol/contracts/libs/LibTrieProof.sol
index 96dab809e5f..b32f2337688 100644
--- a/packages/protocol/contracts/libs/LibTrieProof.sol
+++ b/packages/protocol/contracts/libs/LibTrieProof.sol
@@ -6,12 +6,11 @@
pragma solidity ^0.8.24;
-import { RLPReader } from "../thirdparty/optimism/rlp/RLPReader.sol";
-import { SecureMerkleTrie } from "../thirdparty/optimism/trie/SecureMerkleTrie.sol";
+import "../thirdparty/optimism/rlp/RLPReader.sol";
+import "../thirdparty/optimism/rlp/RLPWriter.sol";
+import "../thirdparty/optimism/trie/SecureMerkleTrie.sol";
-/**
- * @title LibTrieProof
- */
+/// @title LibTrieProof
library LibTrieProof {
// The consensus format representing account is RLP encoded in the
// following order: nonce, balance, storageHash, codeHash.
@@ -35,7 +34,7 @@ library LibTrieProof {
bytes32 rootHash,
address addr,
bytes32 slot,
- bytes memory value,
+ bytes32 value,
bytes[] memory accountProof,
bytes[] memory storageProof
)
@@ -58,7 +57,10 @@ library LibTrieProof {
}
bool verified = SecureMerkleTrie.verifyInclusionProof(
- bytes.concat(slot), value, storageProof, bytes32(storageRoot)
+ bytes.concat(slot),
+ RLPWriter.writeUint(uint256(value)),
+ storageProof,
+ bytes32(storageRoot)
);
if (!verified) revert LTP_INVALID_INCLUSION_PROOF();
diff --git a/packages/protocol/contracts/signal/SignalService.sol b/packages/protocol/contracts/signal/SignalService.sol
index 1d3bd1c56b2..2199cace778 100644
--- a/packages/protocol/contracts/signal/SignalService.sol
+++ b/packages/protocol/contracts/signal/SignalService.sol
@@ -239,7 +239,7 @@ contract SignalService is EssentialContract, ISignalService {
hop.rootHash,
signalService,
getSignalSlot(chainId, app, signal),
- bytes.concat(value),
+ value,
hop.accountProof,
hop.storageProof
);
diff --git a/packages/protocol/contracts/thirdparty/optimism/rlp/RLPWriter.sol b/packages/protocol/contracts/thirdparty/optimism/rlp/RLPWriter.sol
new file mode 100644
index 00000000000..85a80ba4aa9
--- /dev/null
+++ b/packages/protocol/contracts/thirdparty/optimism/rlp/RLPWriter.sol
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: MIT
+pragma solidity 0.8.24;
+
+/// @custom:attribution https://github.com/bakaoh/solidity-rlp-encode
+/// @title RLPWriter
+/// @author RLPWriter is a library for encoding Solidity types to RLP bytes. Adapted from Bakaoh's
+/// RLPEncode library (https://github.com/bakaoh/solidity-rlp-encode) with minor
+/// modifications to improve legibility.
+library RLPWriter {
+ /// @notice RLP encodes a byte string.
+ /// @param _in The byte string to encode.
+ /// @return out_ The RLP encoded string in bytes.
+ function writeBytes(bytes memory _in) internal pure returns (bytes memory out_) {
+ if (_in.length == 1 && uint8(_in[0]) < 128) {
+ out_ = _in;
+ } else {
+ out_ = abi.encodePacked(_writeLength(_in.length, 128), _in);
+ }
+ }
+
+ /// @notice RLP encodes a list of RLP encoded byte byte strings.
+ /// @param _in The list of RLP encoded byte strings.
+ /// @return list_ The RLP encoded list of items in bytes.
+ function writeList(bytes[] memory _in) internal pure returns (bytes memory list_) {
+ list_ = _flatten(_in);
+ list_ = abi.encodePacked(_writeLength(list_.length, 192), list_);
+ }
+
+ /// @notice RLP encodes a string.
+ /// @param _in The string to encode.
+ /// @return out_ The RLP encoded string in bytes.
+ function writeString(string memory _in) internal pure returns (bytes memory out_) {
+ out_ = writeBytes(bytes(_in));
+ }
+
+ /// @notice RLP encodes an address.
+ /// @param _in The address to encode.
+ /// @return out_ The RLP encoded address in bytes.
+ function writeAddress(address _in) internal pure returns (bytes memory out_) {
+ out_ = writeBytes(abi.encodePacked(_in));
+ }
+
+ /// @notice RLP encodes a uint.
+ /// @param _in The uint256 to encode.
+ /// @return out_ The RLP encoded uint256 in bytes.
+ function writeUint(uint256 _in) internal pure returns (bytes memory out_) {
+ out_ = writeBytes(_toBinary(_in));
+ }
+
+ /// @notice RLP encodes a bool.
+ /// @param _in The bool to encode.
+ /// @return out_ The RLP encoded bool in bytes.
+ function writeBool(bool _in) internal pure returns (bytes memory out_) {
+ out_ = new bytes(1);
+ out_[0] = (_in ? bytes1(0x01) : bytes1(0x80));
+ }
+
+ /// @notice Encode the first byte and then the `len` in binary form if `length` is more than 55.
+ /// @param _len The length of the string or the payload.
+ /// @param _offset 128 if item is string, 192 if item is list.
+ /// @return out_ RLP encoded bytes.
+ function _writeLength(uint256 _len, uint256 _offset) private pure returns (bytes memory out_) {
+ if (_len < 56) {
+ out_ = new bytes(1);
+ out_[0] = bytes1(uint8(_len) + uint8(_offset));
+ } else {
+ uint256 lenLen;
+ uint256 i = 1;
+ while (_len / i != 0) {
+ lenLen++;
+ i *= 256;
+ }
+
+ out_ = new bytes(lenLen + 1);
+ out_[0] = bytes1(uint8(lenLen) + uint8(_offset) + 55);
+ for (i = 1; i <= lenLen; i++) {
+ out_[i] = bytes1(uint8((_len / (256 ** (lenLen - i))) % 256));
+ }
+ }
+ }
+
+ /// @notice Encode integer in big endian binary form with no leading zeroes.
+ /// @param _x The integer to encode.
+ /// @return out_ RLP encoded bytes.
+ function _toBinary(uint256 _x) private pure returns (bytes memory out_) {
+ bytes memory b = abi.encodePacked(_x);
+
+ uint256 i = 0;
+ for (; i < 32; i++) {
+ if (b[i] != 0) {
+ break;
+ }
+ }
+
+ out_ = new bytes(32 - i);
+ for (uint256 j = 0; j < out_.length; j++) {
+ out_[j] = b[i++];
+ }
+ }
+
+ /// @custom:attribution https://github.com/Arachnid/solidity-stringutils
+ /// @notice Copies a piece of memory to another location.
+ /// @param _dest Destination location.
+ /// @param _src Source location.
+ /// @param _len Length of memory to copy.
+ function _memcpy(uint256 _dest, uint256 _src, uint256 _len) private pure {
+ uint256 dest = _dest;
+ uint256 src = _src;
+ uint256 len = _len;
+
+ for (; len >= 32; len -= 32) {
+ assembly {
+ mstore(dest, mload(src))
+ }
+ dest += 32;
+ src += 32;
+ }
+
+ uint256 mask;
+ unchecked {
+ mask = 256 ** (32 - len) - 1;
+ }
+ assembly {
+ let srcpart := and(mload(src), not(mask))
+ let destpart := and(mload(dest), mask)
+ mstore(dest, or(destpart, srcpart))
+ }
+ }
+
+ /// @custom:attribution https://github.com/sammayo/solidity-rlp-encoder
+ /// @notice Flattens a list of byte strings into one byte string.
+ /// @param _list List of byte strings to flatten.
+ /// @return out_ The flattened byte string.
+ function _flatten(bytes[] memory _list) private pure returns (bytes memory out_) {
+ if (_list.length == 0) {
+ return new bytes(0);
+ }
+
+ uint256 len;
+ uint256 i = 0;
+ for (; i < _list.length; i++) {
+ len += _list[i].length;
+ }
+
+ out_ = new bytes(len);
+ uint256 flattenedPtr;
+ assembly {
+ flattenedPtr := add(out_, 0x20)
+ }
+
+ for (i = 0; i < _list.length; i++) {
+ bytes memory item = _list[i];
+
+ uint256 listPtr;
+ assembly {
+ listPtr := add(item, 0x20)
+ }
+
+ _memcpy(flattenedPtr, listPtr, item.length);
+ flattenedPtr += _list[i].length;
+ }
+ }
+}
diff --git a/packages/protocol/test/libs/LibTrieProof.t.sol b/packages/protocol/test/libs/LibTrieProof.t.sol
index 298e57d20b6..693a9896bd6 100644
--- a/packages/protocol/test/libs/LibTrieProof.t.sol
+++ b/packages/protocol/test/libs/LibTrieProof.t.sol
@@ -131,4 +131,44 @@ contract TestLibTrieProof is TaikoTest {
assertEq(storageRoot2, storageRoot);
}
+
+ function test_jeff_slot_value_not_1() public {
+ // signal service address on internal testnet l1
+ address addr = 0x83e383dec6E3C2CD167E3bF6aA8c36F0e55Ad910;
+ // signalService.getStorageSlot(event.srcchainid, event.Raw.Address [the bridge address on
+ // L1], event.MsgHash)
+ bytes32 slot = 0x07bfd8daaa640fc5f384ee9b5c1f8984e3075701525ff86aa1c6fe62b09fc2bc;
+ // block.Root() of the block used to get the proof
+ bytes32 stateRoot = 0x0883e3ee355161a08c1696409375ea33f4bb53a9121bc90bc4d69c4f285382aa;
+
+ bytes[] memory accountProof = new bytes[](3);
+ // eth_getProof responds some bytes
+ accountProof[0] =
+ hex"f90211a0f776494ecffe03ad2af2426ee4fb5ae66c012c03ea3955d5b40a52fe7c6b8df6a0ef4a67411e4accae9bbb05bbcc17d036432de4e3ee0b0d02a04ee6a67db9c1a5a06c4c8f2b3206553ec83f1081a6742edff2f7b7830d3ba4166872c4f3f32bae0ba0aa2e8d96490616498fa142ba7c6a628e2839b9b182c9995992ecf1c1d346784fa0f8d7262d0abdf5d084338a640322c4dd45b1484a630331922afa60256917058aa0e49099e467972084cd70025874c6ae0a6841159aec02f39384de2d9ae7460986a02ad2a355fe840ae1bfe7843616d6bb027c1fd478918cc956e0ca7b61ec0044d0a061ec8e714d951772d74765ae997bd25f3982ea8a0c4dda8baa1e47adbd5a3975a039e5f7e8298126da1e7d6f42b1f20846d68ff40dc857b0dd251d2791c0345589a065f4d771a35d862a10b2a2da6d7d6c1e082cd59280cbab1c8e6aaf89069e72dca07851c1d2a801228a1adb24b61a5b4e1d4e12c5043a0af1b1790cd79b281c43a0a031acf4e7bd8cfb52c19cb512fb2578f416cbcf28cd3b4387d7b6107a17d4ff31a09e8def26ad9cf07bfbba2cf4a3fad0fe4075030b9a67acbecbfa5b7bdc8620cca07174a59e7f5b71a1a20f8c4a232100c1303378a7eb5dd523904d5305e20ee7dca0199ae8cd6d2b09717d59b5106ef31b451b30d777296b4afb43db9327117471eca09193465aefe93e209d05f892f77002dd5c2e74d4eed502ebae3acb7db1e33acc80";
+ accountProof[1] =
+ hex"f8f1a0b4df476cf7a24306eb6b96d0a8fe974b88e035d93e6716cf56e3f6bacee15c88808080a09265834cbd374b79cc4f97cdab16770f4434bce18ff9724970bff1c91d54f2f1a0e13b8847e8cfc7fd465a61a64b732d940d8f87ed65828e1004e46fb4256aba48a05a7b35dc9c135fc4df95c4b02179719a3505d201fb590212cf41c31eae1ceb6980a07c46a7878ac08b149792973e8a17982311f3c997624aed0fde76ba45d9a1ba41a0ebfe5b284e549d79c976f878d93266d238d9ea3254d0ef9c199d2c5a12067de48080a05d5e60bc5b531718ba65199b06b68087c640472ef4b3afb7e4b857280edbf2e580808080";
+ accountProof[2] =
+ hex"f869a02024e130452851ed161bc592f5949e62d0e9b45d447bdfeef098148a98e92454b846f8440180a09a86a68eec0b73092dc0028cb4afb05332e85df8af2c9b0f67bbb750a4ada35da0dc679fd48cf611aa38e906adc93928c5f8f6fae534978ea2fa4f5935f5ed1b2c";
+
+ bytes[] memory storageProof = new bytes[](5);
+ storageProof[0] =
+ hex"f90211a062880ba06fb396ad4e16f01d22ca7a1ae677e3fe428817928db30e2cae96b97ca0aa57a805600be2304ffdd527bd3dc9e91161233dc59afb71c1aab542eafe70caa03bc6c86a4c6b49305b95b3812a162f7e6bec891b287ef291e9c468071ef0c4ada08ac85ec9872d9e6f5b4c6e72154158df88d44163457cf0bbf2134e385c871a4ea0f35f3c83fbd9da738bbfea1bc87b073d3b64abdecb6294b61cf3eb535eabefdea0905c9b0e1755d389f306f026ccb71f8f7e54cd68720cc1c76682504eeb7bceaea06867477d77649657f698380e66844a7ed14818e8aad9f4ac5748963ede640e0aa0caa272deb3227cb8b0765a718ac85bbc7ee93a04bc0a2cb9c5509c9394470eb3a01689508cc26d870b0183c13bee39ed5342bf32464813f872d7ea4e5bc5f79845a0b578886ee673adcdf7b219cd13d9d641f8e15dd9ec6c9345435e7968bc6bcc82a0fbd86d32d6c60089268373be401211c3b606efeb550659b9e43458007dce2eb6a035d73d30ad77c85ef247ab8473f71314a9d175c1e9a0ce73a78a103a3766f54ca0c08386bed5af43c7cadb42d9df7ba3b94886f483e8a2e66aaef7391a15ab51cba002ce1e689b6193a6d3a8c822b0b0076dfdf732fd045a4dc122ec3879fe3de70ea0db27c27a802c40acbde50e5c357e5327a91242e6550fe461eec10ac136ddddcea0ad6d871b4c62042c68f0ecfdb986a24ea7d850563bbd3d27f6916bc3ddd170a480";
+ storageProof[1] =
+ hex"f90211a05c9b8f83e3c03e07271225e2ebce1cbe9e7db3b14d2724ec6efe9cf8fce6fc06a0dbd4cd41e027eefe208271111ea3e99cb39b4645e7e166d084d62f427a9313ada0cc65078735257beecceb9c74985901fa16e8e9fb228ce6aaa62aedb282a1795fa012f4c2ae88c8f0396048da6a095d0fa2c8b86398651cd37a72d68d88d25ff19ea037cda349771733bba3681eda450fee72f5e3dcbb6b8f2acf4a2bd145d0bfad6da0ef1359be1a9f658e580c968b92029dbf62ce7a56932c10acce28b25bf7206665a037d9790673a2be78a1555bee7d37ab10d1b8d94d1f12bb011b7cc7257bf13004a0dd9b4774c203afaaeb098ab623ce32f1df6f8ff0ac1bbcb78e358b7a242cd19aa0dde51d1f37baae98d02b2e35c81030f17407fc31304ab72cf999bb2c7e8abff3a0f8672c12a366e074d6f42c2c7b0c5cc010bc4ec703c65e3b58c4fbfee18e89c2a057ba424e40bd1c6a8e7d494703f392e834d8ca7696759e2c0216ebd18bcf662fa01eafd299e8a772c056e6919eeb67bf7e1098129855234e942cfc18aaf364d39ea0df6b60bdf553e1511f445fdcf1fb7aadc23bf390eeb11145c9e2742552c2ed6da02e79f5afb8c177c40737cea4aed39fe3c0269f5a8989e02c07a0135594b83bb1a035535dac85afa0e4848c0186cc8687bc7d2de0215b97ea43e65c8e4da0a52517a08ce682327123eb41b4d49ef283ffe11d1da1b9d7163e892b775a63dd31072ec080";
+ storageProof[2] =
+ hex"f90211a0f40a5ee1ce9d240682f7f7af3c5950bba267b4b78e46c954d2b0f8d77da43a23a058e05fe5ccced350c75f8d4c495cd3db51c2d6215573df35178e32ddd7458ff9a06ce4c63e3b3d650248fe6b8d4efb02f5e460406a006ce732318cd5907a54625ba0b0c5eb8747f10eba341df8f0be99a8433654a4621cd0fcbd6ea24f6a5c3d3a82a0e98d81a5b3bc5f25ea24671e6b947bf2aa68c093d7c3bc946b6e71beb9f46df3a00b51ebdd2337cce7ae87e81412c668d305aefcfe25bbb46cc80b48520844adafa0312ebc38d28bbbcf414ed6c48cfb94d26be82bebf06795ca1ed8f088e340210fa066babdf1ddd352c84662fc3ba586a8dc1048bb4d99eea14b62cb389bff71e6fda08e9bde33f5da83fd3fbdc2c1358c67e321fccce1633039c44a689231a38c3a5ca0cc1d1601726ab0b999cf08fe2a87c29e480c97cb501601591c9a9cf0a0ab63dea0a6547a4b3a8647df43e5b81c5224284d4bf19bab142ed58fb28f5a7ff768ee2ca0b804617fff71909c150ae899e64c3cc07c73ea0b92e32a6033ce84a94a78cea9a0a207d46501ca64b8e3514b071d220f38eb545347cb1837f7acbf801d4e3f20fca0083b56370fe68526c7a36714ddb3e98c0ffc8c3d653e254de50e81a6548ddf03a057777667c151137326519774b769a478fa2f1a95df75e70f8972de7a50e25613a061aa71f8b8ea84ea22ed462f83cda58656815a941b458247f14f26b9f7104e1980";
+ storageProof[3] =
+ hex"f9013180a0bc1d276fab8bdca46e499a62df0598844a81dd822e5873a57cda01191549b1fca02e7323a53a6103bb95f23070328af116852a340bb8ce85780414f0ee46930f52a0632f43d1fd3bdd8d2e603fca74d2af51c60c1d23fe64cddb02a983779a4bacf1a011d0b3e5a1f1a3dd42b6f6ac95bd34a8044a25a5e99e33cebf730333438047438080a09937213f98b982f56a05cf65bf9113618da12308da8bf5a95c715456d0b91a0ca013844416bff2fdea9d9419e88f58a78728c14bd4e7ba678545ad33224bbea4f080a0de8762bd1bb07b389404f9d925f3bff2f6ea8675b8e89d089cfad9e21f2384b180a0e2be312f35cc32b95912918aa41fbd324a21b7a4acb39fc349b1e4768ca56e9080a052b7d13546e19995f0a3a422a980b8ff101be9494a68562c1e5266933ed25f7b8080";
+ storageProof[4] =
+ hex"f8429f20228b7509ed753c777c7f96e7105bab2dc7c2ceacb0ff8611edbd2189f583a1a00a793aea9233fc987a8f710991f16b576e23b67a15874faab4e18192aad8fd17";
+
+ LibTrieProof.verifyMerkleProof(
+ stateRoot,
+ addr,
+ slot,
+ hex"0a793aea9233fc987a8f710991f16b576e23b67a15874faab4e18192aad8fd17",
+ accountProof,
+ storageProof
+ );
+ }
}
From a01da4687f2b26a27dc12958109e5112e87baa60 Mon Sep 17 00:00:00 2001
From: David
Date: Fri, 23 Feb 2024 16:47:46 +0800
Subject: [PATCH 11/12] feat(protocol): add `UpgradeTierProvider` script
(#16017)
---
.../script/upgrade/UpgradeTierProvider.s.sol | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 packages/protocol/script/upgrade/UpgradeTierProvider.s.sol
diff --git a/packages/protocol/script/upgrade/UpgradeTierProvider.s.sol b/packages/protocol/script/upgrade/UpgradeTierProvider.s.sol
new file mode 100644
index 00000000000..b1553c50add
--- /dev/null
+++ b/packages/protocol/script/upgrade/UpgradeTierProvider.s.sol
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: MIT
+// _____ _ _ _ _
+// |_ _|_ _(_) |_____ | | __ _| |__ ___
+// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
+// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
+//
+// Email: security@taiko.xyz
+// Website: https://taiko.xyz
+// GitHub: https://github.com/taikoxyz
+// Discord: https://discord.gg/taikoxyz
+// Twitter: https://twitter.com/taikoxyz
+// Blog: https://mirror.xyz/labs.taiko.eth
+// Youtube: https://www.youtube.com/@taikoxyz
+
+pragma solidity 0.8.24;
+
+import "../../test/DeployCapability.sol";
+import "../../contracts/L1/gov/TaikoTimelockController.sol";
+import "../../contracts/L1/tiers/ITierProvider.sol";
+import "../../contracts/L1/tiers/TaikoA6TierProvider.sol";
+
+contract UpgradeTierProvider is DeployCapability {
+ uint256 public privateKey = vm.envUint("PRIVATE_KEY");
+ address public timelockAddress = vm.envAddress("TIMELOCK_ADDRESS");
+ address public addressManagerAddress = vm.envAddress("ADDRESS_MANAGER_ADDRESS");
+
+ function run() external {
+ vm.startBroadcast(privateKey);
+
+ ITierProvider newTierProvider = new TaikoA6TierProvider();
+
+ registerByTimelock(
+ addressManagerAddress, "tier_provider", address(newTierProvider), uint64(block.chainid)
+ );
+
+ vm.stopBroadcast();
+ }
+
+ function registerByTimelock(
+ address registerTo,
+ string memory name,
+ address addr,
+ uint64 chainId
+ )
+ internal
+ {
+ bytes32 salt = bytes32(block.timestamp);
+
+ bytes memory payload =
+ abi.encodeCall(AddressManager.setAddress, (chainId, bytes32(bytes(name)), addr));
+
+ TaikoTimelockController timelock = TaikoTimelockController(payable(timelockAddress));
+
+ timelock.schedule(registerTo, 0, payload, bytes32(0), salt, 0);
+
+ timelock.execute(registerTo, 0, payload, bytes32(0), salt);
+
+ console2.log("> ", name, "@", registerTo);
+ console2.log("\t addr : ", addr);
+ }
+}
From f7a12b8601937eef97068c3029c91dff431c03a8 Mon Sep 17 00:00:00 2001
From: Daniel Wang <99078276+dantaik@users.noreply.github.com>
Date: Fri, 23 Feb 2024 18:56:58 +0800
Subject: [PATCH 12/12] fix(protocol): mandate bridge message only calls
onMessageInvocation (#15996)
Co-authored-by: D <51912515+adaki2004@users.noreply.github.com>
---
.../protocol/contracts/L2/CrossChainOwned.sol | 14 ++++---
packages/protocol/contracts/bridge/Bridge.sol | 13 +++++-
.../protocol/contracts/bridge/IBridge.sol | 9 ++++
.../contracts/common/EssentialContract.sol | 1 +
.../contracts/tokenvault/BaseVault.sol | 7 +++-
.../contracts/tokenvault/ERC1155Vault.sol | 41 +++++++++----------
.../contracts/tokenvault/ERC20Vault.sol | 30 ++++++--------
.../contracts/tokenvault/ERC721Vault.sol | 30 ++++++--------
packages/protocol/test/HelperContracts.sol | 5 ++-
packages/protocol/test/bridge/Bridge.t.sol | 2 +-
.../test/tokenvault/ERC1155Vault.t.sol | 4 +-
.../protocol/test/tokenvault/ERC20Vault.t.sol | 4 +-
.../test/tokenvault/ERC721Vault.t.sol | 4 +-
13 files changed, 91 insertions(+), 73 deletions(-)
diff --git a/packages/protocol/contracts/L2/CrossChainOwned.sol b/packages/protocol/contracts/L2/CrossChainOwned.sol
index 132cf651fd3..461f276fb36 100644
--- a/packages/protocol/contracts/L2/CrossChainOwned.sol
+++ b/packages/protocol/contracts/L2/CrossChainOwned.sol
@@ -24,23 +24,27 @@ import "../bridge/IBridge.sol";
/// signals for transaction approval.
/// @dev Notice that when sending the message on the owner chain, the gas limit of the message must
/// not be zero, so on this chain, some EOA can help execute this transaction.
-abstract contract CrossChainOwned is EssentialContract {
+abstract contract CrossChainOwned is EssentialContract, IMessageInvocable {
uint64 public ownerChainId; // slot 1
uint64 public nextTxId;
uint256[49] private __gap;
event TransactionExecuted(uint64 indexed txId, bytes4 indexed selector);
- error XCO_INVALID_TX_ID();
error XCO_INVALID_OWNER_CHAINID();
+ error XCO_INVALID_TX_ID();
error XCO_PERMISSION_DENIED();
error XCO_TX_REVERTED();
- function executeCrossChainTransaction(uint64 txId, bytes calldata txdata) external {
+ function onMessageInvocation(bytes calldata data)
+ external
+ payable
+ whenNotPaused
+ onlyFromNamed("bridge")
+ {
+ (uint64 txId, bytes memory txdata) = abi.decode(data, (uint64, bytes));
if (txId != nextTxId) revert XCO_INVALID_TX_ID();
- if (msg.sender != resolve("bridge", false)) revert XCO_PERMISSION_DENIED();
-
IBridge.Context memory ctx = IBridge(msg.sender).context();
if (ctx.srcChainId != ownerChainId || ctx.from != owner()) {
revert XCO_PERMISSION_DENIED();
diff --git a/packages/protocol/contracts/bridge/Bridge.sol b/packages/protocol/contracts/bridge/Bridge.sol
index f6d0e477d98..8c4e0b0bc9d 100644
--- a/packages/protocol/contracts/bridge/Bridge.sol
+++ b/packages/protocol/contracts/bridge/Bridge.sol
@@ -14,6 +14,7 @@
pragma solidity 0.8.24;
+import "@openzeppelin/contracts/utils/Address.sol";
import "../common/EssentialContract.sol";
import "../libs/LibAddress.sol";
import "../signal/ISignalService.sol";
@@ -24,6 +25,7 @@ import "./IBridge.sol";
/// @notice See the documentation for {IBridge}.
/// @dev The code hash for the same address on L1 and L2 may be different.
contract Bridge is EssentialContract, IBridge {
+ using Address for address;
using LibAddress for address;
using LibAddress for address payable;
@@ -528,8 +530,15 @@ contract Bridge is EssentialContract, IBridge {
_storeContext({ msgHash: msgHash, from: message.from, srcChainId: message.srcChainId });
- // Perform the message call and capture the success value
- (success,) = message.to.call{ value: message.value, gas: gasLimit }(message.data);
+ if (
+ message.data.length >= 4 // msg can be empty
+ && bytes4(message.data) != IMessageInvocable.onMessageInvocation.selector
+ && message.to.isContract()
+ ) {
+ success = false;
+ } else {
+ (success,) = message.to.call{ value: message.value, gas: gasLimit }(message.data);
+ }
// Reset the context after the message call
_resetContext();
diff --git a/packages/protocol/contracts/bridge/IBridge.sol b/packages/protocol/contracts/bridge/IBridge.sol
index db509f1e4e8..ab2f5e535fe 100644
--- a/packages/protocol/contracts/bridge/IBridge.sol
+++ b/packages/protocol/contracts/bridge/IBridge.sol
@@ -80,3 +80,12 @@ interface IRecallableSender {
external
payable;
}
+
+/// @title IMessageInvocable
+/// @notice An interface that all bridge message receiver shall implement
+interface IMessageInvocable {
+ /// @notice Called when this contract is the bridge target.
+ /// @param data The data for this contract to interpret.
+ /// @dev This method should be guarded with `onlyFromNamed("bridge")`.
+ function onMessageInvocation(bytes calldata data) external payable;
+}
diff --git a/packages/protocol/contracts/common/EssentialContract.sol b/packages/protocol/contracts/common/EssentialContract.sol
index beacb412704..f522369da51 100644
--- a/packages/protocol/contracts/common/EssentialContract.sol
+++ b/packages/protocol/contracts/common/EssentialContract.sol
@@ -36,6 +36,7 @@ abstract contract EssentialContract is OwnerUUPSUpgradable, AddressResolver {
}
/// @notice Initializes the contract without an address manager.
+ // solhint-disable-next-line func-name-mixedcase
function __Essential_init() internal virtual {
__Essential_init(address(0));
}
diff --git a/packages/protocol/contracts/tokenvault/BaseVault.sol b/packages/protocol/contracts/tokenvault/BaseVault.sol
index 38dba2c7c99..8d58739f181 100644
--- a/packages/protocol/contracts/tokenvault/BaseVault.sol
+++ b/packages/protocol/contracts/tokenvault/BaseVault.sol
@@ -20,7 +20,12 @@ import "../common/EssentialContract.sol";
import "../libs/LibAddress.sol";
import "../libs/LibDeploy.sol";
-abstract contract BaseVault is EssentialContract, IRecallableSender, IERC165Upgradeable {
+abstract contract BaseVault is
+ EssentialContract,
+ IRecallableSender,
+ IMessageInvocable,
+ IERC165Upgradeable
+{
error VAULT_PERMISSION_DENIED();
modifier onlyFromBridge() {
diff --git a/packages/protocol/contracts/tokenvault/ERC1155Vault.sol b/packages/protocol/contracts/tokenvault/ERC1155Vault.sol
index 83e09bb4c62..a6c600d2069 100644
--- a/packages/protocol/contracts/tokenvault/ERC1155Vault.sol
+++ b/packages/protocol/contracts/tokenvault/ERC1155Vault.sol
@@ -92,28 +92,20 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable {
});
}
- /// @notice This function can only be called by the bridge contract while
- /// invoking a message call. See sendToken, which sets the data to invoke
- /// this function.
- /// @param ctoken The canonical ERC1155 token which may or may not live on
- /// this chain. If not, a BridgedERC1155 contract will be deployed.
- /// @param from The source address.
- /// @param to The destination address.
- /// @param tokenIds The tokenIds to be sent.
- /// @param amounts The amounts to be sent.
- function receiveToken(
- CanonicalNFT calldata ctoken,
- address from,
- address to,
- uint256[] memory tokenIds,
- uint256[] memory amounts
- )
- external
- payable
- nonReentrant
- whenNotPaused
+ /// @inheritdoc IMessageInvocable
+ function onMessageInvocation(bytes calldata data) external payable nonReentrant whenNotPaused
+ // onlyFromBridge
{
+ (
+ CanonicalNFT memory ctoken,
+ address from,
+ address to,
+ uint256[] memory tokenIds,
+ uint256[] memory amounts
+ ) = abi.decode(data, (CanonicalNFT, address, address, uint256[], uint256[]));
+
// Check context validity
+ // `onlyFromBridge` checked in checkProcessMessageContext
IBridge.Context memory ctx = checkProcessMessageContext();
// Don't allow sending to disallowed addresses.
@@ -146,11 +138,14 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable {
override
nonReentrant
whenNotPaused
+ // onlyFromBridge
{
+ // `onlyFromBridge` checked in checkRecallMessageContext
checkRecallMessageContext();
+ (bytes memory _data) = abi.decode(message.data[4:], (bytes));
(CanonicalNFT memory ctoken,,, uint256[] memory tokenIds, uint256[] memory amounts) =
- abi.decode(message.data[4:], (CanonicalNFT, address, address, uint256[], uint256[]));
+ abi.decode(_data, (CanonicalNFT, address, address, uint256[], uint256[]));
// Transfer the ETH and tokens back to the owner
address token = _transferTokens(ctoken, message.srcOwner, tokenIds, amounts);
@@ -287,7 +282,9 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable {
}
}
}
- msgData = abi.encodeCall(this.receiveToken, (ctoken, user, op.to, op.tokenIds, op.amounts));
+ msgData = abi.encodeCall(
+ this.onMessageInvocation, abi.encode(ctoken, user, op.to, op.tokenIds, op.amounts)
+ );
}
/// @dev Retrieve or deploy a bridged ERC1155 token contract.
diff --git a/packages/protocol/contracts/tokenvault/ERC20Vault.sol b/packages/protocol/contracts/tokenvault/ERC20Vault.sol
index 567b709c5d2..5290977a012 100644
--- a/packages/protocol/contracts/tokenvault/ERC20Vault.sol
+++ b/packages/protocol/contracts/tokenvault/ERC20Vault.sol
@@ -211,22 +211,14 @@ contract ERC20Vault is BaseVault {
});
}
- /// @notice Receive bridged ERC20 tokens and Ether.
- /// @param ctoken Canonical ERC20 data for the token being received.
- /// @param from Source address.
- /// @param to Destination address.
- /// @param amount Amount of tokens being received.
- function receiveToken(
- CanonicalERC20 calldata ctoken,
- address from,
- address to,
- uint256 amount
- )
- external
- payable
- nonReentrant
- whenNotPaused
+ /// @inheritdoc IMessageInvocable
+ function onMessageInvocation(bytes calldata data) external payable nonReentrant whenNotPaused
+ // onlyFromBridge
{
+ (CanonicalERC20 memory ctoken, address from, address to, uint256 amount) =
+ abi.decode(data, (CanonicalERC20, address, address, uint256));
+
+ // `onlyFromBridge` checked in checkProcessMessageContext
IBridge.Context memory ctx = checkProcessMessageContext();
// Don't allow sending to disallowed addresses.
@@ -257,11 +249,14 @@ contract ERC20Vault is BaseVault {
override
nonReentrant
whenNotPaused
+ // onlyFromBridge
{
+ // `onlyFromBridge` checked in checkRecallMessageContext
checkRecallMessageContext();
+ (bytes memory _data) = abi.decode(message.data[4:], (bytes));
(CanonicalERC20 memory ctoken,,, uint256 amount) =
- abi.decode(message.data[4:], (CanonicalERC20, address, address, uint256));
+ abi.decode(_data, (CanonicalERC20, address, address, uint256));
// Transfer the ETH and tokens back to the owner
address token = _transferTokens(ctoken, message.srcOwner, amount);
@@ -342,7 +337,8 @@ contract ERC20Vault is BaseVault {
balanceChange = t.balanceOf(address(this)) - _balance;
}
- msgData = abi.encodeCall(this.receiveToken, (ctoken, user, to, balanceChange));
+ msgData =
+ abi.encodeCall(this.onMessageInvocation, abi.encode(ctoken, user, to, balanceChange));
}
/// @dev Retrieve or deploy a bridged ERC20 token contract.
diff --git a/packages/protocol/contracts/tokenvault/ERC721Vault.sol b/packages/protocol/contracts/tokenvault/ERC721Vault.sol
index 0c3151f27b9..d4d9b3ebeba 100644
--- a/packages/protocol/contracts/tokenvault/ERC721Vault.sol
+++ b/packages/protocol/contracts/tokenvault/ERC721Vault.sol
@@ -80,22 +80,14 @@ contract ERC721Vault is BaseNFTVault, IERC721ReceiverUpgradeable {
});
}
- /// @notice Receive bridged ERC721 tokens and handle them accordingly.
- /// @param ctoken Canonical NFT data for the token being received.
- /// @param from Source address.
- /// @param to Destination address.
- /// @param tokenIds Array of token IDs being received.
- function receiveToken(
- CanonicalNFT calldata ctoken,
- address from,
- address to,
- uint256[] memory tokenIds
- )
- external
- payable
- nonReentrant
- whenNotPaused
+ /// @inheritdoc IMessageInvocable
+ function onMessageInvocation(bytes calldata data) external payable nonReentrant whenNotPaused
+ // onlyFromBridge
{
+ (CanonicalNFT memory ctoken, address from, address to, uint256[] memory tokenIds) =
+ abi.decode(data, (CanonicalNFT, address, address, uint256[]));
+
+ // `onlyFromBridge` checked in checkProcessMessageContext
IBridge.Context memory ctx = checkProcessMessageContext();
// Don't allow sending to disallowed addresses.
@@ -128,11 +120,14 @@ contract ERC721Vault is BaseNFTVault, IERC721ReceiverUpgradeable {
override
nonReentrant
whenNotPaused
+ // onlyFromBridge
{
+ // `onlyFromBridge` checked in checkRecallMessageContext
checkRecallMessageContext();
+ (bytes memory _data) = abi.decode(message.data[4:], (bytes));
(CanonicalNFT memory ctoken,,, uint256[] memory tokenIds) =
- abi.decode(message.data[4:], (CanonicalNFT, address, address, uint256[]));
+ abi.decode(_data, (CanonicalNFT, address, address, uint256[]));
// Transfer the ETH and tokens back to the owner
address token = _transferTokens(ctoken, message.srcOwner, tokenIds);
@@ -226,7 +221,8 @@ contract ERC721Vault is BaseNFTVault, IERC721ReceiverUpgradeable {
}
}
- msgData = abi.encodeCall(this.receiveToken, (ctoken, user, op.to, op.tokenIds));
+ msgData =
+ abi.encodeCall(this.onMessageInvocation, abi.encode(ctoken, user, op.to, op.tokenIds));
}
/// @dev Retrieve or deploy a bridged ERC721 token contract.
diff --git a/packages/protocol/test/HelperContracts.sol b/packages/protocol/test/HelperContracts.sol
index 2fc9a4663ea..b8f28a73146 100644
--- a/packages/protocol/test/HelperContracts.sol
+++ b/packages/protocol/test/HelperContracts.sol
@@ -18,10 +18,11 @@ contract BadReceiver {
}
}
-contract GoodReceiver {
+contract GoodReceiver is IMessageInvocable {
receive() external payable { }
- function forward(address addr) public payable {
+ function onMessageInvocation(bytes calldata data) public payable {
+ address addr = abi.decode(data, (address));
payable(addr).transfer(address(this).balance / 2);
}
}
diff --git a/packages/protocol/test/bridge/Bridge.t.sol b/packages/protocol/test/bridge/Bridge.t.sol
index d9a11499e5f..418654eec54 100644
--- a/packages/protocol/test/bridge/Bridge.t.sol
+++ b/packages/protocol/test/bridge/Bridge.t.sol
@@ -318,7 +318,7 @@ contract BridgeTest is TaikoTest {
value: 1000,
fee: 1000,
gasLimit: 1_000_000,
- data: abi.encodeCall(GoodReceiver.forward, (Carol)),
+ data: abi.encodeCall(GoodReceiver.onMessageInvocation, abi.encode(Carol)),
memo: ""
});
// Mocking proof - but obviously it needs to be created in prod
diff --git a/packages/protocol/test/tokenvault/ERC1155Vault.t.sol b/packages/protocol/test/tokenvault/ERC1155Vault.t.sol
index f029a0ed369..d4704d7c0f2 100644
--- a/packages/protocol/test/tokenvault/ERC1155Vault.t.sol
+++ b/packages/protocol/test/tokenvault/ERC1155Vault.t.sol
@@ -72,8 +72,8 @@ contract PrankDestBridge {
// a contract
// most probably due to some deployment address nonce issue. (Seems a
// known issue).
- destERC1155Vault.receiveToken{ value: mockLibInvokeMsgValue }(
- ctoken, from, to, tokenIds, amounts
+ destERC1155Vault.onMessageInvocation{ value: mockLibInvokeMsgValue }(
+ abi.encode(ctoken, from, to, tokenIds, amounts)
);
ctx.sender = address(0);
diff --git a/packages/protocol/test/tokenvault/ERC20Vault.t.sol b/packages/protocol/test/tokenvault/ERC20Vault.t.sol
index 0d9f07988bf..68af505f05a 100644
--- a/packages/protocol/test/tokenvault/ERC20Vault.t.sol
+++ b/packages/protocol/test/tokenvault/ERC20Vault.t.sol
@@ -51,8 +51,8 @@ contract PrankDestBridge {
// The problem (with foundry) is that this way it is not able to deploy
// a contract most probably due to some deployment address nonce issue. (Seems a known
// issue).
- destERC20Vault.receiveToken{ value: mockLibInvokeMsgValue }(
- canonicalToken, from, to, amount
+ destERC20Vault.onMessageInvocation{ value: mockLibInvokeMsgValue }(
+ abi.encode(canonicalToken, from, to, amount)
);
ctx.sender = address(0);
diff --git a/packages/protocol/test/tokenvault/ERC721Vault.t.sol b/packages/protocol/test/tokenvault/ERC721Vault.t.sol
index 4329a72e6ed..570904d0236 100644
--- a/packages/protocol/test/tokenvault/ERC721Vault.t.sol
+++ b/packages/protocol/test/tokenvault/ERC721Vault.t.sol
@@ -87,8 +87,8 @@ contract PrankDestBridge {
// a contract
// most probably due to some deployment address nonce issue. (Seems a
// known issue).
- destERC721Vault.receiveToken{ value: mockLibInvokeMsgValue }(
- canonicalToken, from, to, tokenIds
+ destERC721Vault.onMessageInvocation{ value: mockLibInvokeMsgValue }(
+ abi.encode(canonicalToken, from, to, tokenIds)
);
ctx.sender = address(0);