Skip to content

Commit

Permalink
Merge develop into main (#94)
Browse files Browse the repository at this point in the history
* Add transaction model and base model***
***Update user model***
***Update token controller***
***Update routes***
***Update open_db_connection***
***Add token query***
***Add user query***
***Delete token service

* Sc/token manager (#65)

* Cleaning contracts folder

* listToken and delistToken

* event order declaration

* getTokenInfo and getListedTokens

* Tests for TokenManager

---------

Co-authored-by: Vincent Rainaud <[email protected]>

* feat: get coin by address

* fix: swagger config for routes

* feat: maj env.local api

* Merge branch 'develop' of https://github.com/MTthoas/Dex into develop

* feat: create crud / model / queries for pools

* feat: init next-app

* feat: layout with walletConnect

* delete package-lock.json

* feat: TanStack / WalletConnect ClientSide Provider Rendering & Create Users in backend in WalletConnect Hook

* migration to next finish

* migration to next finish

* feat: create users front & back

* react-query

* dynamic profil

* fix stylesheet

* correct header and api call

* feat: dashboard for users

* feat: dashboard layout, dynamic routing, transactions tab & hooks, walletConnect fixes

* feat: fix api

* Adding AccessManager (and Upgradeability) from OpenZeppelin lib (#84)

* feat(accessManager): adding accessManager contract and adapting contracts

* feat(accessManager): a lot

* feat(accessManager): submodules

* feat(accessManager): submodules

* feat(accessManager): submodules

* feat(accessManager): submodules

* feat(accessManager): submodulesssssssss

* feat(AccessMananger) Adding tests and deploy script

---------

Co-authored-by: Vincent Rainaud <[email protected]>

* fix(project): Cleaning projet

* feat: factoryPool contract, FactoryPool contract, gensToken contract / test / deploy

---------

Co-authored-by: MTthoas <[email protected]>
Co-authored-by: Guiiz94 <[email protected]>
Co-authored-by: Vincent Rainaud <[email protected]>
Co-authored-by: Matteo <[email protected]>
Co-authored-by: Matthias <[email protected]>
  • Loading branch information
6 people authored Apr 28, 2024
1 parent 2848f9a commit 2180940
Show file tree
Hide file tree
Showing 274 changed files with 21,528 additions and 10,759 deletions.
Binary file removed .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/contracts/.yarn/** linguist-vendored
/contracts/.yarn/releases/* binary
/contracts/.yarn/plugins/**/* binary
/contracts/.pnp.* binary linguist-generated
36 changes: 34 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
node_modules
.env
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
broadcast/

# Docs
docs/

# Dotenv file
.env

# Node modules
!/node_modules
node_modules/*

# Package lock files
package-lock.json

# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# System files
.DS_Store
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "contracts/lib/openzeppelin-contracts-upgradeable"]
path = contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "contracts/lib/openzeppelin-contracts"]
path = contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
Binary file added ArchitectureDEX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Annual project focused on creating a complete decentralized application (dApp) t
- npm
- Wallet ( metamask / trust .. )

<<<<<<< HEAD
## Technologies

To the global web architecture we're using foundry.Foundry manages your dependencies, compiles your project, runs tests, deploys, and lets you interact with the chain from the command-line and via Solidity scripts.
Expand Down Expand Up @@ -42,8 +41,6 @@ We're using React to create the frontend of the dApp. We're using TypeScript to

We're using Docker to run the API and the smart contracts on the same network.

=======
>>>>>>> develop
## Structure
```
├── contracts
Expand Down Expand Up @@ -71,7 +68,6 @@ We're using Docker to run the API and the smart contracts on the same network.
└── styles
```

<<<<<<< HEAD
## Installation

### 1. Clone the repository
Expand Down Expand Up @@ -106,21 +102,3 @@ cd ./frontend
npm i
npm start
```
=======
















>>>>>>> develop
1 change: 1 addition & 0 deletions abi/UserRegistry.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions abi/address.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
No files changed, compilation skipped
Traces:
[3104957] DeployDexContracts::run()
├─ [2141636] → new DexAccessManager@0xC7f2Cf4845C6db0e1a1e91ED41Bcd0FcC1b0E141
│ ├─ emit RoleGranted(roleId: 0, account: DefaultSender: [0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38], delay: 0, since: 1714038168 [1.714e9], newMember: true)
│ └─ ← [Return] 10568 bytes of code
├─ [892133] → new UserRegistry@0xdaE97900D4B184c5D2012dcdB658c008966466DD
│ ├─ emit AuthorityUpdated(authority: DexAccessManager: [0xC7f2Cf4845C6db0e1a1e91ED41Bcd0FcC1b0E141])
│ └─ ← [Return] 4339 bytes of code
├─ [0] console::log("UserRegistry deployed to:", UserRegistry: [0xdaE97900D4B184c5D2012dcdB658c008966466DD]) [staticcall]
│ └─ ← [Stop] 
├─ [0] console::log("DexRegistry deployed to:", DexAccessManager: [0xC7f2Cf4845C6db0e1a1e91ED41Bcd0FcC1b0E141]) [staticcall]
│ └─ ← [Stop] 
└─ ← [Stop] 


Script ran successfully.

== Logs ==
UserRegistry deployed to: 0xdaE97900D4B184c5D2012dcdB658c008966466DD
DexRegistry deployed to: 0xC7f2Cf4845C6db0e1a1e91ED41Bcd0FcC1b0E141
15 changes: 5 additions & 10 deletions api/.env.local
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
<<<<<<< HEAD
# Server settings:
SERVER_URL="0.0.0.0:5000"
SERVER_READ_TIMEOUT=60

# JWT settings:
JWT_SECRET_KEY=""
JWT_SECRET_KEY=
JWT_SECRET_KEY_EXPIRE_MINUTES_COUNT=15

CG_API_KEY=

# Database settings:
DB_SERVER_URL="host=localhost port=5432 user=postgres password= dbname=postgres sslmode=disable"
DB_SERVER_URL="host= port=5432 user= password= dbname= sslmode=disable"
DB_MAX_CONNECTIONS=100
DB_MAX_IDLE_CONNECTIONS=10
DB_MAX_LIFETIME_CONNECTIONS=2

# CoinGecko settings:
API_URL=https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=ethereum-ecosystem&x_cg_demo_api_key=
=======
API_URL=https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=ethereum-ecosystem&x_cg_demo_api_key=
>>>>>>> develop
DB_MAX_LIFETIME_CONNECTIONS=2
41 changes: 31 additions & 10 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
# Utilisation d'une image de builder Go avec Alpine pour un environnement minimal.
FROM golang:1.21-alpine AS builder

# Move to working directory (/build).
WORKDIR /build
# Installation de git, nécessaire pour récupérer les modules Go et Swaggo.
RUN apk add --no-cache git

# Copy and download dependency using go mod.
# Installation des certificats CA, cruciaux pour les appels HTTPS.
RUN apk add --no-cache ca-certificates

# Installation de Swag CLI pour la documentation Swagger.
RUN go install github.com/swaggo/swag/cmd/swag@latest

# Définir le répertoire de travail où se trouve le code source.
WORKDIR /api

# Copie des fichiers de module Go et téléchargement des dépendances.
COPY go.mod go.sum ./
RUN go mod download

# Copy the code into the container.
# Copie du reste de l'API dans l'image.
COPY . .

# Set necessary environmet variables needed for our image and build the API server.
# Génération de la documentation Swagger.
RUN swag init --generalInfo ./routes/swagger_routes.go --output ./docs

# Configuration des variables d'environnement nécessaires pour la construction.
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64

# Construction du serveur API.
RUN go build -ldflags="-s -w" -o apiserver .

# Utilisation d'une image scratch pour un environnement d'exécution minimal.
FROM scratch

# Copy binary and config files from /build to root folder of scratch container.
COPY --from=builder ["/build/apiserver", "/build/.env", "/"]
# Copie du binaire, des fichiers de configuration, et de la documentation Swagger.
COPY --from=builder /api/apiserver /
COPY --from=builder /api/.env /
COPY --from=builder /api/docs /docs

# Copie des certificats CA.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Export necessary port.
# Exposition du port sur lequel le serveur API s'exécute.
EXPOSE 5000

# Command to run when starting the container.
ENTRYPOINT ["/apiserver"]
# Commande pour exécuter le serveur API lors du démarrage du conteneur.
CMD ["/apiserver"]
6 changes: 3 additions & 3 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ BUILD_DIR = build
MIGRATIONS_FOLDER = $(CURDIR)/platform/migrations
DATABASE_URL = postgres://postgres:password@localhost/postgres?sslmode=disable

clean:
if exist $(BUILD_DIR) rmdir /s /q $(BUILD_DIR)
del /f /q cover.out 2>nul
# clean:
# if exist $(BUILD_DIR) rmdir /s /q $(BUILD_DIR)
# del /f /q cover.out 2>nul

test:
go test -v -timeout 30s -coverprofile=cover.out -cover ./...
Expand Down
31 changes: 21 additions & 10 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# Create Network

docker network create -d bridge dev-network

# PostgreSQL and initial Migration
docker run --rm -d \
--name dev-postgres \
--network dev-network \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=postgres \
-v ${HOME}/dev-postgres/data/:/var/lib/postgresql/data \
-p 5432:5432 \
postgres

docker run --rm -d --name dev-postgres --network dev-network -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -e POSTGRES_DB=postgres -v ${HOME}/dev-postgres/data/:/var/lib/postgresql/data -p 5432:5432 postgres
docker run --rm -d --name dev-postgres --network dev-network -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -e POSTGRES_DB=postgres -v \${HOME}/dev-postgres/data/:/var/lib/postgresql/data -p 5432:5432 postgres

docker run --rm -d \
--name dev-postgres \
--network dev-network \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=postgres \
-v \${HOME}/dev-postgres/data/:/var/lib/postgresql/data \
-p 5432:5432 \
postgres

# Migrate

migrate -path ./migrations -database "postgres://postgres:password@localhost/postgres?sslmode=disable" up

# Build Fiber docker Image ( DockerFile )

docker build -t fiber .

# Create and start container from image

docker run --rm -d --name dev-fiber --network dev-network -p 5000:5000 fiber

## IN LOCAL

docker build -t api-build .

go install github.com/swaggo/swag/cmd/swag@latest
swag init --generalInfo ./routes/swagger_routes.go --output ./docs
>> go run main.go
Loading

0 comments on commit 2180940

Please sign in to comment.