Skip to content

Commit

Permalink
Merge branch 'master' into start-stop-protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
clemsos committed Mar 21, 2024
2 parents e71949a + d9f70ad commit 73f8eff
Show file tree
Hide file tree
Showing 101 changed files with 1,286 additions and 1,045 deletions.
4 changes: 3 additions & 1 deletion .clabot
Expand Up @@ -60,7 +60,9 @@
"JoaoCampos89",
"jchanolm",
"0xTxbi",
"FedericoCaruso"
"FedericoCaruso",
"njokuScript",
"Calla-Ji"
],
"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! "
}
36 changes: 36 additions & 0 deletions .github/actions/blog/action.yml
@@ -0,0 +1,36 @@
name: Fetch and Create Blog Posts
description: Fetches the latest blog posts from the Unlock Protocol blog and creates new posts in the website repository.
on:
schedule:
- cron: '0 0 * * *' # Run once per day at midnight
pull_request:

jobs:
fetch_and_create_posts:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install feedparser requests
- name: Fetch RSS feed and create posts
run: python rss_feed.py

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add new blog posts"
title: "New blog posts from RSS feed"
body: "Automatically generated PR to add new blog posts fetched from the RSS feed."
branch: new-blog-posts
60 changes: 60 additions & 0 deletions .github/actions/blog/rss_feed.py
@@ -0,0 +1,60 @@
import os
import re
import requests
import feedparser
from datetime import datetime

# Fetch the RSS feed
rss_url = 'https://paragraph.xyz/api/blogs/rss/@unlockprotocol'
feed = feedparser.parse(rss_url)

# Create the base directory for storing blog posts
blog_dir = '../../../unlock-protocol-com/blog'
os.makedirs(blog_dir, exist_ok=True)

# Iterate over each post in the feed
for entry in feed.entries:
# Extract post details
title = entry.title
subtitle = entry.subtitle if 'subtitle' in entry else ''
author_name = entry.author
publish_date = entry.published
description = entry.summary
image_url = entry.image.href if 'image' in entry else ''

# Generate a slug for the blog post
slug = re.sub(r'[^\w\-_\. ]', '_', title).lower().replace(' ', '_')

# Create a directory for the blog post images
post_images_dir = f'../../../unlock-protocol-com/public/images/blog/{slug}'
os.makedirs(post_images_dir, exist_ok=True)

# Fetch and save the image locally
local_image_path = ''
if image_url:
image_filename = os.path.basename(image_url)
local_image_path = os.path.join(post_images_dir, image_filename)
response = requests.get(image_url)
with open(local_image_path, 'wb') as f:
f.write(response.content)

# Create the post content
post_content = f'''---
title: "{title}"
subtitle: "{subtitle}"
authorName: "{author_name}"
publishDate: "{publish_date}"
description: "{description}"
image: "../../../unlock-protocol-com/public/images/blog/{slug}/{image_filename}"
---
{entry.content[0].value}
'''

# Generate the filename for the blog post
post_filename = f'{slug}.md'
post_file_path = os.path.join(blog_dir, post_filename)

# Save the post to a file
with open(post_file_path, 'w') as f:
f.write(post_content)
51 changes: 51 additions & 0 deletions .github/actions/health-check/action.yml
@@ -0,0 +1,51 @@
name: Protocol Health Check
description: Check the state of the Unlock Protocol across all chains

env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
SENTRY_LOG_LEVEL: info

runs:
using: "composite"
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- run: yarn
shell: bash
- run: yarn build
shell: bash
- name: Install Sentry CLI
shell: bash
run: npm install @sentry/cli -g
- name: Sentry CLI login
shell: bash
run: sentry-cli login --auth-token $SENTRY_AUTH_TOKEN
- name: Check networks package
run: |
yarn workspace @unlock-protocol/networks check >> networks.log
sentry-cli send-event -m "Networks" --logfile networks.log
shell: bash
- name: Check tokens in networks package
run: |
yarn workspace @unlock-protocol/networks check-tokens >> networks-tokens.log
sentry-cli send-event -m "Networks Tokens" --logfile networks-tokens.log
shell: bash
- name: Check Unlock info
run: |
yarn workspace @unlock-protocol/governance check >> governance.log
sentry-cli send-event -m "Governance" --logfile governance.log
shell: bash
- name: Check Subgraphs
run: |
yarn workspace @unlock-protocol/subgraph check >> subgraph.log
sentry-cli send-event -m "Subgraph" --logfile subgraph.log
shell: bash
- name: Check Team Multisigs
run: |
yarn workspace @unlock-protocol/governance check:multisig >> multisig.log
sentry-cli send-event -m "Multisig" --logfile multisig.log
shell: bash


23 changes: 23 additions & 0 deletions .github/workflows/daily-check.yml
@@ -0,0 +1,23 @@
name: "Daily checks"
on:
schedule:
# runs at 1am everyday
- cron: '0 1 * * *'

jobs:
health-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Load secrets from 1Password
uses: 1Password/load-secrets-action@v1.3.2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
SENTRY_AUTH_TOKEN: op://secrets/sentry-health-monitoring/credential
SENTRY_DSN: op://secrets/sentry-health-monitoring/dsn
- name: Health Check of Unlock Protocol
uses: ./.github/actions/health-check
4 changes: 2 additions & 2 deletions docker/development/eth-node/package.json
Expand Up @@ -10,8 +10,8 @@
},
"dependencies": {
"@nomiclabs/hardhat-ethers": "2.2.3",
"@unlock-protocol/contracts": "0.0.23",
"@unlock-protocol/hardhat-plugin": "0.1.4",
"@unlock-protocol/hardhat-plugin": "latest",
"@unlock-protocol/contracts": "latest",
"eslint": "8.54.0",
"ethers": "5.7.2",
"hardhat": "2.20.1",
Expand Down
44 changes: 6 additions & 38 deletions docs/README.md
Expand Up @@ -2,46 +2,14 @@

This website (https://docs.unlock-protocol.com/) is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation
## Contributing

```
$ yarn
```
First of all, thank you! First, you need to have `git` installed on your machine. Then, create a fork of the main Unlock repo, located at [`https://github.com/unlock-protocol/unlock`](https://github.com/unlock-protocol/unlock). For this, you should follow [the steps provided by GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).

### Local Development
Once cloned, using the terminal type `yarn` and `yarn build` at the root of the repository.

```
$ yarn start
```
After this, you're ready. You can hop into the `docs` folder and there, you can use the `yarn run start` to build an serve the docs from your local machine.

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
Then do the changes you want to introduce to the docs (in the `docs` folder). Once you are done, make sure your changes are rendered as you expect them to be!

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Deployments are performed automatically by Github.

## Updating docs

The docs are using markdown and can be [updated in the repo](https://github.com/unlock-protocol/docs/tree/master/docs).

### Auto-generated docs

Some of the docs are automatically generated.

#### Smart contracts

The docs are generated from the `@unlock-protocol.com/contracts` package.
You can modify any `.sol` file in the package following the [`hardhat-dodoc`](https://www.npmjs.com/package/@primitivefi/hardhat-dodoc) format.
Once ready, you can easily open a pull request on the docs repo (make sure you also generate a PR for the mono repo or your changes will be overwritten by the next doc update) by using the following script: `scripts/docs-contracts-pr.sh` executed at the root of the monorepo.

## Search

We use algolia docs search on the docs site. Once every day, the algolia crawlers re-indexes our site with new entries. This can be changed from the [algolia crawler dashboard](https://crawler.algolia.com/admin/crawlers/). You should be able to trigger manual re-indexing from the same.
Finally, you need to commit changes, and push them to Github. Once that is done you can [open a Pull-Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) against the main Unlock repository!
2 changes: 2 additions & 0 deletions docs/docs/governance/unlock-dao/unlock-dao.md
Expand Up @@ -47,6 +47,8 @@ Given how much scrutiny is expected by voters, we strongly advise anyone who int

Similarly, we encourage proposers to first submit an offchain "temperature check" from the community before submitting onchain proposals using a tool like [Snapshot](https://snapshot.org/#/unlock-protocol.eth). Even though offchain votes are non-binding, this helps [delegates (see below)](#delegating) get a sense of whether the community wants to see a specific proposal be executed or not.

Finally in the interest of transparency, you should consider submitting a Pull-Request that includes the details of your proposal. This will make it easier for DAO members to test your proposal's code, as well as verify that it performs what it has been intended for. Please [check past proposals](https://github.com/unlock-protocol/unlock/tree/master/governance/proposals) to get a good idea of what is expected. You will also find helpers in this code to executed cross-chain proposals for example!

Once the proposal has been submitted on chain, the [delegates (see below)](#delegating) have a period to express their preferences, between voting in "favor", "against" or "abstain". Proposals have to be **carefully tested by each delegate** to assert what impact they will actually have, and if they are indeed desirable for the protocol. Given their _unstoppable_ nature, and the fact that a rogue or buggy proposal could not be reverted, it is absolutely critical that every single vote is done thoughtfuly. Additionaly, some delegates might want to consult the token holders who have delegated to them before making a final decision.

#### Delegating
Expand Down
40 changes: 40 additions & 0 deletions docs/docs/governance/unlock-dao/voting-onchain.mdx
@@ -0,0 +1,40 @@
---
title: Voting Onchain
description: >-
Voting onchain is a way to make decisions in a decentralized way. It is a
process that allows the community to vote on proposals and make decisions
based on the results that are automatically executed by the blockchain.
sidebar_position: 2
---

Preemable: DAO voting happens onchain. Front-ends like [Tally](https://www.tally.xyz/gov/unlock) or Etherscan are optional. They can be replaced by any UI that can interact with the contracts. Please make sure you are [familiar with the voting process](/governance/unlock-dao/#voting)!
There can be various reasons to vote through another channel. Here are the 5 steps to vote by using the Etherscan UI:

### Step 1

Get the Governor contract details from [here](https://docs.unlock-protocol.com/governance/unlock-dao/) and copy them into [Etherscan](https://etherscan.io/) and navigate to the page of the Governor contract.

### Step 2

Now head over to the “Contract” tab and select right underneath “Write as Proxy”:
![Alt text](./voting-onchain/image1.png)

### Step 3

Now, either head over to Tally and grab the Proposal ID from the proposal you wish to vote for:
![Alt text](./voting-onchain/image2.png)

Or even better, take a look at the “propose” transaction of your proposal here:
![Alt text](./voting-onchain/image3.png)

From there, navigate to the “Logs” tab to grab the proposal ID:
![Alt text](./voting-onchain/image4.png)

### Step 4

Lastly, please go ahead and return to your open Etherscan tab and paste the Proposal ID into the dedicated field under the castVote function (currently indexed 2). To vote, use the second field and enter either `0` for a vote against the proposal or `1` for a vote in favor of the proposal.
![Alt text](./voting-onchain/image5.png)

_(PS: You can also use ‘castVoteWithReason’ to add a reason for your vote.)_

Make sure you submit the transaction and you are done! You have successfully voted onchain. 🎉
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/docs/tools/checkout/configuration.md
Expand Up @@ -46,6 +46,7 @@ The `paywallConfig` is a JSON object which includes a set of customizations for
- `expectedAddress`: _optional string_. If set, the user will be asked to switch their wallet address before proceeding. This is useful if you want to ensure that the user is using the same address as the one they used to purchase a membership.

- `skipSelect`: _optional boolean_. Skip selection screen if only single lock is available.
- `promo`: _optional string_. If set, it is used to pre-fill the promo code field on the checkout. a `promo` query string can also be passed as a query param when using the checkout URL. (note: requires the use of the discount code hook!)

### Locks

Expand Down
24 changes: 12 additions & 12 deletions smart-contracts/scripts/all_networks → governance/all_networks
Expand Up @@ -7,27 +7,27 @@
* Usage: scripts/all_networks unlock:info
*/

const allNetworks = require("@unlock-protocol/networks");
const { execSync } = require("child_process");
const allNetworks = require('@unlock-protocol/networks')
const { execSync } = require('child_process')

// if any network is present this array, only these will be executed
const only = [];
const only = []

// these networks will be excluded from run
const toExclude = ["localhost", "default", "networks"];
const toExclude = ['localhost', 'default', 'networks']

const networks = only.length
? only
: Object.keys(allNetworks).filter((n) => !toExclude.includes(n));
: Object.keys(allNetworks).filter((n) => !toExclude.includes(n))

console.log(`Running task for the following networks: ${networks.toString()}`);
console.log(`Running task for the following networks: ${networks.toString()}`)

for (let i = 0; i < networks.length; i++) {
const cmd = `yarn hardhat`;
const args = ["--network", networks[i], ...process.argv.slice(2)];
const cmd = `yarn hardhat`
const args = ['--network', networks[i], ...process.argv.slice(2)]

console.log(cmd, args);
execSync(`${cmd} ${args.join(" ")}`, {
stdio: "inherit",
});
// console.log(cmd, args)
execSync(`${cmd} ${args.join(' ')}`, {
stdio: 'inherit',
})
}

0 comments on commit 73f8eff

Please sign in to comment.