Skip to content

Commit 6585524

Browse files
authored
Merge pull request #169 from gnosischain/staging
feat: xDAI -> USDS migration 1st step, related to #161
2 parents 918eac5 + 592858f commit 6585524

70 files changed

Lines changed: 30577 additions & 122 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/oicd-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ on:
1515
description: 'subgraph dev tag version for gc subgraph'
1616
required: true
1717
type: string
18-
default: v1.0.1-develop
18+
default: version/latest
1919
dev_subgraph_mainnet:
2020
description: 'subgraph dev tag version for mainnet subgraph'
2121
required: true
2222
type: string
23-
default: v1.0.0-develop
23+
default: version/latest
2424

2525
env:
2626
AWS_REGION: 'eu-central-1'

app/.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
*.pem
2222
tsconfig.tsbuildinfo
2323
.eslintcache
24-
types/generated/
2524

2625
# debug
2726
npm-debug.log*
@@ -38,8 +37,9 @@ yarn-error.log*
3837
# vercel
3938
.vercel
4039

41-
#types
42-
/types/typechain
43-
4440
#IDE files
4541
/.idea
42+
43+
44+
# types/generated/
45+
# types/typechain/

app/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ COPY /src ./src
3232
# Cleaning the cache of yarn
3333
RUN yarn cache clean
3434

35-
RUN yarn install
36-
RUN yarn postinstall
35+
RUN yarn install
3736

3837
FROM base AS builder
3938
WORKDIR /app
4039
COPY --from=deps /app/node_modules ./node_modules
4140
COPY --from=deps /app/src ./src
42-
COPY --from=deps /app/types ./types
4341
COPY . .
4442

4543
ENV NEXT_TELEMETRY_DISABLED 1

app/docker-compose.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
services:
32
web:
43
build:
@@ -8,6 +7,6 @@ services:
87
- .:/app
98
command: npm run dev
109
ports:
11-
- "3000:3000"
10+
- '3000:3000'
1211
environment:
13-
NODE_ENV: development
12+
NODE_ENV: development

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"start": "next start",
1616
"typechain": "typechain --target=ethers-v5 ./src/abis/**/*.json --out-dir ./types/typechain/",
1717
"subgraph-codegen": "graphql-codegen --config ./subgraph-config.js",
18-
"postinstall": "yarn typechain && yarn subgraph-codegen"
18+
"postinstall-local": "yarn typechain && yarn subgraph-codegen"
1919
},
2020
"dependencies": {
2121
"@babel/traverse": "^7.23.2",

app/pages/api/tokens.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { NextApiRequest, NextApiResponse } from 'next'
22

3-
import { NATIVE_TOKEN_ADDRESS } from '@/src/constants/config/common'
3+
import { NATIVE_TOKEN_ADDRESS, USDS_ADDRESS } from '@/src/constants/config/common'
44
import { isSameString } from '@/src/utils/tools'
55
import { Token as BaseToken } from '@/types/token'
66
import bridgedTokens from '@/src/constants/bridged_tokens.json'
@@ -35,6 +35,7 @@ export default function handler(_: NextApiRequest, res: NextApiResponse<Array<To
3535
const { address, decimals, foreign_address, icon_url, name, origin_chain_id, symbol } = token
3636
const isWethOnXdai = isSameString(address, WETH_ON_XDAI)
3737
const isDaiOnMainnet = isSameString(foreign_address, DAI_ON_MAINNET)
38+
const isUsdsOnMainnet = isSameString(foreign_address, USDS_ADDRESS)
3839
let extraTokens: Array<Token> = []
3940

4041
if (isDaiOnMainnet) {
@@ -107,6 +108,41 @@ export default function handler(_: NextApiRequest, res: NextApiResponse<Array<To
107108
]
108109
}
109110

111+
if (isUsdsOnMainnet) {
112+
extraTokens = [
113+
{
114+
chainId: Number(origin_chain_id),
115+
address: foreign_address,
116+
decimals: Number(decimals),
117+
logoURI: icon_url ?? undefined,
118+
name: name.replace(bridgedTokenName, ''),
119+
symbol,
120+
extensions: {
121+
bridgeInfo: {
122+
100: {
123+
tokenAddress: NATIVE_TOKEN_ADDRESS,
124+
},
125+
},
126+
},
127+
},
128+
{
129+
chainId: 100,
130+
address: NATIVE_TOKEN_ADDRESS,
131+
decimals: Number(decimals),
132+
logoURI: icon_url ?? undefined,
133+
name: 'xDai',
134+
symbol: 'xDAI',
135+
extensions: {
136+
bridgeInfo: {
137+
[origin_chain_id]: {
138+
tokenAddress: foreign_address,
139+
},
140+
},
141+
},
142+
},
143+
]
144+
}
145+
110146
return [
111147
{
112148
chainId: Number(origin_chain_id),
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
[
2+
{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
3+
{ "inputs": [], "name": "ClaimUsdsNotSupported", "type": "error" },
4+
{ "inputs": [], "name": "InvalidInitialization", "type": "error" },
5+
{ "inputs": [], "name": "NotInitializing", "type": "error" },
6+
{
7+
"inputs": [{ "internalType": "address", "name": "owner", "type": "address" }],
8+
"name": "OwnableInvalidOwner",
9+
"type": "error"
10+
},
11+
{
12+
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
13+
"name": "OwnableUnauthorizedAccount",
14+
"type": "error"
15+
},
16+
{
17+
"anonymous": false,
18+
"inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }],
19+
"name": "Initialized",
20+
"type": "event"
21+
},
22+
{
23+
"anonymous": false,
24+
"inputs": [
25+
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
26+
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
27+
],
28+
"name": "OwnershipTransferred",
29+
"type": "event"
30+
},
31+
{
32+
"inputs": [],
33+
"name": "DAI",
34+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
35+
"stateMutability": "view",
36+
"type": "function"
37+
},
38+
{
39+
"inputs": [],
40+
"name": "FOREIGN_AMB",
41+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
42+
"stateMutability": "view",
43+
"type": "function"
44+
},
45+
{
46+
"inputs": [],
47+
"name": "FOREIGN_OMNIBRIDGE",
48+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
49+
"stateMutability": "view",
50+
"type": "function"
51+
},
52+
{
53+
"inputs": [],
54+
"name": "FOREIGN_XDAIBRIDGE",
55+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
56+
"stateMutability": "view",
57+
"type": "function"
58+
},
59+
{
60+
"inputs": [],
61+
"name": "USDS",
62+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
63+
"stateMutability": "view",
64+
"type": "function"
65+
},
66+
{
67+
"inputs": [],
68+
"name": "WETH_OMNIBRIDGE_ROUTER",
69+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
70+
"stateMutability": "view",
71+
"type": "function"
72+
},
73+
{
74+
"inputs": [
75+
{ "internalType": "bytes", "name": "message", "type": "bytes" },
76+
{ "internalType": "bytes", "name": "signatures", "type": "bytes" }
77+
],
78+
"name": "executeSignatures",
79+
"outputs": [],
80+
"stateMutability": "nonpayable",
81+
"type": "function"
82+
},
83+
{
84+
"inputs": [
85+
{ "internalType": "bytes", "name": "message", "type": "bytes" },
86+
{ "internalType": "bytes", "name": "signatures", "type": "bytes" }
87+
],
88+
"name": "executeSignaturesUSDS",
89+
"outputs": [],
90+
"stateMutability": "nonpayable",
91+
"type": "function"
92+
},
93+
{
94+
"inputs": [{ "internalType": "address", "name": "owner", "type": "address" }],
95+
"name": "initialize",
96+
"outputs": [],
97+
"stateMutability": "nonpayable",
98+
"type": "function"
99+
},
100+
{
101+
"inputs": [],
102+
"name": "owner",
103+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
104+
"stateMutability": "view",
105+
"type": "function"
106+
},
107+
{
108+
"inputs": [
109+
{ "internalType": "address", "name": "token", "type": "address" },
110+
{ "internalType": "address", "name": "recipient", "type": "address" },
111+
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
112+
],
113+
"name": "recoverLockedFund",
114+
"outputs": [],
115+
"stateMutability": "nonpayable",
116+
"type": "function"
117+
},
118+
{
119+
"inputs": [
120+
{ "internalType": "address", "name": "_token", "type": "address" },
121+
{ "internalType": "address", "name": "_receiver", "type": "address" },
122+
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
123+
],
124+
"name": "relayTokens",
125+
"outputs": [],
126+
"stateMutability": "payable",
127+
"type": "function"
128+
},
129+
{
130+
"inputs": [],
131+
"name": "renounceOwnership",
132+
"outputs": [],
133+
"stateMutability": "nonpayable",
134+
"type": "function"
135+
},
136+
{
137+
"inputs": [
138+
{ "internalType": "bytes", "name": "message", "type": "bytes" },
139+
{ "internalType": "bytes", "name": "signatures", "type": "bytes" }
140+
],
141+
"name": "safeExecuteSignaturesWithAutoGasLimit",
142+
"outputs": [],
143+
"stateMutability": "nonpayable",
144+
"type": "function"
145+
},
146+
{
147+
"inputs": [
148+
{ "internalType": "address", "name": "_token", "type": "address" },
149+
{ "internalType": "address", "name": "_route", "type": "address" }
150+
],
151+
"name": "setRoute",
152+
"outputs": [],
153+
"stateMutability": "nonpayable",
154+
"type": "function"
155+
},
156+
{
157+
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
158+
"name": "tokenRoutes",
159+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
160+
"stateMutability": "view",
161+
"type": "function"
162+
},
163+
{
164+
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
165+
"name": "transferOwnership",
166+
"outputs": [],
167+
"stateMutability": "nonpayable",
168+
"type": "function"
169+
}
170+
]

app/src/constants/bridged_tokens.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9762,6 +9762,22 @@
97629762
"symbol": "UDT",
97639763
"total_supply": "9936213363153110036806",
97649764
"type": "ERC-20"
9765+
},
9766+
{
9767+
"bridge_type": "xdai",
9768+
"foreign_address": "0xdC035D45d973E3EC169d2276DDab16f1e407384F",
9769+
"origin_chain_id": "1",
9770+
"address": "",
9771+
"circulating_market_cap": null,
9772+
"decimals": "18",
9773+
"exchange_rate": null,
9774+
"holders": "2281",
9775+
"icon_url": null,
9776+
"is_bridged": true,
9777+
"name": "USDS",
9778+
"symbol": "USDS",
9779+
"total_supply": "3854025994000000000000000000",
9780+
"type": "ERC-20"
97659781
}
97669782
]
97679783
}

app/src/constants/config/chains.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const chainsConfig: Record<ChainsValues, ChainConfig> = {
2424
bridge: {
2525
DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
2626
wForeignNative: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH
27+
USDS: '0xdc035d45d973e3ec169d2276ddab16f1e407384f',
2728
},
2829
},
2930
// [Chains.chiado]: {

app/src/constants/config/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ export const WALLET_CONNECT_DAPP_URL = process.env.NEXT_PUBLIC_WALLET_CONNECT_DA
1111
export const WALLET_CONNECT_PROJECT_ID = process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || ''
1212

1313
export const NATIVE_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
14+
15+
export const USDS_ADDRESS = '0xdC035D45d973E3EC169d2276DDab16f1e407384F'

0 commit comments

Comments
 (0)