Skip to content

Commit

Permalink
Merge branch 'master' into ui-combobox-component
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTxbi authored Oct 11, 2024
2 parents a5b3f79 + 4c6b693 commit e1d432f
Show file tree
Hide file tree
Showing 99 changed files with 2,048 additions and 705 deletions.
13 changes: 6 additions & 7 deletions docs/docs/governance/unlock-dao-tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ import { networks } from '@unlock-protocol/networks'
return <TokenNetwork network={network} />
})}
</table>


## Earning UP Token Rewards

Unlock Protocol is governed by its implementers and users. As such, the protocol automatically distributes UP (or UDT, depending on network) tokens as a reward on every _purchase_ of a paid membership, on applicable networks.
Unlock Protocol is governed by its implementers and users. As such, the protocol automatically distributes UP (or UDT, depending on network) tokens as a reward on every _purchase_ of a paid membership, on applicable networks.

When facilitating a purchase, the application sending the transaction can optionally add a `referrer` address to its transaction. This referrer address will receive the reward tokens, if applicable.

Expand Down Expand Up @@ -105,8 +104,7 @@ The swapping of UDT for UP is handled by a swapping smart contract. [The swappin

This swapping contract was created by Unlock Labs, and **has been audited by [Code4rena](https://code4rena.com/)**.

> *The Unlock Labs team has created a website at https://up-swap.unlock-protocol.com/ where anyone holding UDT can bridge their UDT from mainnet to Base and swap that UDT for UP governance tokens.*
>
> _The Unlock Labs team has created a website at https://up-swap.unlock-protocol.com/ where anyone holding UDT can bridge their UDT from mainnet to Base and swap that UDT for UP governance tokens._
The Unlock Labs team has created a website at [https://up-swap.unlock-protocol.com/](https://up-swap.unlock-protocol.com/) where anyone holding UDT can bridge their UDT from mainnet to Base and swap that UDT for UP governance tokens.

Expand Down Expand Up @@ -187,26 +185,27 @@ The maximum supply of the Unlock Protocol UP token is fixed at the upper bound o

### Are there liquidity pools for the Unlock Protocol UP token?

There is a Uniswap V3 liquidity pool for Base ETH/UP pairs at [https://app.uniswap.org/explore/pools/base/0x9EF81F4E2F2f15Ff1c0C3f8c9ECc636580025242](https://app.uniswap.org/explore/pools/base/0x9EF81F4E2F2f15Ff1c0C3f8c9ECc636580025242)
There is a Uniswap V3 liquidity pool for Base ETH/UP pairs at [https://app.uniswap.org/explore/tokens/base/0xac27fa800955849d6d17cc8952ba9dd6eaa66187)

### What is the difference between the Unlock Protocol UP token (UP) and the Unlock DAO Token (UDT)

- UP has been deployed on Base and benefits from faster transactions while still allowing governance
- UP has 1,000,000,000 supply while UDT had a 1,000,000 supply and UDT/UP has a fixed "exchange" rate of 1 for 1000

### Are UP tokens required?

UP (and UDT, its predecessor) are perfectly _optional_. Creators can deploy smart contracts without knowledge of UP and their members can similarly purchase memberships without knowing about these tokens.

### Graphic assets for the Unlock Protocol UP token

#### Square image (Right-click image to open or download)

![UP Token square icon](/img/icons/UP-token-square.png)

#### Round image (Right-click image to open or download)

![UP Token round icon](/img/icons/UP-token-round.png)

### What is the Unlock Protocol Foundation?

The role of the Unlock Protocol Foundation is to promote and encourage adoption of the Unlock Protocol.


3 changes: 1 addition & 2 deletions docs/src/components/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,12 @@ export const SupportedNetwork = ({ network }) => {
export const TokenNetwork = ({ network }) => {
const provider = new JsonRpcProvider(network.publicProvider)
const { data: udt } = useQuery({
queryKey: ['getUdt', network.unlockAddress],
queryKey: ['getUdt', network.unlockAddress, network.id],
queryFn: async () => {
return getUdt(provider, network.unlockAddress)
},
enabled: !!network.unlockAddress,
})
console.log(udt)

const { data: symbol } = useQuery({
queryKey: ['getSymbol', network.unlockAddress, udt],
Expand Down
12 changes: 11 additions & 1 deletion packages/contracts/bin/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
SRC_DOCS_FOLDER="$(pwd)/docs"
DEST_DOCS_FOLDER="$(pwd)/docs-reorg"

#cleanup
rm -rf $SRC_DOCS_FOLDER

# build docs
yarn hardhat dodoc
yarn hardhat docgen

# delete existing folder
rm -rf $DEST_DOCS_FOLDER
mkdir -p $DEST_DOCS_FOLDER

# delete all contracts than are NOT interfaces
find ./docs -type f -name 'PublicLock*' -exec rm {} \;
find ./docs -type f -name 'Unlock*' -exec rm {} \;

# first archive all
cp -R $SRC_DOCS_FOLDER $DEST_DOCS_FOLDER
mv $DEST_DOCS_FOLDER/docs $DEST_DOCS_FOLDER/archive
Expand Down Expand Up @@ -153,3 +160,6 @@ echo '{
rm -rf $SRC_DOCS_FOLDER
mv $DEST_DOCS_FOLDER $SRC_DOCS_FOLDER

# cleanup tmp files
find ./docs -type f -name '*.md-e' -exec rm {} \;

33 changes: 14 additions & 19 deletions packages/contracts/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,14 @@
*/

// to build contract docs
require('@primitivefi/hardhat-dodoc')
// require('@primitivefi/hardhat-dodoc')
require('solidity-docgen')

const fs = require('fs-extra')
require('./task/exportAbis')

const contractsPath = './src/contracts'

// list all interfaces to document
const contractsToDocument = fs
.readdirSync(contractsPath)
.map((contractName) =>
fs.readdirSync(`${contractsPath}/${contractName}`).filter(
(n) =>
n.startsWith('I') && // only interfaces
!n.includes('Sol') && // exclude various solc versions
!n.startsWith('IUnlockDiscountToken') // exclude UDT
)
)
.flat()

const settings = {
optimizer: {
enabled: true,
Expand Down Expand Up @@ -53,11 +41,18 @@ module.exports = {
},
],
},
dodoc: {
// debugMode: true,
keepFileStructure: true,
include: contractsToDocument,
exclude: ['IERC165', 'IERC721', 'IERC721Enumerable', 'Initializable'],
docgen: {
pages: 'files',
exclude: [
'IERC165',
'IERC721',
'IERC721Enumerable',
'Initializable',
'UP',
'utils',
'Governor',
'UnlockDiscountToken',
],
},
paths: {
sources: contractsPath,
Expand Down
3 changes: 2 additions & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"copyutils": "cp dist/src/utils/* dist",
"copyindex": "cp dist/src/index.js dist && cp -r dist/src/abis dist",
"docs": "sh ./bin/build_docs.sh",
"docs:docgen": "yarn hardhat docgen",
"docs:copy": "copyfiles --verbose docs/**/*.json docs/**/*.md dist",
"prepublish": "yarn clean && yarn build && yarn build:docs",
"publish:npm": "yarn prepublish && npm publish"
Expand All @@ -27,14 +28,14 @@
"directory": "packages/contracts"
},
"devDependencies": {
"@primitivefi/hardhat-dodoc": "0.2.3",
"@unlock-protocol/networks": "workspace:^",
"@unlock-protocol/tsconfig": "workspace:./packages/tsconfig",
"@unlock-protocol/types": "workspace:^",
"copyfiles": "2.4.1",
"eslint": "9.11.1",
"fs-extra": "11.2.0",
"hardhat": "2.22.9",
"solidity-docgen": "0.6.0-beta.36",
"typescript": "5.6.2"
},
"files": [
Expand Down
6 changes: 6 additions & 0 deletions packages/networks/src/networks/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ export const arbitrum: NetworkConfig = {
name: 'Arbitrum',
symbol: 'ARB',
},
{
address: '0xd5d3aA404D7562d09a848F96a8a8d5D65977bF90',
decimals: 18,
name: 'Unlock Discount Token',
symbol: 'UDT',
},
],
uniswapV3: {
factoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
Expand Down
12 changes: 12 additions & 0 deletions packages/networks/src/networks/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ export const base: NetworkConfig = {
name: 'Degen',
symbol: 'DEGEN',
},
{
address: '0xaC27fa800955849d6D17cC8952Ba9dD6EAA66187',
decimals: 18,
name: 'UnlockProtocolToken',
symbol: 'UP',
},
{
address: '0xD7eA82D19f1f59FF1aE95F1945Ee6E6d86A25B96',
decimals: 18,
name: 'Unlock Discount Token',
symbol: 'UDT',
},
],
uniswapV3: {
factoryAddress: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD',
Expand Down
6 changes: 6 additions & 0 deletions packages/networks/src/networks/gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export const gnosis: NetworkConfig = {
name: 'Tether USD on xDai',
symbol: 'USDT',
},
{
address: '0x8C84142c4a716a16a89d0e61707164d6107A9811',
decimals: 18,
name: 'UDT from Ethereum',
symbol: 'UDT',
},
],
unlockAddress: '0x1bc53f4303c711cc693F6Ec3477B83703DcB317f',
unlockDaoToken: {
Expand Down
6 changes: 6 additions & 0 deletions packages/networks/src/networks/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ export const mainnet: NetworkConfig = {
name: 'BNB',
symbol: 'BNB',
},
{
address: '0x90DE74265a416e1393A450752175AED98fe11517',
decimals: 18,
name: 'Unlock Discount Token',
symbol: 'UDT',
},
],
uniswapV3: {
factoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
Expand Down
6 changes: 6 additions & 0 deletions packages/networks/src/networks/optimism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ export const optimism: NetworkConfig = {
name: 'Wrapped BTC',
symbol: 'WBTC',
},
{
address: '0xc709c9116dBf29Da9c25041b13a07A0e68aC5d2D',
decimals: 18,
name: 'Unlock Discount Token',
symbol: 'UDT',
},
],
uniswapV3: {
factoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
Expand Down
14 changes: 10 additions & 4 deletions packages/networks/src/networks/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export const polygon: NetworkConfig = {
nativeCurrency: {
coingecko: 'matic-network',
decimals: 18,
name: 'Matic',
symbol: 'MATIC',
name: 'Wrapped Polygon Ecosystem Token',
symbol: 'WPOL',
wrapped: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
},
opensea: {
Expand Down Expand Up @@ -142,15 +142,21 @@ export const polygon: NetworkConfig = {
{
address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
decimals: 18,
name: 'Wrapped Matic',
symbol: 'WMATIC',
name: 'Wrapped Polygon Ecosystem Token',
symbol: 'WPOL',
},
{
address: '0xE06Bd4F5aAc8D0aA337D13eC88dB6defC6eAEefE',
decimals: 18,
name: 'PlanetIX',
symbol: 'IXT',
},
{
address: '0xf7E78d9C4c74df889A83C8C8d6D05BF70fF75876',
decimals: 18,
name: 'Unlock Discount Token (PoS)',
symbol: 'UDT',
},
],
uniswapV3: {
factoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
Expand Down
6 changes: 6 additions & 0 deletions packages/networks/src/networks/sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ export const sepolia: NetworkConfig = {
name: 'Uniswap',
symbol: 'UNI',
},
{
address: '0x447B1492C5038203f1927eB2a374F5Fcdc25999d',
decimals: 18,
name: 'Unlock Discount Token',
symbol: 'UDT',
},
],
uniswapV3: {
factoryAddress: '0x0227628f3F023bb0B980b67D528571c95c6DaC1c',
Expand Down
27 changes: 13 additions & 14 deletions packages/ui/lib/components/HeaderNav/HeaderNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
FiMenu as MenuIcon,
FiPlus as PlusIcon,
FiMinus as MinusIcon,
FiChevronDown as ChevronDownIcon,
} from 'react-icons/fi'
import { CgClose as CloseIcon } from 'react-icons/cg'
import { Size, SizeStyleProp } from '~/types'
Expand Down Expand Up @@ -83,8 +84,8 @@ export interface NavbarProps {
}

const POPOVER_CLASSES: SizeStyleProp = {
small: 'w-52 -ml-16 pt-4 lg:pt-9 sm:px-0',
medium: 'w-full pt-4 transform -translate-x-1/2 lg:pt-9 left-1/2 sm:px-0',
small: 'w-52 pt-4 lg:pt-2 sm:px-0',
medium: 'w-full pt-4 lg:pt-9 sm:px-0',
}

const NavSectionTitle = ({
Expand Down Expand Up @@ -223,11 +224,12 @@ const NavSectionDesktop = (section: MenuSectionProps) => {

return (
<span
className={`text-lg duration-200 hover:text-brand-ui-primary md:p-4 ${
className={`text-lg duration-200 hover:text-brand-ui-primary md:p-4 ${
open || isActive ? 'text-brand-ui-primary' : 'text-gray-700'
}`}
} flex items-center`}
>
{title}
{options.length > 0 && <ChevronDownIcon className="ml-1" size={20} />}
</span>
)
}
Expand Down Expand Up @@ -258,13 +260,7 @@ const NavSectionDesktop = (section: MenuSectionProps) => {
{({ open }) => (
<>
<Popover.Button className="outline-none">
<span
className={`text-lg duration-200 md:p-4 hover:text-brand-ui-primary ${
open ? 'text-brand-ui-primary' : 'text-gray-700'
}`}
>
{title}
</span>
<Title title={title} open={open} />
</Popover.Button>
<Transition
as={Fragment}
Expand Down Expand Up @@ -441,13 +437,16 @@ export const HeaderNav = ({
<img
src={logoImageSrc}
alt="logo"
className=""
className="w-auto h-8"
style={{
height: logo.size ? `${logo.size}px` : undefined,
height: logo.size
? `${Math.min(logo.size, 32)}px`
: undefined,
}}
/>
{logo?.domain && (
<span className="pl-1 text-sm font-semibold md:pl-2 md:text-xl">
<span className="pl-1 text-xs font-semibold md:pl-2 md:text-base">
{' '}
{logo.domain}
</span>
)}
Expand Down
15 changes: 2 additions & 13 deletions packages/ui/lib/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode } from 'react'
import {
Dialog,
DialogPanel,
DialogBackdrop,
Transition,
TransitionChild,
} from '@headlessui/react'
Expand Down Expand Up @@ -48,19 +48,8 @@ export function Modal({ isOpen, setIsOpen, children, empty }: Props) {
className="fixed inset-0 z-10 overflow-y-auto"
onClose={setIsOpen}
>
<DialogBackdrop className="fixed inset-0 transition-opacity bg-gray-500 bg-opacity-50 backdrop-blur" />
<div className="flex flex-col items-center justify-center min-h-screen p-6">
<TransitionChild
as={React.Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<DialogPanel className="fixed inset-0 transition-opacity bg-gray-500 bg-opacity-50 backdrop-blur" />
</TransitionChild>

<TransitionChild
as={React.Fragment}
enter="ease-out duration-300"
Expand Down
Loading

0 comments on commit e1d432f

Please sign in to comment.