Skip to content

Commit

Permalink
Production Deploy (#13105)
Browse files Browse the repository at this point in the history
Manual deploy as of commit:e6b919d316dae07eb9ba2061a320e2652cd50a56
  • Loading branch information
julien51 committed Dec 18, 2023
1 parent 733afe0 commit 3f794d2
Show file tree
Hide file tree
Showing 155 changed files with 21,533 additions and 4,160 deletions.
4 changes: 3 additions & 1 deletion .clabot
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
"easyrun42",
"gundamdweeb",
"pavvann",
"JexxaJ"
"JexxaJ",
"teawaterwire",
"sudheerDev"
],
"message": "Thank you for your pull request and welcome to Unlock! We require contributors to sign our [Contributor License Agreement](https://github.com/unlock-protocol/unlock/blob/master/CLA.txt), and we don't seem to have the users {{usersWithoutCLA}} on file. \nIn order for us to review and merge your code, please open _another_ pull request with a single modification: your github username added to the file `.clabot`.\nThank you! "
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ yarn-error.log
# Local Netlify folder
.netlify
.vercel
governance/.openzeppelin/unknown-31337.json
670 changes: 335 additions & 335 deletions .yarn/releases/yarn-4.0.1.cjs → .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"

yarnPath: .yarn/releases/yarn-4.0.1.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax = docker/dockerfile:experimental

ARG NODE_VERSION=20.9.0-bullseye
ARG NODE_VERSION=20.10.0-bullseye
# the graph cli binary does not work with bookworm which is the default for Node 20 images. Once the graph-cli binary has been updated to not use https://www.npmjs.com/package/binary-install-raw we can use bookworm.

###################################################################
Expand Down
2 changes: 1 addition & 1 deletion docker/development/eth-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.9.0-alpine as unlock-eth-node
FROM node:20.10.0-alpine as unlock-eth-node
LABEL Unlock <ops@unlock-protocol.com>

USER root
Expand Down
6 changes: 3 additions & 3 deletions docker/development/eth-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"@unlock-protocol/hardhat-plugin": "0.1.3",
"@unlock-protocol/contracts": "0.0.22",
"@unlock-protocol/contracts": "0.0.22",
"eslint": "8.52.0",
"eslint": "8.54.0",
"ethers": "5.7.2",
"hardhat": "2.18.3",
"hardhat": "2.19.2",
"hardhat-erc1820": "0.1.0",
"ts-node": "10.9.1",
"typescript": "5.2.2"
"typescript": "5.3.2"
}
}
2,742 changes: 1,371 additions & 1,371 deletions docker/development/eth-node/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ services:

ipfs:
# Required for subgraph
image: ipfs/go-ipfs:v0.23.0
image: ipfs/go-ipfs:v0.24.0
ports:
- '5001:5001'

Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ services:
- '8020:8020'

ipfs:
image: ipfs/kubo:v0.23.0
image: ipfs/kubo:v0.24.0
ports:
- '5001:5001'

postgres:
image: postgres:16.0
image: postgres:16.1
2 changes: 1 addition & 1 deletion docs/docs/core-protocol/audits.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To complement our disclosure of the full reports, here is a summary of the most

This issue is by far the most significant one that was identified, as it could create an issue with the UDT supply. _We have now implemented a mechanism to prevent it._

The amount of tokens minted on every transaction is based on the gas spent by the person submitting a transaction [more info](../governance/unlock-dao-tokens.md#earning-udt). A malicious miner could set a very high gas price for a transaction where they would purchase an expensive membership on a lock for which they are the beneficiary. By doing so, they would not actually spend any real funds but would be able to earn a large amount of UDT.
The amount of tokens minted on every transaction is based on the gas spent by the person submitting a transaction [more info](../governance/unlock-dao-tokens.mdx#earning-udt). A malicious miner could set a very high gas price for a transaction where they would purchase an expensive membership on a lock for which they are the beneficiary. By doing so, they would not actually spend any real funds but would be able to earn a large amount of UDT.

We implement a preventative measure by not using the gas price submitted by the transaction sender, but by instead using the blockchain’s current `baseFee`. This value itself cannot be manipulated by miners and is computed based on transactions in the previous blocks, rendering this vulnerability no-op.

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/governance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Unlock is a decentralized protocol for memberships. We believe that an open prot

Our goal is to make Unlock the _default_ membership primitive for each and every membership, both online and offline, from small indie creators publishing content to large corporations broadcasting videos for hundreds of milions of viewers to local stores wanting to offer unique benefits to their communities.

We also believe that the protocol itself **should not be immutable**. We believe the protocol should be able to evolve and eventually support currently unpredictable behaviors, and it should be able to sustain education, promotion, and marketing. For this, the core protocol needs to include its own governance mechanism through a [Decentralized Autonomous Organization](./unlock-dao.md). The DAO's voting rights are represented by the [Unlock DAO Tokens (UDT)](./unlock-dao-tokens.md).
We also believe that the protocol itself **should not be immutable**. We believe the protocol should be able to evolve and eventually support currently unpredictable behaviors, and it should be able to sustain education, promotion, and marketing. For this, the core protocol needs to include its own governance mechanism through a [Decentralized Autonomous Organization](./unlock-dao.md). The DAO's voting rights are represented by the [Unlock DAO Tokens (UDT)](./unlock-dao-tokens.mdx).

Finally, we believe that people who are using the Unlock Protocol should be part of the protocol's governance. Interested individuals should have additional mechanisms that are more meaningful than "buying out other existing community members" that enable them to join Unlock's governance process. For this, the Unlock protocol includes its own governance token, called [Unlock DAO Token (UDT)](./unlock-dao-tokens.md), which can be earned by anyone using the protocol.
Finally, we believe that people who are using the Unlock Protocol should be part of the protocol's governance. Interested individuals should have additional mechanisms that are more meaningful than "buying out other existing community members" that enable them to join Unlock's governance process. For this, the Unlock protocol includes its own governance token, called [Unlock DAO Token (UDT)](./unlock-dao-tokens.mdx), which can be earned by anyone using the protocol.

Unlock Labs, despite being the original builders of the protocol, are just like any other token holders and do not have more "power" or control on the protocol and its smart contracts.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,60 @@ description: The Unlock Token (UDT) and its tokenomics.
sidebar_position: 3
---

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

The Unlock DAO Tokens — previously known as Unlock Discount Tokens — (UDT) are the governance tokens for the Unlock Protocol. Holders of UDT collectively form the [Unlock DAO](./unlock-dao.md).

:::info
UDT are perfectly _optional_. Creators can deploy locks without knowledge of UDT and their members can similarly purchase membership without knowing about UDT.
:::

UDT tokens were created on Ethereum at this address: [`0x90de74265a416e1393a450752175aed98fe11517`](https://etherscan.io/token/0x90de74265a416e1393a450752175aed98fe11517), and have also been bridged to multiple side-chains and networks such as Polygon, Gnosis Chain and others. The DAO may decide to add support for more networks.

The contract uses OpenZeppelin's ERC20 libraries. It was initally deployed to be upgradable but **the proxy admin renounced its role**, making the contract not upgradable anymore.
UDT tokens were created on Ethereum, and have also been bridged to multiple side-chains and networks such as Polygon, Gnosis Chain and others. The DAO may decide to add support for more networks:

<table>
<thead>
<tr>
<th>Chain</th>
<th>Address</th>
<th>Bridge Address</th>
</tr>
</thead>
{Object.keys(networks).map((networkId) => {
if (networks[networkId].unlockDaoToken) {
const network = networks[networkId]
return (
<tr>
<td>{network.name}</td>
<td>
<a
target="_blank"
href={network.explorer.urls.token(
network.unlockDaoToken?.address
)}
>
<code>{network.unlockDaoToken?.address}</code>
</a>
</td>
<td>
{network.unlockDaoToken?.mainnetBridge && (
<a
target="_blank"
href={`${networks[1].explorer.urls.token(
networks[1].unlockDaoToken.address,
network.unlockDaoToken?.mainnetBridge
)}`}
>
<code>{network.unlockDaoToken?.mainnetBridge}</code>
</a>
)}
</td>
</tr>
)
}
})}
</table>

On Ethereum Mainnet, the contract uses OpenZeppelin's ERC20 libraries. It was initally deployed to be upgradable but **the proxy admin renounced its role**, making the contract not upgradable anymore.

UDT can optionnaly be distributed by the protocol itself when membership tokens are purchased or renewed. Please see below for details.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/governance/unlock-dao.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: >-
sidebar_position: 2
---

Collectively, [UDT holders](./unlock-dao-tokens.md) are members of the Unlock DAO. The Unlock DAO aims at governing the Unlock Protocol. In order to facilitate decision making, the Unlock DAO uses OpenZeppelin's [Governor Contracts](https://blog.openzeppelin.com/governor-smart-contract/) which can be found at these addresses on the [Ethereum network](https://ethereum.org/en/):
Collectively, [UDT holders](./unlock-dao-tokens.mdx) are members of the Unlock DAO. The Unlock DAO aims at governing the Unlock Protocol. In order to facilitate decision making, the Unlock DAO uses OpenZeppelin's [Governor Contracts](https://blog.openzeppelin.com/governor-smart-contract/) which can be found at these addresses on the [Ethereum network](https://ethereum.org/en/):

- [Governor Contract](https://etherscan.io/address/0x440d9D4E66d39bb28FB58729Cb4D3ead2A595591) \(`0x440d9D4E66d39bb28FB58729Cb4D3ead2A595591`\): where proposals and votes are handled,
- [TimeLock Contract](https://etherscan.io/address/0x17eedfb0a6e6e06e95b3a1f928dc4024240bc76b) \(`0x17eedfb0a6e6e06e95b3a1f928dc4024240bc76b`\): where proposals are executed and funds are managed.
Expand Down
1 change: 0 additions & 1 deletion docs/docs/tools/subgraph/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ The links below provide a rudimentary tool to build and test your queries.
{Object.keys(networks).map((network) => {
if (network !== 'localhost') {
const endpoint = networks[network].subgraph.endpointV2
console.log(endpoint)
const m = endpoint.match(/unlock\-protocol\/(.*)/)
return (
<li>
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"prism-react-renderer": "2.0.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "4.11.0"
"react-icons": "4.12.0"
},
"scripts": {
"docusaurus": "docusaurus",
Expand Down
22 changes: 20 additions & 2 deletions governance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ When using an async function to parse a proposal, you can pass params to the fun
**CLI call**

```sh
RUN_FORK=1 yarn hardhat gov --gov-address 0x7757f7f21F5Fa9b1fd168642B79416051cd0BB94 \
RUN_FORK=1 yarn hardhat gov --gov-address 0x440d9D4E66d39bb28FB58729Cb4D3ead2A595591 \
--proposal proposals/my-proposal.js
0x000000 1000
```
Expand Down Expand Up @@ -89,7 +89,7 @@ check [`./proposals/002-set-protocol-fee.js`](./proposals/002-set-protocol-fee.j
2. Test you proposal locally on a mainnet fork

```shell
RUN_FORK=1 yarn hardhat gov --gov-address 0x7757f7f21F5Fa9b1fd168642B79416051cd0BB94 \
RUN_FORK=1 yarn hardhat gov --gov-address 0x440d9D4E66d39bb28FB58729Cb4D3ead2A595591 \
--proposal proposals/<your-proposal>.js
```

Expand All @@ -102,3 +102,21 @@ yarn hardhat gov:submit --proposal proposals/<your-proposal>.js --network mainne
```

4. Head to [Tally](https://www.withtally.com/governance/unlock) to see your proposal. NB: this may take some time as it requires X block confirmations

## Uniswap

### Create a Uniswap V3 Native/UDT pool

Edit the pool fee directly in the script

```
yarn run scripts/uniswap/createPool.js
```

### Add liquidity a Uniswap V3 Native/UDT pool

Edit directly the amounts and prices in the script

```
yarn run scripts/uniswap/addLiquidity.js
```
16 changes: 15 additions & 1 deletion governance/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
// hardhat.config.js
const { copySync } = require('fs-extra')

require('@nomiclabs/hardhat-ethers')
require('@nomiclabs/hardhat-etherscan')
require('@nomiclabs/hardhat-waffle')

require('@openzeppelin/hardhat-upgrades')

// import helpers
const { etherscan, networks } = require('@unlock-protocol/hardhat-helpers')
const {
etherscan,
networks,
parseForkUrl,
} = require('@unlock-protocol/hardhat-helpers')

const settings = {
optimizer: {
Expand All @@ -20,6 +26,14 @@ const settings = {
},
}

// mainnet fork
if (process.env.RUN_FORK) {
parseForkUrl(networks)

// replace localhost manifest by mainnet one
copySync('.openzeppelin/mainnet.json', '.openzeppelin/unknown-31337.json')
}

// tasks
require('./tasks/balance')
require('./tasks/safe')
Expand Down
14 changes: 7 additions & 7 deletions governance/helpers/gov.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const queueProposal = async ({ proposal, govAddress }) => {

console.log({ targets, values, calldatas, description })

const gov = await ethers.getContractAt('UnlockProtocolGovernor', govAddress)
const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress)

return await gov
.connect(voterWallet)
Expand All @@ -195,7 +195,7 @@ const executeProposal = async ({ proposal, govAddress }) => {
voterWallet = await ethers.getSigner(proposerAddress)
}

const gov = await ethers.getContractAt('UnlockProtocolGovernor', govAddress)
const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress)
return await gov
.connect(voterWallet)
.execute(targets, values, calldatas, descriptionHash)
Expand All @@ -205,7 +205,7 @@ const executeProposal = async ({ proposal, govAddress }) => {
* Submits a proposal
*/
const submitProposal = async ({ proposerAddress, proposal, govAddress }) => {
const gov = await ethers.getContractAt('UnlockProtocolGovernor', govAddress)
const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress)
let proposer
if (!proposerAddress) {
;[proposer] = await ethers.getSigners()
Expand All @@ -217,20 +217,20 @@ const submitProposal = async ({ proposerAddress, proposal, govAddress }) => {
}

const getProposalVotes = async (proposalId, govAddress) => {
const gov = await ethers.getContractAt('UnlockProtocolGovernor', govAddress)
const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress)
const votes = await gov.proposalVotes(proposalId)
return votes
}

const getQuorum = async (govAddress) => {
const gov = await ethers.getContractAt('UnlockProtocolGovernor', govAddress)
const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress)

const currentBlock = await ethers.provider.getBlockNumber()
return await gov.quorum(currentBlock - 1)
}

const getGovTokenAddress = async (govAddress) => {
const gov = await ethers.getContractAt('UnlockProtocolGovernor', govAddress)
const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress)
return await gov.token()
}

Expand All @@ -246,7 +246,7 @@ const getProposalState = async (proposalId, govAddress) => {
'Executed',
]

const gov = await ethers.getContractAt('UnlockProtocolGovernor', govAddress)
const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress)
const state = await gov.state(proposalId)
return states[state]
}
Expand Down
Loading

0 comments on commit 3f794d2

Please sign in to comment.