From b0d47d74ae9f0980829945383ccc0c61df02252b Mon Sep 17 00:00:00 2001 From: b00ste Date: Thu, 21 Sep 2023 17:46:06 +0300 Subject: [PATCH] docs: add links to overview docs --- .../contracts/overview/LSP17ContractExtension.md | 12 ++++++------ docs/contracts/overview/UniversalProfile.md | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/contracts/overview/LSP17ContractExtension.md b/docs/contracts/overview/LSP17ContractExtension.md index 093d5adc5e..857917c362 100644 --- a/docs/contracts/overview/LSP17ContractExtension.md +++ b/docs/contracts/overview/LSP17ContractExtension.md @@ -12,11 +12,11 @@ Contracts that use the LSP17 standard are called **Extendable Contracts**. Meani The list of extensions for specific functions are stored under the specific data keys under their ERC725Y storage. You can think of them as **Extension Hosts**. -You can inherit the `LSP17Extendable.sol` contract to create an extendable contract. +You can inherit the [`LSP17Extendable.sol`](../contracts/LSP17ContractExtension/LSP17Extendable.md) contract to create an extendable contract. :::warning -Be aware that adding an extension that can `selfdestruct` itself can be dangerous. This can make the `LSP17Extendable` contract vulnerable to [metamorphic contracts](https://twitter.com/samczsun/status/1660012956632104960). +Be aware that adding an extension that can `selfdestruct` itself can be dangerous. This can make the [`LSP17Extendable`](../contracts/LSP17ContractExtension/LSP17Extendable.md) contract vulnerable to [metamorphic contracts](https://twitter.com/samczsun/status/1660012956632104960). If this extension contract has been deployed at a pre-determined address with `CREATE2`, an attacker could `selfdestruct` it and deploy a new one with different runtime bytecode using `CREATE2` and the same salt and initialization code as on the first deployment. @@ -26,9 +26,9 @@ This can result in the new contract to have the same address but different funct ### Forwarding native tokens received to extensions -The `LSP17Extendable` contract implementation does not forward by default the native tokens received by the contract to the extension contract. +The [`LSP17Extendable`](../contracts/LSP17ContractExtension/LSP17Extendable.md) contract implementation does not forward by default the native tokens received by the contract to the extension contract. -If you want your extension to receive native tokens, by forwarding them to the extension contract (for instance, for extensions that require native tokens as part of their logic, or to make the extendable contract to fully work as a _"proxy forwarder contract"_), you can override the `_fallbackLSP17Extendable(...)` function. +If you want your extension to receive native tokens, by forwarding them to the extension contract (for instance, for extensions that require native tokens as part of their logic, or to make the extendable contract to fully work as a _"proxy forwarder contract"_), you can override the [`_fallbackLSP17Extendable`](../contracts/LSP17ContractExtension/LSP17Extendable.md#_fallbacklsp17extendable) function. @@ -37,7 +37,7 @@ If you want your extension to receive native tokens, by forwarding them to the e Extension contracts are contracts deployed on the network that aim to be used for extending functionalities that use the LSP17 standard. -You can inherit the `LSP17Extension.sol` contract to create a contract extension. +You can inherit the [`LSP17Extendable.sol`](../contracts/LSP17ContractExtension/LSP17Extendable.md) contract to create a contract extension. :::warning @@ -55,7 +55,7 @@ if (msg.value == 0) revert(...) ### Checking the amount of native tokens received by the extended contract -You can use the function `_extendableMsgValue()` function to check the amount of native tokens received by the extended contract in the first place. +You can use the function [`_extendableMsgValue()`](../contracts/LSP17ContractExtension/LSP17Extension.md#_extendablemsgvalue) function to check the amount of native tokens received by the extended contract in the first place. This function can be useful if you want to create a behaviour in your extension contract that takes into account that the `msg.value` received. For instance: diff --git a/docs/contracts/overview/UniversalProfile.md b/docs/contracts/overview/UniversalProfile.md index e7a6910cf9..ad05f1a2c1 100644 --- a/docs/contracts/overview/UniversalProfile.md +++ b/docs/contracts/overview/UniversalProfile.md @@ -21,11 +21,11 @@ A `UniversalProfile` has all the basic functionalities of an _Externally Owned A - [`universalReceiver(...)`](#universalreceiver): brings notification of incoming calls and assets. - [`setData(...)`](#setdata): offers to set information in the account storage. -All ownable functions such as `execute(..)`, `setData(..)`, `transferOwnership(..)`, and `renounceOwnership(..)` can be called by the owner +All ownable functions such as [`execute(..)`](../contracts/UniversalProfile.md#execute), [`executeBatch(..)`](../contracts/UniversalProfile.md#executebatch), [`setData(..)`](../contracts/UniversalProfile.md#setdata), [`setDataBatch(..)`](../contracts/UniversalProfile.md#setdatabatch), [`transferOwnership(..)`](../contracts/UniversalProfile.md#transferownership), and [`renounceOwnership(..)`](../contracts/UniversalProfile.md#renounceownership) can be called by the owner The contract also includes the [LSP20-CallVerification](../../standards/universal-profile/lsp0-erc725account.md#lsp20---call-verification) at its core. Meaning if the contract is owned by an other contract, LSP20 enables to interact with the contract directly without having to resolve through its owner first. This allows seamless integrations with other contracts, protocols and dApps, as the contract can be called directly, making the developer experience easier. -To illustrate, if an other address than the owner calls the `execute(..)` function, the account contract will: +To illustrate, if an other address than the owner calls the [`execute(..)`](../contracts/UniversalProfile.md#execute) function, the account contract will: 1. Forward the call to the owner. 2. The execution of the function will only continue if the owner returns the `LSP20 MAGIC VALUE`, indicating that the caller is allowed to execute the function. @@ -36,7 +36,7 @@ The structure allows the account to have a more dynamic and adaptable approach f ## Extensions -An `LSP0ERC725Account` has the functionalities of `LSP17Extendable` built-in. This allows extending its behavior with functions it does not support natively in its interface. +An [`LSP0ERC725Account`](../contracts/LSP0ERC725Account/LSP0ERC725Account.md) has the functionalities of [`LSP17Extendable`](../contracts/LSP17ContractExtension/LSP17Extendable.md) built-in. This allows extending its behavior with functions it does not support natively in its interface. However, calls to the `fallback` function will revert if no extension is registered for the function selector that was called. @@ -49,21 +49,21 @@ The only exception is the `0x00000000` function selector, which returns in order :::caution If your Universal Profile calls an extension to perform some security check, verification or validation, you should not rely on the extension to revert to ensure -the validation failed, but check the `bytes` returned by the extension through `_fallbackLSP17Extendable`. +the validation failed, but check the `bytes` returned by the extension through [`_fallbackLSP17Extendable`](../contracts/LSP17ContractExtension/LSP17Extendable.md#_fallbacklsp17extendable). ::: :::caution -Be aware of phantom functions for functions in extensions with the `0x00000000` selector. +Be aware of [phantom functions](https://media.dedaub.com/phantom-functions-and-the-billion-dollar-no-op-c56f062ae49f) for functions in extensions with the `0x00000000` selector. For example, a contract might perform some kind of validation in an extension (_e.g: checking for permissions_), and expect the function to revert if the user is not authorized. However, since the function's selector is `0x00000000` and the LSP0 account doesn't have this extension registered, the `fallback` function will `return` instead of reverting, giving the contract the impression that the user is authorized. -> See `_fallbackLSP17Extendable` for more details. +> See [`_fallbackLSP17Extendable`](../contracts/LSP17ContractExtension/LSP17Extendable.md#_fallbacklsp17extendable) for more details. -In such case, make sure to double that an extension is registered first for the `0x00000000` selector via `_getExtension`. +In such case, make sure to double that an extension is registered first for the `0x00000000` selector via [`_getExtension`](../contracts/LSP17ContractExtension/LSP17Extendable.md#_getextension). ::: @@ -71,7 +71,7 @@ In such case, make sure to double that an extension is registered first for the Unlike private keys and EOAs that cannot hold any metadata, a UniversalProfile is a blockchain based account that can have any info attached to it. -You can do so using the `setData(bytes32,bytes)` and `setDataBatch(bytes32[],bytes[])` functions to add, update or delete any metadata in your Universal Profile. +You can do so using the [`setData(bytes32,bytes)`](../contracts/UniversalProfile.md#setdata) and [`setDataBatch(bytes32[],bytes[])`](../contracts/UniversalProfile.md#setdatabatch) functions to add, update or delete any metadata in your Universal Profile. ### Updating your `LSP3Profile` metadata.