Skip to content

Commit

Permalink
feat(docs): Burn from the docs! (#15085)
Browse files Browse the repository at this point in the history
* adding burn

* wip

* wip

* removed extra dep

* adding a UI to burn protocol tokens from the docs

* updated docs

* udpated yarn.lock
  • Loading branch information
julien51 authored Nov 15, 2024
1 parent 07fd551 commit 47ba696
Show file tree
Hide file tree
Showing 17 changed files with 476 additions and 741 deletions.
1 change: 0 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

31 changes: 11 additions & 20 deletions docs/docs/core-protocol/public-lock/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ The `onGrantKeyHook` allows you to create custom logic that is called each time
A KeyGrantedHook should implement the following interface.

```solidity
interface ILockKeyGrantHook
{
interface ILockKeyGrantHook {
/**
* @notice If the lock owner has registered an implementer then this hook
* is called with every key granted.
Expand Down Expand Up @@ -55,8 +54,7 @@ The `onKeyExtendHook` allows you create custom logic when a key is extended or r
A KeyExtendHook should implement the following interface.

```solidity
interface ILockKeyExtendHook
{
interface ILockKeyExtendHook {
/**
* @notice This hook every time a key is extended.
* @param tokenId tje id of the key
Expand Down Expand Up @@ -111,15 +109,14 @@ This hook is called every time the `tokenURI()` is called. This allows customiza
Want each key owner to have his/her own profile pic? Change description based on your own NFT? Just hook a contract compatible with the `ILockTokenURIHook` interface and return your own tokenURI.

```solidity
interface ILockTokenURIHook
{
interface ILockTokenURIHook {
function tokenURI(
address lockAddress, // the address of the lock
address operator, // the msg.sender issuing the call
address owner, // the owner of the key
uint256 keyId, // the id (tokenId) of the key (if applicable)
uint expirationTimestamp // the key expiration timestamp
) external view returns(string memory);
address operator, // the msg.sender issuing the call
address owner, // the owner of the key
uint256 keyId, // the id (tokenId) of the key (if applicable)
uint expirationTimestamp // the key expiration timestamp
) external view returns (string memory);
}
```

Expand All @@ -130,16 +127,13 @@ This hook is called every time the (ERC721) `balanceOf` method is called. This a
That way you could whitelist your own NFT holders or DAO members, and provide them access without having them to register. Just use a connector contract compatible with `ILockValidKeyHook` that checks if the account is allowed or not, and register it as a hook.

```solidity
interface ILockValidKeyHook
{
interface ILockValidKeyHook {
function hasValidKey(
address lockAddress, // the address of the current lock
address keyOwner, // the potential owner of a key
uint256 expirationTimestamp, // the key expiration timestamp
bool isValidKey // the validity in the lock contract
)
external view
returns (bool);
) external view returns (bool);
}
```

Expand All @@ -150,10 +144,7 @@ Called when a key is transferred, it can be useful to use with `onKeyPurchaseHoo
The `ILockKeyTransferHook` interface is quite straightforward:

```solidity
interface ILockKeyTransferHook
{
interface ILockKeyTransferHook {
/**
* @notice If the lock owner has registered an implementer then this hook
* is called every time balanceOf is called
Expand Down
14 changes: 7 additions & 7 deletions docs/docs/core-protocol/smart-contracts-api/Unlock.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ _internally call `createUpgradeableLock`_

#### Parameters

| Name | Type | Description |
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_expirationDuration | uint256 | the duration of the lock (pass 0 for unlimited duration) |
| \_tokenAddress | address | set to the ERC20 token address, or 0 for ETH. |
| \_keyPrice | uint256 | the price of each key |
| \_maxNumberOfKeys | uint256 | the maximum numbers of keys to be edited |
| Name | Type | Description |
| -------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_expirationDuration | uint256 | the duration of the lock (pass 0 for unlimited duration) |
| \_tokenAddress | address | set to the ERC20 token address, or 0 for ETH. |
| \_keyPrice | uint256 | the price of each key |
| \_maxNumberOfKeys | uint256 | the maximum numbers of keys to be edited |
| \_lockName | string | the name of the lock param \_salt [deprec] -- kept only for backwards compatibility This may be implemented as a sequence ID or with RNG. It's used with `create2` to know the lock's address before the transaction is mined. |
| \_5 | bytes12 | undefined |
| \_5 | bytes12 | undefined |

#### Returns

Expand Down
5 changes: 5 additions & 0 deletions docs/docs/core-protocol/unlock/networks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ The core team has built a `networks` [npm module](https://www.npmjs.com/package/
<SupportedNetwork network={network} />
))}
</>

<p id="footnote-1"></p>
[1] We only show the most popular tokens on this network. You can add more
tokens by updating the [network configuration
file](https://github.com/unlock-protocol/unlock/tree/master/packages/networks).
6 changes: 6 additions & 0 deletions docs/docs/governance/unlock-dao-tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ When the fee switch is set to any value larger than 0%, on every transaction for

Currently, the protocol fees collected by way of the fee switch can be "swapped and burned" by calling the `swapAndBurn` function on the Unlock contract. This function will swap the collected fees for UP (or UDT) tokens on a decentralized exchange and then burn them.

Note: the collected fees can only be burnt if the following conditions are met:

- UP (or UDT) has been bridged and configured on the network
- A Uniswap Pool between the native currency and UP (or UDT) exists on the network
- The Unlock contract has been configured with the address of the Uniswap Pool, as well as the Swap and Burn contract.

## Bridging and Exchanging UDT and UP

In essence, the UP token on Base is an analogous version of the UDT token on mainnet. (In order to eliminate potential confusion between the two tokens, a different name — UP — was chosen on Base.)
Expand Down
20 changes: 11 additions & 9 deletions docs/docs/governance/unlock-dao/cross-chain-governance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ description: >-

import { networks } from '@unlock-protocol/networks'

To fully decentralize the maintenance and management of the protocol contracts, we use a cross-chain governance that allows for a DAO proposal on Ethereum mainnet to reach the Unlock contracts on other networks.
To fully decentralize the maintenance and management of the protocol contracts, we use a cross-chain governance that allows for a DAO proposal to reach the Unlock contracts on all supported networks.

## How it works

To reach other chains, calls emitted from the mainnet DAO go through the [Connext bridge](https://www.connext.network/) and are executed on the other side of the bridge, after a period of cooldown.

```
(mainnet) (destination chain) (cooldown period)
DAO proposal > Connext Bridge > Safe multisig > wait for 2 days >
(Base) (destination chain)
DAO proposal > Connext Bridge > Safe multisig > wait for 2 days > Execution
```

The workflow is as follows

1. A DAO proposal is created, containing 1 call per chain.
2. If the vote succeeds, the DAO proposal is executed. All calls are sent to the Connext bridge(s).
1. A DAO proposal is created, containing at least 1 call aimed at a different network.
2. If the vote succeeds, the DAO proposal is executed. All crosschain calls are sent to the Connext bridge(s).
3. Each call crosses the bridge separately towards its destination on a specific chain.
4. The call is received on the destination chain by a SAFE multisig configured with a special bridge receiver plugin.
5. Once received, the call is held in the multisig for a cooldown period of 2 days during which it can be cancelled.
6. once the cooldown period ends, the call is ready to be executed by anyone
4. The call is received on the destination chain by a SAFE multisig configured with a special bridge receiver Zodiac plugin. This plugin only accepts calls emanating from the Connext bridge, from the DAO's Timelock contract.
5. Once received, the call is held in the multisig for a cooldown period of 2 days during which it can be cancelled by the multisig signers.
6. After the cooldown period, the call is ready to be executed by anyone (signer on the multisig or not).

NB: The cooldown period is useful to prevent malicious or errored calls from being executed if the bridge itself has been compromised.

Expand All @@ -34,7 +34,7 @@ NB: The cooldown period is useful to prevent malicious or errored calls from bei
To work, this workflow requires the [Connext bridge](https://bridge.connext.network/), [SAFE contracts](https://safe.global/) and Unlock Protocol to be deployed
and active on the network.

The list of supported networks are:
At this point, the supported networks are:

export const supportedChains = Object.keys(networks).filter(
(chainId) =>
Expand All @@ -54,6 +54,8 @@ export const supportedChains = Object.keys(networks).filter(
})}
</ul>

Please refer to [Connext's docs](https://docs.connext.network/resources/deployments) to identify which network could be added.

## How to setup the multisig on the "remote" chain

On every receiving chain, we need a [SAFE](https://safe.global/) multisig configured with two [Zodiac](https://zodiac.wiki/index.php/ZODIAC.WIKI) plugins, namely:
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/tools/locksmith/webhooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Currently, locksmith support sending updates on new locks and keys. To subscribe

For examples on using the webhooks checkout the tutorial ["Using Webhooks with the Locksmith API"](../../tutorials/back-end/locksmith-webhooks.md).

Currently the following topics are supported:
Currently the following topics are supported:

- New Locks `https://locksmith.unlock-protocol.com/api/hooks/:network/locks`
- New Keys `https://locksmith.unlock-protocol.com/api/hooks/:network/keys`
- New Keys `https://locksmith.unlock-protocol.com/api/hooks/:network/keys`
- New Keys for a Lock `https://locksmith.unlock-protocol.com/api/hooks/:network/locks/:lock/keys`

You need to replace `network` and `lock` with the respective network ID and Lock Address.
You need to replace `network` and `lock` with the respective network ID and Lock Address.
2 changes: 1 addition & 1 deletion docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const config: Config = {
},
blog: false,
theme: {
customCss: './src/css/custom.css',
customCss: ['./src/css/custom.css'],
},
},
],
Expand Down
4 changes: 3 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@
"@docusaurus/core": "3.6.1",
"@docusaurus/plugin-client-redirects": "3.6.1",
"@docusaurus/plugin-content-docs": "3.6.1",
"@docusaurus/preset-classic": "3.6.1",
"@docusaurus/theme-classic": "3.6.1",
"@emotion/react": "11.13.3",
"@emotion/styled": "11.13.0",
"@flockler/react-flockler-embed": "1.0.4",
"@mdx-js/react": "3.1.0",
"@mui/material": "6.1.6",
"@mui/x-charts": "7.22.1",
"@privy-io/react-auth": "1.92.6",
"@tanstack/react-query": "5.59.16",
"@unlock-protocol/networks": "workspace:./packages/networks",
"@unlock-protocol/ui": "workspace:./packages/ui",
"clsx": "2.1.1",
"docusaurus-gtm-plugin": "0.0.2",
"docusaurus-node-polyfills": "1.0.0",
"docusaurus-plugin-openapi-docs": "4.2.0",
"docusaurus-preset-openapi": "0.7.5",
"docusaurus-theme-openapi-docs": "4.2.0",
"ethers": "6.13.4",
"prism-react-renderer": "2.4.0",
Expand Down
Loading

0 comments on commit 47ba696

Please sign in to comment.