Skip to content

Commit b18aa03

Browse files
author
kitty
committed
dexSimForSafeTrading
1 parent 86a623c commit b18aa03

File tree

15 files changed

+432
-0
lines changed

15 files changed

+432
-0
lines changed

app/DexSimulator/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.key
2+
.dockerignore
3+
.env
4+
build
5+
data/*

app/DexSimulator/1inch_routeur.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import requests
2+
3+
method = "get"
4+
apiUrl = "https://api.1inch.dev/swap/v6.0/1/quote"
5+
requestOptions = {
6+
"headers": {
7+
"Authorization": "Bearer wwBHIxQdQ0MeDKvYt3thRtZ1LXzsJFPm"
8+
},
9+
"body": "",
10+
"params": {}
11+
}
12+
13+
# Prepare request components
14+
headers = requestOptions.get("headers", {})
15+
body = requestOptions.get("body", {})
16+
params = requestOptions.get("params", {})
17+
18+
19+
response = requests.get(apiUrl, headers=headers, params=params)
20+
21+
print(response.json())

app/DexSimulator/README.md

Whitespace-only changes.

app/DexSimulator/finding.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'''bash
2+
curl -X POST \
3+
4+
-H "Content-Type: application/json" \
5+
6+
-d '{"query": "{ factories(first: 5) { id poolCount txCount totalVolumeUSD } bundles(first: 5) { id ethPriceUSD } }", "operationName": "Subgraphs", "variables": {}}' \
7+
8+
https://gateway.thegraph.com/api/{api-key}/subgraphs/id/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV
9+
'''
10+
11+
https://gateway.thegraph.com/api/[api-key]/subgraphs/id/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV
12+
QmTZ8ejXJxRo7vDBS4uwqBeGoxLSWbhaA7oXa1RvxunLy7
13+
5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__all__ = ["chain", "transaction", "wallet", "action"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pydantic import BaseModel
2+
from enum import Enum
3+
4+
5+
# FastAPI Models
6+
class Action(str, Enum, BaseModel):
7+
BUY: str = "BUY"
8+
SELL: str = "SELL"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from pydantic import BaseModel
2+
from typing import Optional
3+
4+
5+
# FastAPI Models
6+
class Chain(BaseModel):
7+
name: str
8+
contract_address: str
9+
# main_net: Optional[Chain]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pydantic import BaseModel
2+
from hygdraDexSim.dataclass.action import Action
3+
4+
5+
# FastAPI Models
6+
class Transaction(BaseModel):
7+
token_from: str
8+
token_to: str
9+
amount: float = 0
10+
action: Action
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pydantic import BaseModel
2+
from hygdraDexSim.dataclass.chain import Chain
3+
4+
5+
# FastAPI Models
6+
class Wallet(BaseModel):
7+
chain: Chain
8+
address: str
9+
pk : str
10+
amount: float = 0

app/DexSimulator/hygdraDexSim/wallet/generate.py

Whitespace-only changes.

0 commit comments

Comments
 (0)