-
Notifications
You must be signed in to change notification settings - Fork 75
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
docs: Add On-chain tracking page #671
base: main
Are you sure you want to change the base?
Conversation
Branch preview✅ Deployed successfully in branch deployment: |
Overall readability score: 31.23 (🔴 -0.08)
View detailed metrics🟢 - Shows an increase in readability
Averages:
View metric targets
|
|
||
### Track Safe deployments | ||
|
||
Safe deployments can be tracked by assigning an on-chain identifier to the [`paymentReceiver`](../reference-smart-account/setup/setup.mdx#paymentreceiver) or [`saltNonce`](https://github.com/safe-global/safe-smart-account/blob/main/contracts/proxies/SafeProxyFactory.sol#L55) properties during the Safe configuration and deployment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The on-chain identifier will always be appended to the end of the data
field of the deployment transaction, both for Safe deployments and Safe transactions. Using the paymentReceiver
or saltNonce
was an initial idea, but it's not part of the final implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know that is how the SDK works, but here it refers about the different options that exist for people using onchain tracking without the SDK. This sections has two paragrap: the initial one that shows the different options and the second one that shows how the SDK works. I will make it more explicit that the SDK only uses data
.
import Safe, { OnchainAnalyticsProps } from '@safe-global/protocol-kit' | ||
|
||
const onchainAnalytics: OnchainAnalyticsProps = { | ||
project: 'YOUR_PROJECT_NAME' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we add a comment like this to help developers better understand? It clarifies that the project field is mandatory and should remain consistent for each project:
project: 'YOUR_PROJECT_NAME' // Required. Always use the same value for your project, e.g., 'Cow Swap' or 'AAVE'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I will make a reference that this field is linked to the Project hash
explained in the format section.
Should we include the new |
I think that some external projects were interested in implementing their own solution compatible with our onchain identifier. Should we add a simple entry in the documentation to guide them? We could explain how to use function generateOnChainIdentifier({
project,
platform = 'Web',
tool,
toolVersion
}: OnChainIdentifierParamsType): string {
const identifierPrefix = '5afe'
const identifierVersion = '00' // first version
const projectHash = generateHash(project, 20) // Take the last 20 bytes
const platformHash = generateHash(platform, 3) // Take the last 3 bytes
const toolHash = generateHash(tool, 3) // Take the last 3 bytes
const toolVersionHash = generateHash(toolVersion, 3) // Take the last 3 bytes
return `${identifierPrefix}${identifierVersion}${projectHash}${platformHash}${toolHash}${toolVersionHash}`
}
export function generateHash(input: string, size: number): string {
const fullHash = keccak256(toHex(input))
return toHex(fullHash.slice(-size)).replace('0x', '') // Take the last X bytes
} |
Context
This PR: