Skip to content

Commit

Permalink
Merge branch 'main' into ft_nullifier_registry_impl
Browse files Browse the repository at this point in the history
  • Loading branch information
mubarak23 authored Sep 3, 2024
2 parents 586d40d + a2722f6 commit 6882eab
Show file tree
Hide file tree
Showing 31 changed files with 1,285 additions and 173 deletions.
36 changes: 36 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,42 @@
"contributions": [
"code"
]
},
{
"login": "Ayoazeez26",
"name": "Abdulhakeem Abdulazeez Ayodeji",
"avatar_url": "https://avatars.githubusercontent.com/u/44169294?v=4",
"profile": "https://github.com/Ayoazeez26",
"contributions": [
"code"
]
},
{
"login": "luiz-lvj",
"name": "Luiz Vasconcelos Júnior",
"avatar_url": "https://avatars.githubusercontent.com/u/64055364?v=4",
"profile": "https://github.com/luiz-lvj",
"contributions": [
"code"
]
},
{
"login": "lana-shanghai",
"name": "lanaivina",
"avatar_url": "https://avatars.githubusercontent.com/u/31368580?v=4",
"profile": "https://github.com/lana-shanghai",
"contributions": [
"code"
]
},
{
"login": "BryanBorck",
"name": "Bryan",
"avatar_url": "https://avatars.githubusercontent.com/u/62529683?v=4",
"profile": "https://github.com/BryanBorck",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Snforge
uses: asdf-vm/actions/install@v3
- name: Set up Scarb
uses: software-mansion/setup-scarb@v1

- name: Set up SNForge
uses: foundry-rs/setup-snfoundry@v3

- name: Run cairo tests
run: snforge test
working-directory: contracts
run: scarb test
working-directory: contracts
56 changes: 44 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,44 @@ The concept was initially conceived and developed by [ZKP2P](https://zkp2p.xyz)

## Roadmap

### Milestone 1 - Basic Proving Flow

* basic flow
* [ ] Alice deposits 10 USDC to Escrow contract
* [ ] client establish MPC TLS connection with the Notary node
* [ ] client (Alice) generates dummy proof about account ownership with Circom on emulated Revolut data
* [ ] client (Bob) generates dummy proof about account ownership with Circom on emulated Revolut data
* [ ] client (Bob) generates dummy proof about transfer of funds with Circom on emulated Revolut data
* [ ] Notary node signs the proof generated by the client (Bob)
* [ ] client (Bob) receives the signed proof and calls the [Groth16 verifier](https://github.com/keep-starknet-strange/garaga/blob/main/src/cairo/src/groth16.cairo), passing the proof as calldata
* [ ] the TLS contract verifies the Notary node's signature and the correctness of the client (Bob) proof
* [ ] the Bob claims Alice's funds from the Escrow contract
### Milestone 01 - E2E flow without data verification
Tasks:

- [ ] extension mockup
- [ ] client mockup
- [ ] extension UI
- [ ] client swap page UI
- [ ] client wallet mgmt UI
- [ ] client registation page UI
- [ ] relevant data detection from extension
- [ ] extension/client connection
- [ ] onchain registration
- [ ] onchain escrow

### Milestone 02 - Offchain notarization and SNARK generation
Tasks:

- [ ] Notary mgmt UI in extension
- [ ] 2PC-TLS with notary mgmt
- [ ] Prover commitment generation
- [ ] generation of the verification zk-SNARK

### Milestone 03 - Onchain verification
Tasks:

- [ ] zk-SNARK (groth16) verification with Garaga
- [ ] escrow assertions based on previous verification

### Milestone 04 - Liquidity mgmt improved
Tasks:

- [ ] Liquidity lock/unlock implementation to avoid onramp collusions
- [ ] Allow better granularity
- [ ] Liquidity mgmt UI in client
- [ ] Onchain Liquidity mgmt implementation

### Milestone 05 - Notaries decentralisation
DVM could be an interesting solution to achieve this goal

## Flowchart 🎡

Expand Down Expand Up @@ -89,6 +115,12 @@ Thanks goes to these wonderful people. Follow the [contributors guide](https://g
<td align="center" valign="top" width="14.28%"><a href="https://ugureren.net/"><img src="https://avatars.githubusercontent.com/u/86152092?v=4?s=100" width="100px;" alt="Uğur Eren"/><br /><sub><b>Uğur Eren</b></sub></a><br /><a href="https://github.com/starkware/zkramp/commits?author=ugur-eren" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lindsaymoralesb"><img src="https://avatars.githubusercontent.com/u/87027508?v=4?s=100" width="100px;" alt="Lindsay Morales"/><br /><sub><b>Lindsay Morales</b></sub></a><br /><a href="https://github.com/starkware/zkramp/commits?author=lindsaymoralesb" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/chachaleo"><img src="https://avatars.githubusercontent.com/u/49371958?v=4?s=100" width="100px;" alt="Charlotte"/><br /><sub><b>Charlotte</b></sub></a><br /><a href="https://github.com/starkware/zkramp/commits?author=chachaleo" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Ayoazeez26"><img src="https://avatars.githubusercontent.com/u/44169294?v=4?s=100" width="100px;" alt="Abdulhakeem Abdulazeez Ayodeji"/><br /><sub><b>Abdulhakeem Abdulazeez Ayodeji</b></sub></a><br /><a href="https://github.com/starkware/zkramp/commits?author=Ayoazeez26" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/luiz-lvj"><img src="https://avatars.githubusercontent.com/u/64055364?v=4?s=100" width="100px;" alt="Luiz Vasconcelos Júnior"/><br /><sub><b>Luiz Vasconcelos Júnior</b></sub></a><br /><a href="https://github.com/starkware/zkramp/commits?author=luiz-lvj" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lana-shanghai"><img src="https://avatars.githubusercontent.com/u/31368580?v=4?s=100" width="100px;" alt="lanaivina"/><br /><sub><b>lanaivina</b></sub></a><br /><a href="https://github.com/starkware/zkramp/commits?author=lana-shanghai" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/BryanBorck"><img src="https://avatars.githubusercontent.com/u/62529683?v=4?s=100" width="100px;" alt="Bryan"/><br /><sub><b>Bryan</b></sub></a><br /><a href="https://github.com/starkware/zkramp/commits?author=BryanBorck" title="Code">💻</a></td>
</tr>
</tbody>
<tfoot>
Expand Down
13 changes: 11 additions & 2 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import Layout from 'src/components/Layout'

import RegisterPage from './pages/RegisterPage'
import RegisterPage from './pages/Register'
import RegistrationPage from './pages/Registration'
import SwapPage from './pages/Swap'
import StarknetProvider from './providers/StarknetProvider'

Expand All @@ -15,7 +16,15 @@ const router = createBrowserRouter([
),
},
{
path: '/register',
path: '/registration',
element: (
<Layout>
<RegistrationPage />
</Layout>
),
},
{
path: '/registration/register',
element: (
<Layout>
<RegisterPage />
Expand Down
13 changes: 13 additions & 0 deletions client/src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import styled from 'styled-components'

export const PrimaryButton = styled.button`
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 100%;
padding: 16px;
background-color: ${({ theme }) => theme.accent1};
border: 0;
border-radius: 12px;
font-weight: 500;
text-decoration: none;
cursor: pointer;
&:disabled {
Expand All @@ -28,3 +33,11 @@ export const OutlineButton = styled.button`
border: 1px solid ${({ theme }) => theme.white};
color: ${({ theme }) => theme.white};
`

export const ConnectButton = styled(PrimaryButton)`
width: auto;
padding: 14px 32px;
background: linear-gradient(360deg, #202a31 0%, #28353e 100%);
color: ${({ theme }) => theme.neutral1};
font-size: 16px;
`
65 changes: 65 additions & 0 deletions client/src/components/ConnectWalletModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { useConnect } from '@starknet-react/core'
import { ThemedText } from 'src/theme/components'
import styled from 'styled-components'

import { Column, Row } from '../Flex'

const Container = styled(Column)`
width: 300px;
align-items: flex-start;
padding: 16px;
background-color: ${({ theme }) => theme.bg2};
border: 1px solid ${({ theme }) => theme.border};
border-radius: 20px;
box-shadow: 0px 4px 4px 4px rgba(0, 0, 0, 0.3), 0px 8px 12px 10px rgba(0, 0, 0, 0.15);
`

const ConnectorsList = styled(Column)`
width: 100%;
:first-child {
border-top-left-radius: 12px;
border-top-right-radius: 12px;
}
:last-child {
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
}
`

const ConnectorCard = styled(Row)`
width: 100%;
padding: 12px;
background-color: ${({ theme }) => theme.bg3};
border: none;
outline: none;
cursor: pointer;
img {
width: 32px;
height: 32px;
}
`

export const ConnectWalletModal = (props: React.ComponentPropsWithoutRef<typeof Container>) => {
const { connect, connectors } = useConnect()

return (
<Container gap={16} {...props}>
<ThemedText.Title fontWeight={400}>Connect wallet</ThemedText.Title>

<ConnectorsList gap={4}>
{connectors
.filter((connector) => connector.available())
.map((connector) => (
<ConnectorCard as="button" key={connector.id} gap={16} onClick={() => connect({ connector })}>
<img src={connector.icon.dark} alt={connector.name} width={32} height={32} />

<ThemedText.Title fontWeight={400}>{connector.name}</ThemedText.Title>
</ConnectorCard>
))}
</ConnectorsList>
</Container>
)
}
33 changes: 33 additions & 0 deletions client/src/components/GenerateProofModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ThemedText } from 'src/theme/components'
import { Logo } from 'src/theme/components/icons'

import { Column } from '../Flex'
import Content from '../Modal/Content'
import Overlay from '../Modal/Overlay'
import Portal from '../Portal'

function GenerateProofModalContent() {
return (
<Content title="Proof generation">
<Column gap={42} alignItems="center">
<Column gap={16}>
<Logo width={42} height={42} />

<ThemedText.HeadlineSmall>Snarkification of the elliptic curve...</ThemedText.HeadlineSmall>
</Column>

<ThemedText.BodySecondary fontSize={16}>This might take a while</ThemedText.BodySecondary>
</Column>
</Content>
)
}

export default function GenerateProofModal() {
return (
<Portal>
<GenerateProofModalContent />

<Overlay />
</Portal>
)
}
105 changes: 104 additions & 1 deletion client/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,106 @@
import { useAccount } from '@starknet-react/core'
import { useState } from 'react'
import { NavLink } from 'react-router-dom'
import { ThemedText } from 'src/theme/components'
import { Logo } from 'src/theme/components/icons'
import styled from 'styled-components'

import { ConnectButton } from '../Button'
import { ConnectWalletModal } from '../ConnectWalletModal'
import { Row } from '../Flex'
import WalletSidebar from '../WalletSidebar'

const Container = styled(Row)`
justify-content: space-between;
padding: 24px 32px;
`

const Link = styled(ThemedText.BodyPrimary)`
color: rgba(255, 255, 255, 0.7);
font-weight: 500;
font-size: 18px;
text-decoration: none;
&.active {
color: ${({ theme }) => theme.neutral1};
}
`

const ConnectContainer = styled(Row)`
position: relative;
`

const ConnectWalletDropdown = styled(ConnectWalletModal)`
position: absolute;
top: calc(100% + 16px);
right: 0;
`

const AccountChip = styled(Row)`
padding: 6px 8px;
background-color: ${({ theme }) => theme.bg3};
border: none;
border-radius: 99px;
cursor: pointer;
`

const AccountStatusIcon = styled.div`
width: 12px;
height: 12px;
background-color: ${({ theme }) => theme.green};
border-radius: 12px;
`

export default function Header() {
return null
const [connectDropdownShown, setConnectDropdownShown] = useState(false)
const [walletSidebarShown, setWalletSidebarShown] = useState(false)

const { address } = useAccount()

const toggleConnectDropdown = () => {
setConnectDropdownShown((prev) => !prev)
}

const showWalletSidebar = () => {
setWalletSidebarShown(true)
}
const hideWalletSidebar = () => {
setWalletSidebarShown(false)
}

return (
<Container as="header">
<Row gap={32}>
<Logo width={42} height={42} />

<Row gap={28}>
<Link as={NavLink} to="/">
Swap
</Link>

<Link as={NavLink} to="/liquidity">
Liquidity
</Link>
</Row>
</Row>

{address ? (
<AccountChip as="button" gap={4} onClick={showWalletSidebar}>
<AccountStatusIcon />

<ThemedText.Title fontWeight={400}>
{address.slice(0, 6)}...{address.slice(-4)}
</ThemedText.Title>
</AccountChip>
) : (
<ConnectContainer>
<ConnectButton onClick={toggleConnectDropdown}>Connect</ConnectButton>

{connectDropdownShown && <ConnectWalletDropdown />}
</ConnectContainer>
)}

{walletSidebarShown && <WalletSidebar onClose={hideWalletSidebar} />}
</Container>
)
}
Loading

0 comments on commit 6882eab

Please sign in to comment.