The system mints pegged assets (stablecoins) using an orderbook, using over-collateralized staked ETH.
Let's prioritize the core parts: orderbook functions (making orders: createX
), yield (updateYield
, distributeYield
), shortRecord functions (increaseCollateral
)
bidMatchAlgo
. bids are different because they match against both types of sell: ask/short)transferFrom
, mintNFT
since the rest is standard OZ)don't care about these or any view functions, can skip these.
[https://www.codehawks.com/report/cljx3b9390009liqwuedkn0m0]
Add a mainnet rpc url so you can run fork tests.
bun install
bun run interfaces
forge build
echo 'ANVIL_9_PRIVATE_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6' > .env && echo 'MAINNET_RPC_URL=XXXXX' >> .env
forge test
# Install Bun to run TS/JS
curl -fsSL https://bun.sh/install | bash
# if already installed
bun upgrade
# download files from package.json into node_modules
bun install
# Install foundry for solidity
curl -L https://foundry.paradigm.xyz | bash
foundryup
# init/update submodules for forge-std
git submodule update --init --recursive
# setup .env file
echo 'ANVIL_9_PRIVATE_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6' > .env && echo 'MAINNET_RPC_URL=XXXXX' >> .env
# disable next telemetry
npx next telemetry disable
# If needed, use volta to get node/npm, uses field in package.json
curl https://get.volta.sh | bash
volta install node
bun run
to check commands there's apre-push
git hook (bypass with--no-verify
) If you want to reset everything not tracked in git:git clean -xfd
bun run anvil
, then deploy with bun run deploy-local
bun run dev
(http://localhost:3000
)scripts
in package.json
bun run build
to compile contractsbun run interfaces
to re-compile solidity interfacesbun run test
, bun run test-gas
(forge test
)
-- --vv
for verbosity-- --watch
to watch files-- -m testX
to match testsbun run coverage
(first brew install lcov
)https://book.getfoundry.sh/forge/writing-tests.html#writing-tests For info on
v
, https://book.getfoundry.sh/forge/tests.html?highlight=vvvv#logs-and-traces
bun run build
bun run test
bun run test-gas
bun run coverage
## Aliases
```sh
alias i='bun run interfaces-force'
alias t="forge test "
alias tm="forge test --match-test "
alias ts="forge test --match-test statefulFuzz"
alias g="bun run test-gas"
alias gm="FOUNDRY_PROFILE=gas forge build && FOUNDRY_PROFILE=testgas forge test --match-test "
alias w='forge test -vv --watch '
t -m testA
gm testA
w -m testA
```
Rank | Username | |||||
1 | h hash | $9725.80 | 873 | 7 (0) | 2 (1) | 2 |
2 | C Cosine | $9197.42 | 349 | 3 (1) | 0 (0) | 4 |
3 | B Bernd | $3784.27 | 455 | 3 (0) | 4 (0) | 1 |
4 | T TheSchnilch | $3031.76 | 202 | 2 (0) | 0 (0) | 1 |
5 | E ElHaj | $2938.64 | 294 | 2 (0) | 2 (1) | 3 |
6 | 0 0xCiphky | $2752.02 | 280 | 2 (0) | 1 (1) | 5 |
7 | t t0x1c | $2668.85 | 279 | 2 (0) | 3 (1) | 5 |
8 | s serialcoder | $2281.22 | 324 | 2 (0) | 5 (0) | 3 |
9 | r rvierdiiev | $2206.02 | 348 | 3 (0) | 2 (0) | 0 |
10 | s shaka | $1874.65 | 345 | 3 (0) | 2 (0) | 2 |
11 | I Infect3d | $1333.10 | 163 | 1 (0) | 1 (0) | 1 |
12 | o oualidpro | $1136.51 | 200 | 2 (0) | 0 (0) | 0 |
13 | T T1MOH | $1079.78 | 204 | 1 (0) | 4 (0) | 7 |
14 | 0 | $1057.48 | 102 | 1 (0) | 0 (0) | 1 |
15 | 0 0xHelium | $939.13 | 48 | 0 (0) | 2 (0) | 0 |
16 | a alra | $893.90 | 239 | 2 (0) | 1 (0) | 5 |
17 | l lileth | $847.12 | 200 | 2 (0) | 0 (0) | 0 |
18 | Z ZedBlockchain | $612.47 | 40 | 0 (0) | 2 (0) | 0 |
19 | N Nyx | $485.57 | 104 | 1 (0) | 0 (0) | 2 |
20 | 0 0xbepresent | $470.44 | 43 | 0 (0) | 2 (0) | 1 |
21 | C CipherWizard | $392.35 | 40 | 0 (0) | 2 (0) | 0 |
22 | 0 0xffchain | $361.32 | 42 | 0 (0) | 2 (0) | 1 |
23 | S SovaSlava | $306.82 | 124 | 1 (0) | 1 (0) | 2 |
24 | B Bughunter101 | $306.24 | 20 | 0 (0) | 1 (0) | 0 |
25 | p ptsanev | $255.33 | 3 | 0 (0) | 0 (0) | 1 |
26 | D DarkTower | $255.33 | 3 | 0 (0) | 0 (0) | 1 |
27 | n nonseodion | $235.04 | 31 | 0 (0) | 1 (0) | 5 |
28 | t toshii | $217.86 | 103 | 1 (0) | 0 (0) | 1 |
29 | t talfao | $198.74 | 105 | 1 (0) | 0 (0) | 2 |
30 | P | $182.38 | 2 | 0 (0) | 0 (0) | 1 |
31 | 0 0xmuxyz | $171.30 | 42 | 0 (0) | 2 (0) | 1 |
32 | K | $148.83 | 20 | 0 (0) | 1 (0) | 0 |
33 | S SAAJ | $148.83 | 20 | 0 (0) | 1 (0) | 0 |
34 | G GREYHAWKREACH | $114.90 | 3 | 0 (0) | 0 (0) | 1 |
35 | f flacko | $102.96 | 100 | 1 (0) | 0 (0) | 0 |
36 | 0 0xch | $86.89 | 5 | 0 (0) | 0 (0) | 2 |
37 | P PTolev | $86.11 | 20 | 0 (0) | 1 (0) | 0 |
38 | N Norah | $86.11 | 20 | 0 (0) | 1 (0) | 0 |
39 | R Rozzo | $82.07 | 2 | 0 (0) | 0 (0) | 1 |
40 | u ubermensch | $82.07 | 2 | 0 (0) | 0 (0) | 1 |
41 | k ke1caM | $76.01 | 5 | 0 (0) | 0 (0) | 2 |
42 | n nican0r | $69.19 | 22 | 0 (0) | 1 (0) | 1 |
43 | c caventa | $68.94 | 3 | 0 (0) | 0 (0) | 1 |
44 | 0 0xepley | $62.95 | 6 | 0 (0) | 0 (0) | 3 |
45 | h happyformerlawyer | $55.02 | 4 | 0 (0) | 0 (0) | 2 |
46 | A Auditism | $49.24 | 2 | 0 (0) | 0 (0) | 1 |
47 | I | $49.24 | 2 | 0 (0) | 0 (0) | 1 |
48 | 0 0xMohan732 | $49.24 | 2 | 0 (0) | 0 (0) | 1 |
49 | L Lalanda | $48.80 | 24 | 0 (0) | 1 (0) | 2 |
50 | b bitsurfer | $48.40 | 7 | 0 (0) | 0 (0) | 3 |
51 | F FalconHoof | $46.53 | 3 | 0 (0) | 0 (0) | 1 |
52 | B Bauer | $43.02 | 22 | 0 (0) | 1 (0) | 1 |
53 | c chainNue | $41.73 | 22 | 0 (0) | 1 (0) | 1 |
54 | I | $39.02 | 4 | 0 (0) | 0 (0) | 2 |
55 | n nisedo | $39.02 | 4 | 0 (0) | 0 (0) | 2 |
56 | d dipp | $33.24 | 2 | 0 (0) | 0 (0) | 1 |
57 | B | $33.24 | 2 | 0 (0) | 0 (0) | 1 |
58 | 0 | $33.24 | 2 | 0 (0) | 0 (0) | 1 |
59 | M MaslarovK | $33.24 | 2 | 0 (0) | 0 (0) | 1 |
60 | N Niki | $33.24 | 2 | 0 (0) | 0 (0) | 1 |
61 | M MrjoryStewartBa... | $25.13 | 3 | 0 (0) | 0 (0) | 1 |
62 | 0 0xTiwa | $23.93 | 2 | 0 (0) | 0 (0) | 1 |
63 | t tychaios | $17.95 | 2 | 0 (0) | 0 (0) | 1 |
64 | 0 0xlemon | $17.95 | 2 | 0 (0) | 0 (0) | 1 |
65 | M Madalad | $17.95 | 2 | 0 (0) | 0 (0) | 1 |
66 | N NoodleDonn212 | $7.07 | 2 | 0 (0) | 0 (0) | 1 |
67 | m mahdiRostami | $7.07 | 2 | 0 (0) | 0 (0) | 1 |
68 | h hunterw3b | $5.78 | 2 | 0 (0) | 0 (0) | 1 |
69 | 8 836541 | $5.78 | 2 | 0 (0) | 0 (0) | 1 |
70 | 0 0xanmol | $5.78 | 2 | 0 (0) | 0 (0) | 1 |
71 | m mylifechangefast | $0.00 | 6 | 0 (0) | 0 (0) | 0 |
72 | O | $0.00 | 3 | 0 (0) | 0 (0) | 0 |
73 | 0 | $0.00 | 3 | 0 (0) | 0 (0) | 0 |
74 | G Gelato | $0.00 | 3 | 0 (0) | 0 (0) | 0 |
75 | n nabeel | $0.00 | 6 | 0 (0) | 0 (0) | 0 |
76 | K Kose | $0.00 | 3 | 0 (0) | 0 (0) | 0 |
77 | d dimulski | $0.00 | 3 | 0 (0) | 0 (0) | 0 |
78 | a aslanbek | $0.00 | 3 | 0 (0) | 0 (0) | 0 |
79 | 0 0xraion | $0.00 | 3 | 0 (0) | 0 (0) | 0 |
80 | h habib0x | $0.00 | 3 | 0 (0) | 0 (0) | 0 |