Skip to content
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

Append EVM function name to unencrypted verified contract calls #1516

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lukaw3d
Copy link
Member

@lukaw3d lukaw3d commented Aug 22, 2024

Part of #1222

@lukaw3d lukaw3d requested a review from donouwens August 22, 2024 02:43
Copy link

github-actions bot commented Aug 22, 2024

Deployed to Cloudflare Pages

Latest commit: 7612e2b9e1c86f687882ecdcc6abfa62aa5b7cb2
Status:✅ Deploy successful!
Preview URL: https://a86af82c.oasis-explorer.pages.dev
Alias: https://pr-1516.oasis-explorer.pages.dev

@lukaw3d lukaw3d changed the title Append EVM function name to verified contract calls Append EVM function name to unencrypted verified contract calls Aug 22, 2024
@lukaw3d
Copy link
Member Author

lukaw3d commented Aug 22, 2024

Added function names in transactions tables
https://00b47000.oasis-explorer.pages.dev/testnet/sapphire/address/0xC3ecf872F643C6238Aa20673798eed6F7dA199e9
image

Added parameters in transaction details view
https://00b47000.oasis-explorer.pages.dev/testnet/sapphire/tx/0x22c3c69ca9d42edd0fc0f945b969f3fbe7f574aca815379475f1e636c38c766e
image

@lukaw3d
Copy link
Member Author

lukaw3d commented Aug 22, 2024

TODO:

@donouwens
Copy link
Collaborator

Sorry, just to make it formal - this looks good to me @lukaw3d

Only nit is for mobile. I think we should vertically align the icon at the top on mobile (see current 'before' image vs the after option).

before after

Comment on lines 99 to 166
if (transaction.to_eth === '0x0100000000000000000000000000000000000103' && transaction.body?.data) {
// Subcall precompile
try {
const coder = AbiCoder.defaultAbiCoder()
const [methodName, cborHexArgs] = coder.decode(['string', 'bytes'], base64ToHex(transaction.body.data))
label += `: ${methodName}`

if (!truncate) {
const rawArgs = oasis.misc.fromCBOR(hexToBytes(cborHexArgs))
if (rawArgs === null) {
label += `(null)`
} else if (typeof rawArgs === 'object' && !Array.isArray(rawArgs)) {
const jsonArgs = JSON.stringify(
rawArgs,
(key, value) => {
if (value instanceof Uint8Array) {
if (key === 'from') return oasis.staking.addressToBech32(value)
if (key === 'to') return oasis.staking.addressToBech32(value)
if (key === 'shares') return oasis.quantity.toBigInt(value).toLocaleString()
return `0x${oasis.misc.toHex(value)}`
}
if (Array.isArray(value) && value.length === 2) {
if (key === 'amount') {
return [
oasis.quantity.toBigInt(value[0]).toLocaleString(),
oasis.misc.toStringUTF8(value[1]),
]
}
}
return value
},
2,
)
label += `(${jsonArgs})`
}
}
} catch (e) {
console.error('Failed to parse subcall data (might be malformed)', e, transaction)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukaw3d
Copy link
Member Author

lukaw3d commented Sep 13, 2024

TODO
now
image

mocks
image

@lukaw3d lukaw3d self-assigned this Oct 22, 2024
@lukaw3d lukaw3d removed their assignment Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants