Skip to content

Commit

Permalink
new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
robertleifke committed May 15, 2024
1 parent dc2a4b2 commit 0dc073e
Show file tree
Hide file tree
Showing 291 changed files with 61,551 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- "@commitlint/config-conventional"
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig http://EditorConfig.org

# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.sol]
indent_size = 4

[*.tree]
indent_size = 1
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export PRIVATE_KEY="YOUR_PRIVATE_KEY"

export SEPOLIA_RPC_URL="YOUR_RPC_URL"

export ETHERSCAN_KEY="YOUR_ETHERSCAN_KEY"
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "CI"

env:
FOUNDRY_PROFILE: "ci"
RPC_URL_GOERLI: ${{ secrets.RPC_URL_SEPOLIA }}

on:
pull_request:
branches:
- "main"
push:
branches:
- "main"


jobs:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"
- uses: "foundry-rs/foundry-toolchain@v1"
with:
version: "nightly"
- run: pnpm install --frozen-lockfile
- run: pnpm lint:ci

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"
- uses: "foundry-rs/foundry-toolchain@v1"
with:
version: "nightly"
- run: pnpm install --frozen-lockfile
- run: pnpm build

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"
- uses: "foundry-rs/foundry-toolchain@v1"
with:
version: "nightly"
- run: pnpm install --frozen-lockfile
- run: pnpm test
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# directories
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
**/cache
**/node_modules
**/out

# files
*.env
*.log
.DS_Store
.pnp.*
yarn-debug.log*
yarn-error.log*

# broadcasts
!/broadcast
/broadcast/*
/broadcast/*/31337/
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = v1.4.0
[submodule "lib/create3-factory"]
path = lib/create3-factory
url = https://github.com/lifinance/create3-factory
2 changes: 2 additions & 0 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"*.{json,md,sol,yml}":
- prettier --write
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# directories
.yarn/
**/broadcast
**/cache
**/lib
**/out
**/node_modules

# files
*.env
*.log
.pnp.*
coverage.json
yarn-debug.log*
yarn-error.log*
7 changes: 7 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bracketSpacing: true
printWidth: 120
proseWrap: "always"
singleQuote: false
tabWidth: 2
trailingComma: "all"
useTabs: false
11 changes: 11 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "solhint:recommended",
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.5.0"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"not-rely-on-time": "off",
"reason-string": ["warn", { "maxLength": 64 }]
}
}
3 changes: 3 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# directories
**/lib
**/node_modules
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"esbenp.prettier-vscode"
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"solidity.formatter": "forge", // This is the default so it might be missing.
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
}
}
100 changes: 100 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Business Source License 1.1

License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
"Business Source License" is a trademark of MariaDB Corporation Ab.

-----------------------------------------------------------------------------

Parameters

Licensor: Dahlia Finance Inc. "Numoen"

Licensed Work: Numoen
The Licensed Work is (c) 2024 Dahlia Finance Inc.

Additional Use Grant: Any uses listed and defined at
license.numoen.com

Change Date: The earlier of 2028-01-01 or a date specified at
license.numoen.com

Change License: GNU General Public License v2.0 or later

-----------------------------------------------------------------------------

Terms

The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.

Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.

If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.

All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.

You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.

Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.

This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).

TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.

MariaDB hereby grants you permission to use this License’s text to license
your works, and to refer to it using the trademark "Business Source License",
as long as you comply with the Covenants of Licensor below.

-----------------------------------------------------------------------------

Covenants of Licensor

In consideration of the right to use this License’s text and the "Business
Source License" name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:

1. To specify as the Change License the GPL Version 2.0 or any later version,
or a license that is compatible with GPL Version 2.0 or a later version,
where "compatible" means that software provided under the Change License can
be included in a program with software provided under GPL Version 2.0 or a
later version. Licensor may specify additional Change Licenses without
limitation.

2. To either: (a) specify an additional grant of rights to use that does not
impose any additional restriction on the right granted in this License, as
the Additional Use Grant; or (b) insert the text "None".

3. To specify a Change Date.

4. Not to modify this License in any other way.

-----------------------------------------------------------------------------

Notice

The Business Source License (this document, or the "License") is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
# numo2
# ⚡ PowerMaker2

![banner](images/Banner.png)

Smart contracts suite of PowerMaker2, an automated market maker implementaion of the capped power-4 invariant for replicating power perpetuals raised to the fourth power on the EVM.

## Local development

This project uses [Foundry](https://github.com/foundry-rs/foundry) as the development framework.

### Dependencies

```bash
forge install
```

```bash
npm install @openzeppelin/contracts
```

```bash
npm install create3-factory
```

### Compilation

```bash
forge build
```

### Test

```bash
forge test
```

### Local setup

In order to test third party integrations such as interfaces, it is possible to set up a forked mainnet with several positions open

```bash
sh anvil.sh
```

then, in a separate terminal,

```bash
sh setup.sh
```
45 changes: 45 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Full reference https://github.com/foundry-rs/foundry/tree/master/config
[profile.default]
auto_detect_solc = false
bytecode_hash = "none"
fuzz = { runs = 256 }
gas_reports = ["*"]
libs = ["lib"]
optimizer = true
optimizer_runs = 10_000
out = "out"
solc = "0.8.17"
src = "src"
test = "test"

[profile.ci]
fuzz = { runs = 1_000 }
verbosity = 4

[fmt]
bracket_spacing = true
int_types = "long"
line_length = 120
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 2
variable_override_spacing = false
wrap_comments = true

[rpc_endpoints]
# mainnet = "${RPC_URL_MAINNET}"
# arbitrum = "${RPC_URL_ARBITRUM}"
# goerli = "${RPC_URL_GOERLI}"
# celo = "${RPC_URL_CELO}"
# polygon = "https://polygon-rpc.com"
sepolia = "${RPC_URL_SEPOLIA}"


[etherscan]
# ainnet = { key = "${ETHERSCAN_KEY", url = "https://api.etherscan.io/api" }
# arbitrum = { key = "${ARBISCAN_KEY}", url = "https://api.arbiscan.io/api" }
# goerli = { key = "${ETHERSCAN_KEY}", url = "https://api-goerli.etherscan.io/api" }
# celo = { key = "${CELOSCAN_KEY}", url = "https://api.celoscan.io/api" }
# polygon = { key = "${POLYGONSCAN_KEY}", url = "https://api.polygonscan.com/api" }m
sepolia = { key = "${ETHERSCAN_KEY", url = "https://api-sepolia.etherscan.io/api" }
Binary file added images/Banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0dc073e

Please sign in to comment.