Skip to content

Commit

Permalink
Merge branch 'main' into faq-overhaul-lukso
Browse files Browse the repository at this point in the history
  • Loading branch information
fhildeb authored Jul 11, 2023
2 parents 215b070 + acb4dc6 commit 0ca1b3a
Show file tree
Hide file tree
Showing 36 changed files with 4,186 additions and 1,240 deletions.
166 changes: 166 additions & 0 deletions docs/contracts/_links.md

Large diffs are not rendered by default.

519 changes: 519 additions & 0 deletions docs/contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

986 changes: 986 additions & 0 deletions docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/contracts/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Some of the LSP standards do not have a contract implementation as they represen
The **Universal Profile** contracts allow a better representation of the identity on the blockchain and better control over it.

- **[LSP0ERC725Account](../standards/smart-contracts/lsp0-erc725-account.md)**: a contract that can be used as an account and represents an **identity on-chain**.
- **[LSP1UniversalReceiverDelegateUP](../standards/smart-contracts/lsp1-universal-receiver-delegate-up.md)**: a contract that allows the account to react to the calls that it receives (Normal transaction, Token transfer, Vaults transfer, etc.).
- **[LSP6KeyManager](../standards/smart-contracts/lsp6-key-manager.md)**: a contract that allows **multi-control** over the account using different permissions.
- **[LSP1UniversalReceiverDelegateUP](./contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md)**: a contract that allows the account to react to the calls that it receives (Normal transaction, Token transfer, Vaults transfer, etc.).
- **[LSP6KeyManager](../contracts/contracts/LSP6KeyManager/LSP6KeyManager.md)**: a contract that allows **multi-control** over the account using different permissions.
- **LSP11BasicSocialRecovery**

### Digital Assets
Expand All @@ -74,14 +74,14 @@ The **Digital Asset (Token and NFT 2.0)** contracts are the newest advanced vers

- **[LSP4DigitalAssetMetadata](./contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md)**: a contract that sets the **metadata** of the **Digital Asset**.
- **[LSP7DigitalAsset](./contracts/LSP7DigitalAsset/LSP7DigitalAsset.md)**: a contract that either represents a fungible or non-fungible token (NFT).
- **[LSP8IdentifiableDigitalAsset](../standards/smart-contracts/lsp8-identifiable-digital-asset.md)**: a contract that represents a non-fungible token (NFT). It uses a bytes32 tokenId to allow many uses of token identification, including numbers, contract addresses, and hashed values (e.g., serial numbers).
- **[LSP8IdentifiableDigitalAsset](./contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md)**: a contract that represents a non-fungible token (NFT). It uses a bytes32 tokenId to allow many uses of token identification, including numbers, contract addresses, and hashed values (e.g., serial numbers).

### Generic Standards

These contracts are not just related to one specific section and could be used with the **Universal Profile**, **Digital Asset**, and **NFT 2.0** contracts.

- **[LSP9Vault](../standards/smart-contracts/lsp9-vault.md)**: a contract representing a **Vault** able to execute and hold assets could be owned by an LSP0ERC725Account contract.
- **[LSP1UniversalReceiverDelegateVault](../standards/smart-contracts/lsp1-universal-receiver-delegate-vault.md)**: a contract that allows the vault to react to the calls it receives (Normal transaction, Token transfer, etc.).
- **[LSP1UniversalReceiverDelegateVault](./contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md)**: a contract that allows the vault to react to the calls it receives (Normal transaction, Token transfer, etc.).
- **LSP14Ownable2Step**
- **LSP17ContractExtension**
- **LSP20CallVerification**
Expand Down
2 changes: 2 additions & 0 deletions docs/guides/browser-extension/install-browser-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ The current UP Browser Extenstion deploys profiles on the [Testnet](http://docs.
:::note
If you have **MetaMask** installed, _right click on both_ MetaMask and UP Extension and select _"This Can Read and Change Site Data > When you Click the Extension"_. Then you you can select for every website which extension you use. By closing the tab you can reset this selection.

**It is important not to forget the previous step. Otherwise, it might conflict with the UP Browser Extension, and this might prevent you from finalising the setup process.**

<img width="400" src="https://user-images.githubusercontent.com/232662/192822200-392b19f1-321b-4a59-928a-f71876bec6f3.png" />
:::

Expand Down
6 changes: 3 additions & 3 deletions docs/guides/key-manager/execute-relay-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const keyManager = new ethers.Contract(

### Step 3 - Prepare the relay call parameters

Get the `nonce` of the controller key from the KeyManager by instantiating the KeyManager smart contract instance and calling the [`getNonce`](../../standards/smart-contracts/lsp6-key-manager.md#getnonce) function.
Get the `nonce` of the controller key from the KeyManager by instantiating the KeyManager smart contract instance and calling the [`getNonce`](../../contracts/contracts/LSP6KeyManager/LSP6KeyManager.md#getnonce) function.

The `channelId` is used to prevent nonce conflicts when multiple apps send transactions to the same KeyManager at the same time. Read more about [out of order execution here](../../standards/universal-profile/lsp6-key-manager.md#out-of-order-execution).

Expand Down Expand Up @@ -288,7 +288,7 @@ let { signature } = await eip191Signer.signDataWithIntendedValidator(

</Tabs>

Now the `signature`, `abiPayload`, `nonce`, `validityTimestamps` and `keyManagerAddress` can be sent to a third party to execute the transaction using [`executeRelayCall`](../../standards/smart-contracts/lsp6-key-manager#executerelaycall).
Now the `signature`, `abiPayload`, `nonce`, `validityTimestamps` and `keyManagerAddress` can be sent to a third party to execute the transaction using [`executeRelayCall`](../../contracts/contracts/LSP6KeyManager/LSP6KeyManager.md#executerelaycall).

## Execute via `executeRelayCall`

Expand Down Expand Up @@ -347,7 +347,7 @@ const executeRelayCallTransaction = await keyManager

:::tip LSP6KeyManager executeRelayCall

You can find more information about the [LSP6KeyManager `executeRelayCall` here](../../standards/smart-contracts/lsp6-key-manager#executerelaycall).
You can find more information about the [LSP6KeyManager `executeRelayCall` here](../../contracts/contracts/LSP6KeyManager/LSP6KeyManager.md#executerelaycall).

:::

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/key-manager/upgrade-lsp6.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const newKeyManager = await new ethers.ContractFactory(

### Step 5.1 - Transfer Ownership to your new Key Manager

Create a calldata for the [`transferOwnership(address)`](../../standards/smart-contracts/lsp14-ownable-2-step.md#transferownership) function and shift the ownership of your Universal Profile from your current LSP6 Key Manager.
Create a calldata for the [`transferOwnership(address)`](../../contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md#transferownership) function and shift the ownership of your Universal Profile from your current LSP6 Key Manager.

<Tabs>

Expand Down Expand Up @@ -218,7 +218,7 @@ await universalProfile

### Step 5.2 - Accept Ownership from your new Key Manager

Create a calldata for the [`acceptOwnership()`](../../standards/smart-contracts/lsp14-ownable-2-step.md#acceptownership) function and take the ownership of your Universal Profile from your new LSP6 Key Manager.
Create a calldata for the [`acceptOwnership()`](../../contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md#acceptownership) function and take the ownership of your Universal Profile from your new LSP6 Key Manager.

<!-- prettier-ignore-start -->

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/universal-profile/create-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In the context of Universal Profile, _reading data from the contract storage can
- `execute(...)` = transfer LYX to addresses, call other contracts, or create and deploy new contracts (see [ERC725X](../../standards/universal-profile/lsp0-erc725account#erc725x---generic-executor) executor)
- `transferOwnership(...)` = make an address be the new owner of the Universal Profile.

In this guide, our Universal Profile's owner will be a contract called a **Key Manager**. The [Key Manager](../../standards/smart-contracts/lsp6-key-manager.md) is a smart contract that enables granting specific permissions to `addresses`, so that they can interact with the Universal Profile. For example, transferring LYX on behalf of the Universal Profile.
In this guide, our Universal Profile's owner will be a contract called a **Key Manager**. The [Key Manager](../../contracts/contracts/LSP6KeyManager/LSP6KeyManager.md) is a smart contract that enables granting specific permissions to `addresses`, so that they can interact with the Universal Profile. For example, transferring LYX on behalf of the Universal Profile.

:::info Learn More
You can implement any complex ownership structure (and fine-grained control) on top of Universal Profiles. The structure includes having a UP owned and controlled by:
Expand Down
7 changes: 3 additions & 4 deletions docs/guides/universal-profile/read-profile-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To inspect the address and check if it has an ERC725 contract, we can call its i

- [LSP3 - Universal Profile Metadata](../../standards/universal-profile/lsp3-universal-profile-metadata) describes the data in the Universal Profile contract storage, and which keys to use to retrieve it. We can import the schema directly from the [erc725.js](../../tools/erc725js/schemas#standard-lsp-schemas) library.

- `SupportedStandards` shows the interface using a Metadata Standard with a key. In our case we use `SupportedStandards:LSP3UniversalProfile` from to check if the contract is an Universal Profile.
- `SupportedStandards` shows the interface using a Metadata Standard with a key. In our case we use `SupportedStandards:LSP3UniversalProfile` from to check if the contract is a Universal Profile.
- `LSP3Profile` shows the data of the Universal Profile.
- `LSP12IssuedAssets[]` shows assets the Universal Profile issued.
- `LSP5ReceivedAssets[]` shows assets the Universal Profile received.
Expand Down Expand Up @@ -249,7 +249,7 @@ async function fetchProfile(address) {
const profile = new ERC725(erc725schema, address, provider, config);
return await profile.fetchData();
} catch (error) {
return console.log('This is not an ERC725 Contract');
return console.log('This is not an ERC725 Contract');
}
}

Expand All @@ -265,7 +265,7 @@ async function fetchProfileData(address) {
const profile = new ERC725(erc725schema, address, provider, config);
return await profile.fetchData('LSP3Profile');
} catch (error) {
return console.log('This is not an ERC725 Contract');
return console.log('This is not an ERC725 Contract');
}
}

Expand All @@ -278,5 +278,4 @@ fetchProfile(SAMPLE_PROFILE_ADDRESS).then((profileData) =>
fetchProfileData(SAMPLE_PROFILE_ADDRESS).then((profileData) =>
console.log(JSON.stringify(profileData, undefined, 2)),
);

```
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Users deploying their Universal Profiles using the guides that utilize **[lsp-fa

:::

This guide will teach you how to deploy and set the default implementation of the **[Universal Receiver Delegate](../../standards/smart-contracts/lsp1-universal-receiver-delegate-up.md)** (URD) used by the Universal Profile. This contract will register the addresses of the **[received assets](../../standards/universal-profile/lsp5-received-assets.md)** and **[vaults](../../standards/universal-profile/lsp10-received-vaults.md)** and will remove them on a balance equal to 0. This contract requires the [**`SUPER_SETDATA` Permission**](../../standards/universal-profile/lsp6-key-manager.md#super-permissions) to interact with the profile through the KeyManager.
This guide will teach you how to deploy and set the default implementation of the **[Universal Receiver Delegate](../../contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md)** (URD) used by the Universal Profile. This contract will register the addresses of the **[received assets](../../standards/universal-profile/lsp5-received-assets.md)** and **[vaults](../../standards/universal-profile/lsp10-received-vaults.md)** and will remove them on a balance equal to 0. This contract requires the [**`SUPER_SETDATA` Permission**](../../standards/universal-profile/lsp6-key-manager.md#super-permissions) to interact with the profile through the KeyManager.

![UniversalReceiverDelegate setting data keys on profile](/img/standards/lsp1delegate/token-transfer-4.jpg)

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/vault/edit-vault-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import TabItem from '@theme/TabItem';

# Edit Vault Data

This guide will teach you how to set data to an **[LSP9Vault](../../standards/smart-contracts/lsp9-vault.md)** contract through a UniversalProfile owned by an LSP6KeyManager. Any data can be attached to the vault, and since it supports the **[LSP1-UniversalReceiver](../../standards/generic-standards/lsp1-universal-receiver.md)** standard, we will set the [**Universal Receiver Delegate**](../../standards/smart-contracts/lsp1-universal-receiver-delegate-vault.md) address inside the storage.
This guide will teach you how to set data to an **[LSP9Vault](../../standards/smart-contracts/lsp9-vault.md)** contract through a UniversalProfile owned by an LSP6KeyManager. Any data can be attached to the vault, and since it supports the **[LSP1-UniversalReceiver](../../standards/generic-standards/lsp1-universal-receiver.md)** standard, we will set the [**Universal Receiver Delegate**](../../contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md) address inside the storage.

## Setting Data (Universal Receiver Delegate)

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/vault/interact-with-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const myEOA = new ethers.Wallet(privateKey).connect(provider);

Further we will create instances for our contracts

- Create an Universal Profile contract instance from `universalProfileAddress`.
- Create a Universal Profile contract instance from `universalProfileAddress`.
- Create a Target Contract instance from the `targetContractAddress`.

<Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ In summary, delegation provides a flexible way for smart contracts to handle and

## Implementations

There are several implementations of the standard. The **[LSP1UniversalReceiverDelegateUP](../smart-contracts/lsp1-universal-receiver-delegate-up.md)** contract is one of them and is used as a delegate to the `universalReceiver(...)` function of **UniversalProfile** contract.
There are several implementations of the standard. The **[LSP1UniversalReceiverDelegateUP](../../contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/)** contract is one of them and is used as a delegate to the `universalReceiver(...)` function of **UniversalProfile** contract.

At the moment, this contract allows to:

Expand Down
8 changes: 4 additions & 4 deletions docs/standards/generic-standards/lsp14-ownable-2-step.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ In addition, this standard defines hooks that call the **[universalReceiver(...)

The control of the contract is fully transferred _once the new owner has accepted the new ownership_. The 2 steps of ownership transfer are described below:

1. The previous owner transfers ownership to a new owner via the [`transferOwnership(...)`](../smart-contracts/lsp14-ownable-2-step.md#transferownership) function.
1. The previous owner transfers ownership to a new owner via the [`transferOwnership(...)`](../../contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md#transferownership) function.

![Transfer Ownership](/img/standards/lsp14/transfer-ownership.jpeg)

2. The new owner claims ownership of the contract by calling the [`acceptOwnership()`](../smart-contracts/lsp14-ownable-2-step.md#acceptownership)` function.
2. The new owner claims ownership of the contract by calling the [`acceptOwnership()`](../../contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md #acceptownership)` function.

![Accept Ownership](/img/standards/lsp14/accept-ownership.jpeg)

Expand All @@ -69,8 +69,8 @@ Each hook is executed whenever the _new owner confirms the process of tranferrin

The control of the contract is refully renounced _once the owner of the contract confirmes the ownership renouncement_. The 2 steps of ownership renouncement are described below:

1. The owner initiates the process of ownerhsip renouncement via the ['renounceOwnership()'](../smart-contracts/lsp14-ownable-2-step.md#renounceownership) function.
1. The owner initiates the process of ownerhsip renouncement via the ['renounceOwnership()'](../../contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md#renounceownership) function.

2. After waiting for 200 blocks to pass from the intiation of the ownership renouncement process the owner has a window of 200 block for confirming the renouncement via ['renounceOwnership()'](../smart-contracts/lsp14-ownable-2-step.md#renounceownership). If the owner doesn't confirm in that window of time, the process cannot be confirmed and the owner must start again if it was intended to renounce ownership.
2. After waiting for 200 blocks to pass from the intiation of the ownership renouncement process the owner has a window of 200 block for confirming the renouncement via ['renounceOwnership()'](../../contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md#renounceownership). If the owner doesn't confirm in that window of time, the process cannot be confirmed and the owner must start again if it was intended to renounce ownership.

![Renounce Ownership](/img/standards/lsp14/renounce-ownership.jpeg)
4 changes: 2 additions & 2 deletions docs/standards/nft-2.0/LSP8-Identifiable-Digital-Asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The Metadata defined by the **ERC725Y Data Keys** can be set for **each tokenId*

It is expected in the LUKSO's ecosystem to use **smart contract based accounts** to operate on the blockchain, which includes receiving and sending tokens. EOAs can receive tokens but they will be mainly used to control these accounts and not to hold tokens.

To ensure a **safe asset transfer**, an additional boolean parameter was added to the [transfer](../smart-contracts//lsp8-identifiable-digital-asset.md#transfer) and mint functions:
To ensure a **safe asset transfer**, an additional boolean parameter was added to the [transfer](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#transfer) and mint functions:

- If set to **False**, the transfer will only pass if the recipient is a smart contract that implements the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard.

Expand All @@ -102,7 +102,7 @@ Implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-

:::caution

When LSP8 assets are transfered, the LSP8 contract will notify the token sender and recipient using [`_notifyTokenSender(...)`](../smart-contracts/lsp8-identifiable-digital-asset.md#_notifytokensender) and [`_notifyTokenReceiver(...)`](../smart-contracts/lsp8-identifiable-digital-asset.md#_notifytokenreceiver).
When LSP8 assets are transfered, the LSP8 contract will notify the token sender and recipient using [`_notifyTokenSender(...)`](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#_notifytokensender) and [`_notifyTokenReceiver(...)`](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#_notifytokenreceiver).

**These methods will make external calls** to the [`universalReceiver(...)`](../smart-contracts/lsp0-erc725-account.md#universalreceiver) functions of both the sender and recipient.

Expand Down
3 changes: 2 additions & 1 deletion docs/standards/relayer-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem';

## POST `/execute`

Executes a signed transaction on behalf of a Universal Profile using [`executeRelayCall()`](./smart-contracts/lsp6-key-manager#executerelaycall).
Executes a signed transaction on behalf of a Universal Profile using [`executeRelayCall()`](../contracts/contracts/LSP6KeyManager/LSP6KeyManager.md#executerelaycall).

- Use signed message provided in request for authentication.
- Calculate and return the transaction hash in response.
Expand Down Expand Up @@ -39,6 +39,7 @@ Returns the available quota left for a registered Universal Profile.
- `signature` is the message value signed by a controller key with the [`SIGN` permission](./universal-profile/lsp6-key-manager#permissions) of the Universal Profile. The hash to sign should be calculated as [EIP-712](https://eips.ethereum.org/EIPS/eip-712) hash where the message is `keccack256(address, timestamp)`. Make sure that no matter the language or platform timestamp is of type `int`, `int256`, `uint` or `uint256`. In the backend the message is reconstructed using [soliditysha3()](https://web3js.readthedocs.io/en/v1.7.4/web3-utils.html#soliditysha3) to verify the signature.

[Web3.js](https://web3js.readthedocs.io/en/v1.8.0/web3-eth-accounts.html?#sign) and [ethers.js](https://docs.ethers.io/v5/api/signer/#Signer-signMessage) both automatically hash when using their native sign functions. This may need to be done manually if using a different library.

- `timestamp` in **seconds**. Must be now +/- 5 seconds.

<details>
Expand Down
Loading

0 comments on commit 0ca1b3a

Please sign in to comment.