generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: banteg <4562643+banteg@users.noreply.github.com>
- Loading branch information
Showing
18 changed files
with
1,129 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# NOTE: We don't need this other than for copying over the manifests to build with the | ||
# python package, and for testing | ||
|
||
plugins: | ||
# For compiling contracts | ||
- name: solidity | ||
# For fork testing | ||
- name: foundry | ||
|
||
dependencies: | ||
- name: uniswap-v3 | ||
github: Uniswap/v3-core | ||
ref: v1.0.0 | ||
|
||
- name: uniswap-v2 | ||
github: Uniswap/v2-core | ||
ref: v1.0.1 | ||
|
||
- name: permit2 | ||
github: Uniswap/permit2 | ||
ref: main | ||
config_override: | ||
solidity: | ||
via_ir: True # NOTE: Trouble compiling without this | ||
|
||
- name: universal-router | ||
github: Uniswap/universal-router | ||
ref: v1.6.0 | ||
config_override: | ||
dependencies: | ||
- name: openzeppelin | ||
github: OpenZeppelin/openzeppelin-contracts | ||
ref: v4.7.0 | ||
solidity: | ||
import_remapping: | ||
- "permit2=permit2" | ||
- "@uniswap/v3-core=uniswap-v3" | ||
- "@uniswap/v2-core=uniswap-v2" | ||
via_ir: True # NOTE: Trouble compiling without this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from pathlib import Path | ||
|
||
from ape import project | ||
from ethpm_types import ContractType | ||
|
||
PACKAGE_FOLDER = Path(__file__).parent.parent / "uniswap_sdk" | ||
|
||
|
||
def clean_contract_type(contract_type): | ||
clean_model_dict = contract_type.model_dump( | ||
exclude={ | ||
"ast", | ||
"deployment_bytecode", | ||
"runtime_bytecode", | ||
"source_id", | ||
"pcmap", | ||
"dev_messages", | ||
"sourcemap", | ||
"userdoc", | ||
"devdoc", | ||
"method_identifiers", | ||
} | ||
) | ||
return ContractType.model_validate(clean_model_dict) | ||
|
||
|
||
def clean_manifest(manifest, *contract_types_to_keep): | ||
manifest.contract_types = { | ||
k: clean_contract_type(v) | ||
for k, v in manifest.contract_types.items() | ||
if k in contract_types_to_keep | ||
} | ||
return manifest.model_dump_json( | ||
exclude={ | ||
"meta", | ||
"dependencies", | ||
"sources", | ||
"compilers", | ||
} | ||
) | ||
|
||
|
||
def main(): | ||
manifest_json = clean_manifest( | ||
project.dependencies["uniswap-v2"]["v1.0.1"].extract_manifest(), | ||
"UniswapV2Factory", | ||
"UniswapV2Pair", | ||
) | ||
(PACKAGE_FOLDER / "v2-manifest.json").write_text(manifest_json) | ||
|
||
manifest_json = clean_manifest( | ||
project.dependencies["uniswap-v3"]["v1.0.0"].extract_manifest(), | ||
"UniswapV3Factory", | ||
"UniswapV3Pool", | ||
) | ||
(PACKAGE_FOLDER / "v3-manifest.json").write_text(manifest_json) | ||
|
||
manifest_json = clean_manifest( | ||
project.dependencies["permit2"]["main"].extract_manifest(), | ||
"Permit2", | ||
) | ||
(PACKAGE_FOLDER / "permit2-manifest.json").write_text(manifest_json) | ||
|
||
manifest_json = clean_manifest( | ||
project.dependencies["universal-router"]["v1.6.0"].extract_manifest(), | ||
"UniversalRouter", | ||
) | ||
(PACKAGE_FOLDER / "unirouter-manifest.json").write_text(manifest_json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.