Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add an on-ramp app to uusd.ubq.fi #6

Draft
wants to merge 42 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9043cd7
chore: add axios
zugdev Oct 11, 2024
30ccb09
feat: change page title and body
zugdev Oct 11, 2024
8e66e6a
feat: add a allowed tokens fetching script
zugdev Oct 11, 2024
c08a05b
chore: move main
zugdev Oct 11, 2024
e4af1d8
chore: comments
zugdev Oct 11, 2024
b676de1
feat: filter fetch by chain id
zugdev Oct 11, 2024
a0b9907
chore: add cowprotocol sdk for quote and swap
zugdev Oct 12, 2024
8a9caa9
chore: add ethers
zugdev Oct 12, 2024
124477f
chore: yarn add reown
zugdev Oct 12, 2024
e803d3a
chore: add peer dependency coinbase wallet for reown (wallet connect)
zugdev Oct 12, 2024
e204fd9
feat: add reown connect wallet and network buttons
zugdev Oct 12, 2024
bd137c0
feat: fetch instead of axios
zugdev Oct 12, 2024
e1bd0be
chore: downgrade ethers
zugdev Oct 12, 2024
3395b38
feat: add a quote swaps script
zugdev Oct 12, 2024
67cedca
chore: lint
zugdev Oct 12, 2024
f8e66dc
chore: temporarily add react
zugdev Oct 12, 2024
6ddeaf6
feat: add caching in indexed db for fetched tokens
zugdev Oct 12, 2024
f902b63
feat: manually handle provider since wallet connect is down for now
zugdev Oct 12, 2024
cb4d174
feat: use app state to get address, chanId and connection status
zugdev Oct 12, 2024
3344acd
feat: export some shared constants
zugdev Oct 12, 2024
4e6d6b0
feat: handle case where input token is either LUSD or UBQ
zugdev Oct 12, 2024
62307a3
feat: backend address is the one to execute swaps
zugdev Oct 12, 2024
54143a1
chore: lint
zugdev Oct 12, 2024
2e749d8
feat: calculate fees and add LUSD and UBQ as Token objects
zugdev Oct 12, 2024
4c9fbdd
chore: manage package and build script
zugdev Oct 13, 2024
d2a5594
feat: add backendSigner to sign swap, mint and bridge transactions
zugdev Oct 13, 2024
f0e2015
feat: accept sepolia input as well
zugdev Oct 13, 2024
dcc84d8
feat: export types
zugdev Oct 13, 2024
dce0347
feat: add a network switch handler
zugdev Oct 13, 2024
5e45a0e
feat: add a button to execute swap
zugdev Oct 13, 2024
890d8b0
feat: add executeSwaps
zugdev Oct 13, 2024
96f79d4
chore: input amount
zugdev Oct 13, 2024
ff65127
feat: add web3 utils
zugdev Oct 13, 2024
fd3ba5e
feat: add working swaps
zugdev Oct 13, 2024
2f1d60f
chore: lint
zugdev Oct 13, 2024
69dddb7
feat: support different splits in different chains for testing
zugdev Oct 13, 2024
1153cac
chore: update backend address
zugdev Oct 13, 2024
201b6c4
feat: add slippage on sepolia
zugdev Oct 13, 2024
97207ee
feat: add allowance util
zugdev Oct 13, 2024
ce1cb34
feat: add slippage check allowance and set validity time to 30mins
zugdev Oct 13, 2024
6689caf
feat: allow for different splits in different chains
zugdev Oct 13, 2024
d594695
feat: add contracts
zugdev Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log"],
"useGitignore": true,
"language": "en",
"words": ["dataurl", "devpool", "outdir", "servedir"],
"words": ["dataurl", "devpool", "outdir", "servedir", "proxiable", "TYPEHASH", "chainlink", "UUSD", "Reown", "Caip", "Lusd", "appkit"],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
Expand Down
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MY_SECRET="MY_SECRET"
BACKEND_PRIVATE_KEY="0xYOURPRIVATEKEY"
6 changes: 2 additions & 4 deletions .github/workflows/sync-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Sync branch to template
on:
workflow_dispatch:
schedule:
- cron: '14 0 1 * *'
- cron: "14 0 1 * *"

jobs:
sync:
Expand All @@ -23,7 +23,7 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Sync branch to template
env:
GH_TOKEN: ${{ steps.get_installation_token.outputs.token }}
Expand All @@ -45,5 +45,3 @@ jobs:
git commit -m "chore: sync template"
git push "$original_remote" "$pr_branch"
gh pr create --title "Sync branch to template" --body "This pull request merges changes from the template repository." --head "$pr_branch" --base "$branch_name"


36 changes: 29 additions & 7 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { config } from "dotenv";
import esbuild from "esbuild";
const typescriptEntries = ["static/main.ts"];
// const cssEntries = ["static/style.css"];
const entries = [
...typescriptEntries,
// ...cssEntries
];
config();

const typescriptEntries = ["src/main.ts"];
const cssEntries = ["static/style.css"];
const entries = [...typescriptEntries, ...cssEntries];

export const esBuildContext: esbuild.BuildOptions = {
sourcemap: true,
Expand All @@ -18,8 +18,12 @@ export const esBuildContext: esbuild.BuildOptions = {
".eot": "dataurl",
".ttf": "dataurl",
".svg": "dataurl",
".json": "dataurl",
},
outdir: "static/dist",
define: createEnvDefines(["BACKEND_PRIVATE_KEY"], {
BACKEND_PRIVATE_KEY: process.env.BACKEND_PRIVATE_KEY,
}),
};

esbuild
Expand All @@ -29,5 +33,23 @@ esbuild
})
.catch((err) => {
console.error(err);
process.exit(1);
});

function createEnvDefines(environmentVariables: string[], generatedAtBuild: Record<string, unknown>): Record<string, string> {
const defines: Record<string, string> = {};
for (const name of environmentVariables) {
const envVar = process.env[name];
if (envVar !== undefined) {
defines[name] = JSON.stringify(envVar);
} else {
console.log(process.env.BACKEND_PRIVATE_KEY);
throw new Error(`Missing environment variable: ${name}`);
}
}
for (const key in generatedAtBuild) {
if (Object.prototype.hasOwnProperty.call(generatedAtBuild, key)) {
defines[key] = JSON.stringify(generatedAtBuild[key]);
}
}
return defines;
}
4 changes: 0 additions & 4 deletions build/index.ts

This file was deleted.

15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ts-template",
"name": "@ubiquity/uusd.ubq.fi",
"version": "1.0.0",
"description": "Template repository with TypeScript support.",
"description": "The Ubiquity Dollar Dapp",
"main": "build/index.ts",
"author": "Ubiquity DAO",
"license": "MIT",
Expand All @@ -24,13 +24,19 @@
},
"keywords": [
"typescript",
"template",
"uusd",
"dao",
"ubiquity",
"open-source"
],
"dependencies": {
"dotenv": "^16.4.4"
"@coinbase/wallet-sdk": "^4.1.0",
"@cowprotocol/cow-sdk": "^5.5.1",
"@reown/appkit": "^1.1.2",
"@reown/appkit-adapter-ethers": "^1.1.2",
"dotenv": "^16.4.4",
"ethers": "5.6.2",
"react": "^18.3.1"
},
"devDependencies": {
"@commitlint/cli": "^18.6.1",
Expand All @@ -42,6 +48,7 @@
"@mswjs/data": "0.16.1",
"@types/jest": "29.5.12",
"@types/node": "^20.11.19",
"@types/react": "^18",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"cspell": "^8.4.0",
Expand Down
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { SupportedChainId } from "@cowprotocol/cow-sdk";
export const backendAddress = "0x4E322f2d5eAfbaEEAe14Db0Cfb6ab206dCBc048c";
export const mainnet = SupportedChainId.MAINNET;
export const sepolia = SupportedChainId.SEPOLIA;
Loading