Skip to content

Commit

Permalink
feat: hyperlane warp routes (#113)
Browse files Browse the repository at this point in the history
* renamed contracts dir

* upped cairo

* created all files req

* added workflow specific for token ext

* added function headers for contracts

* ci fix

* fixed other ci for dir renaming

* added scarb version to ci

* added headers for contracts in lib

* added alexandria dep

* + gas router comp

* pub modifier

* + router comp

* + utils for hook metadata

* fix rename

* + fast token router comp

* + token message trait

* token router comp

* added moduls

* added snforge

* renamed dir lib -> components

* HypErc20 init

* partial commit for hyp_erc721 comp

* set OZ tag to 0.14

* + hyp_erc721 + fixes

* fix on embedded components

* fix on naming

* initializer

* Naming correction

* fast_hyp_erc20 init

* fix added missing mailbox init

* fix added missing embedded impl

* + hyp_erc721_collateral + component

* + hyp_native + component

* fixes + (EnumerableMap + draft test)

* fmt

* HypErc20Collateral + Component

* FastHypErc20Collateral

* revert naming change to make test pass

* typo fix

* changed the function params

* fix on missing trait exposed

* + IMessageRecipient interface

* updated lib.cairo

* fix with workaround on token_router inheritance issue

* fix with workaround on token_router inheritance issue

* fixes for _handle

* fixes for recipient type

* extensions & simplifying the initializations

* fmt & typo fix

* fix test

* fmt

* implemented hooks for virtual functions

* + used hooks

* added hook to erc721_collateral

* fix typo

* added missing deps

* fix typo

* implemented hooks

* implemented hooks

* overrides draft

* switched to ERC721ABI trait

* renaming

* added hyp_erc721_URI extension

* added missing constructor logic

* added hyp_fiat token

* Revert "added hyp_fiat token"

This reverts commit b2be441.

* added hyp_native_scaled

* function overrides draft

* fmt

* IERC20Dispatcher to ERC20ABIDispatcher

* pub on struct

* partial tests setup before merge PR

* setup for hyp_erc20 tests

* mocks for tests

* added utils for erc20 tests

* setup for erc721 tests

* added utils for erc721 test

* Function overrides for `_handle` (#100)

* overrides for `_handle`

* fmt

* make test pass

* fmt&silence failing test template

* misc fixes for tests

* hyp_erc20 test + fixes

* tests for hyp_fiat + fixes

* mocks for xerc20 test

* ERC4626 extensions and override for `(TokenRouterComponent)._transfer_from` (#107)

* overrides for `_handle`

* fmt

* make test pass

* fmt&silence failing test template

* ERC4626 draft

* ERC4626 implementations

* getters

* vault collateral rebase func

* Fix initializer and embedded missing components

* comment for upgradeable impls

* remove outdated import

* merge 'hyperlane/feat-token-extensions' into 'feat-token-extensions'

* fix hyp_erc_721_setup

* fmt

* Removed TODOS for muldiv Round Down is default

* erc721 test deployment fix

* using self instead of ERC20MixinImpl

* u256 encode

* hyp_erc20_lockbox tests + fixes

* merge fixes

* hyp_xerc20_test (#108)

* overrides for `_handle`

* fmt

* make test pass

* fmt&silence failing test template

* ERC4626 draft

* ERC4626 implementations

* getters

* vault collateral rebase func

* Fix initializer and embedded missing components

* comment for upgradeable impls

* remove outdated import

* merge 'hyperlane/feat-token-extensions' into 'feat-token-extensions'

* fix hyp_erc_721_setup

* fmt

* Removed TODOS for muldiv Round Down is default

* erc721 test deployment fix

* using self instead of ERC20MixinImpl

* u256 encode

* hyp_xerc20_test

* xerc20 test

* removed unused import

* Auto stash before merge of "feat-token-extensions" and "origin/feat-token-extensions"

* test hyp_erc721 + fixes

* hyp_erc721_collateral test + fixes

* added ERC721Enumerable component and integrated in HypErc721

* integrated enumerable in hyp_erc721

* added erc721_uri_storage component

* Hyp_Erc20_Collateral_Vault_Deposit tests (#110)

* overrides for `_handle`

* fmt

* make test pass

* fmt&silence failing test template

* ERC4626 draft

* ERC4626 implementations

* getters

* vault collateral rebase func

* Fix initializer and embedded missing components

* comment for upgradeable impls

* remove outdated import

* merge 'hyperlane/feat-token-extensions' into 'feat-token-extensions'

* fix hyp_erc_721_setup

* fmt

* Removed TODOS for muldiv Round Down is default

* erc721 test deployment fix

* using self instead of ERC20MixinImpl

* u256 encode

* hyp_xerc20_test

* xerc20 test

* removed unused import

* ERC4626 Mocks

* hyp_erc20_collateral_vault_deposit_test

* fmt

* added docs

* hyp_erc20_collateral_test (#111)

* exposed token router impl

* added function signature to support collateral token functions

* collateral test

* formatted

---------

Co-authored-by: Sameer Kumar <[email protected]>

* refacto build.rs script

* fixed rust tests cairo artifacts path

* ci fix

* Feat: token erc721 uristorage (#109)

* Feat: initializer for ERC721 uri storage

* Feat: complete the basics of hyp_erc721_uri_storage

* Feat: Complete erc721 uri stirage

* resolve review

* integrate erc721 uri storage

* fix format and build check

* test erc721_uri_collateral + fixes

* restructured tests

* refacto into crates

* removed old /src

* refactored tests for new crates layout

* fmt

* ci fix

---------

Co-authored-by: Alex Metelli <[email protected]>
Co-authored-by: Turan Ege Caner <[email protected]>
Co-authored-by: Ege Caner <[email protected]>
Co-authored-by: Sameer Kumar <[email protected]>
Co-authored-by: Sameer Kumar <[email protected]>
Co-authored-by: Kayzee <[email protected]>
  • Loading branch information
7 people authored Sep 16, 2024
1 parent ff3d79b commit 0edbe20
Show file tree
Hide file tree
Showing 128 changed files with 10,924 additions and 340 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/label-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up GitHub CLI
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install GitHub CLI
run: |
npm install -g @actions/github-script
- name: Add label to PR
uses: actions/github-script@v7
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Build contracts
run: |
cd contracts && scarb build
cd cairo && scarb build
- name: Build the rust code
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
contracts:
runs-on: ubuntu-latest
env:
working-directory: ./contracts
working-directory: ./cairo
steps:
- uses: actions/checkout@v3

Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/token-ext.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Format and Build

on:
push:
branches:
- feat-token-extensions
pull_request:
branches:
- feat-token-extensions

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.6.5"
- run: cd cairo && scarb fmt --check
- run: cd cairo && scarb build
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
File renamed without changes.
2 changes: 2 additions & 0 deletions cairo/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scarb 2.6.5
starknet-foundry 0.22.0
48 changes: 39 additions & 9 deletions contracts/Scarb.lock → cairo/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = 1
[[package]]
name = "alexandria_bytes"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#b5c8356ce7d46a3665e08a8016d5abc02d9b0fe2"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
dependencies = [
"alexandria_data_structures",
"alexandria_math",
Expand All @@ -13,15 +13,15 @@ dependencies = [
[[package]]
name = "alexandria_data_structures"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#b5c8356ce7d46a3665e08a8016d5abc02d9b0fe2"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
dependencies = [
"alexandria_encoding",
]

[[package]]
name = "alexandria_encoding"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#b5c8356ce7d46a3665e08a8016d5abc02d9b0fe2"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
dependencies = [
"alexandria_bytes",
"alexandria_math",
Expand All @@ -31,15 +31,15 @@ dependencies = [
[[package]]
name = "alexandria_math"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#b5c8356ce7d46a3665e08a8016d5abc02d9b0fe2"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
dependencies = [
"alexandria_data_structures",
]

[[package]]
name = "alexandria_numeric"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#b5c8356ce7d46a3665e08a8016d5abc02d9b0fe2"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
dependencies = [
"alexandria_math",
"alexandria_searching",
Expand All @@ -48,26 +48,56 @@ dependencies = [
[[package]]
name = "alexandria_searching"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#b5c8356ce7d46a3665e08a8016d5abc02d9b0fe2"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
dependencies = [
"alexandria_data_structures",
]

[[package]]
name = "hyperlane_starknet"
name = "alexandria_storage"
version = "0.3.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70#bcdca70afdf59c9976148e95cebad5cf63d75a7f"

[[package]]
name = "contracts"
version = "0.0.6"
dependencies = [
"alexandria_bytes",
"alexandria_storage",
"mocks",
"openzeppelin",
"snforge_std",
]

[[package]]
name = "mocks"
version = "0.0.6"
dependencies = [
"alexandria_bytes",
"alexandria_storage",
"contracts",
"openzeppelin",
"token",
]

[[package]]
name = "openzeppelin"
version = "0.13.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git#978b4e75209da355667d8954d2450e32bd71fe49"
version = "0.14.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.14.0#f091c4f51ddeb10297db984acae965328c5a4e5b"

[[package]]
name = "snforge_std"
version = "0.22.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.22.0#9b215944c6c5871c738381b4ded61bbf06e7ba35"

[[package]]
name = "token"
version = "0.0.1"
dependencies = [
"alexandria_bytes",
"alexandria_storage",
"contracts",
"mocks",
"openzeppelin",
"snforge_std",
]
23 changes: 23 additions & 0 deletions cairo/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[workspace]
members = ["crates/*"]

[workspace.package]
name = "hyperlane_starknet"
description = "Implementation of the Hyperlane protocol on Starknet."
version = "0.0.6"
edition = "2023_11"
cairo-version = "2.6.3"
license-file = "../LICENSE"
readme = "../README.md"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[workspace.dependencies]
starknet = "2.6.3"
alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70" }
alexandria_storage = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.14.0" }


[workspace.tool.fmt]
sort-module-level-items = true
30 changes: 30 additions & 0 deletions cairo/crates/contracts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "contracts"
version = "0.0.6"
edition = "2023_11"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
starknet.workspace = true
alexandria_bytes.workspace = true
alexandria_storage.workspace = true
openzeppelin.workspace = true
mocks = {path = "../mocks"}

[dev-dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.22.0" }


[tool]
fmt.workspace = true

[[target.starknet-contract]]
allowed-libfuncs-list.name = "experimental"
sierra = true
casm = true
casm-add-pythonic-hints = true
build-external-contracts = ["mocks::*"]

[lib]
name = "contracts"
Loading

0 comments on commit 0edbe20

Please sign in to comment.