Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sdk #463

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .github/actions/build-hardhat/action.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ runs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
run: yarn install --frozen-lockfile
shell: bash
8 changes: 4 additions & 4 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Build contracts via IR & check sizes
# don't use compilation cache
# skip import files, because we don't care if contracts are too big
run: yarn build:forge --force --sizes --skip Import
run: yarn build --force --sizes --skip Import


build-no-ir:
Expand All @@ -58,7 +58,7 @@ jobs:
- uses: ./.github/actions/install-cache

- name: Build contracts without IR
run: yarn build:forge
run: yarn build
env:
FOUNDRY_PROFILE: test

Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
- uses: ./.github/actions/install-cache

- name: Run local tests on chain ${{ matrix.chain }} in ${{ matrix.type }} mode
run: yarn test:forge:local
run: yarn test:local
env:
FOUNDRY_FUZZ_RUNS: ${{ matrix.fuzz-runs }}
FOUNDRY_FUZZ_MAX_TEST_REJECTS: ${{ matrix.max-test-rejects }}
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
- uses: ./.github/actions/install-cache

- name: Run fork tests on chain ${{ matrix.chain }} in ${{ matrix.type }} mode
run: yarn test:forge:fork --chain ${{ matrix.chain }}
run: yarn test:fork --chain ${{ matrix.chain }}
env:
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
FOUNDRY_FUZZ_RUNS: ${{ matrix.fuzz-runs }}
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/hardhat.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/npm-release.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Compiler files
cache/
out/
dist/

# Ignores development broadcast logs
!/broadcast
Expand All @@ -21,14 +20,6 @@ docs/
data/
broadcast/

# Node.js
node_modules/

# Hardhat
/types
/cache_hardhat
/artifacts

*.log

# Certora
Expand Down
5 changes: 0 additions & 5 deletions .husky/post-checkout
MathisGD marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/post-merge

This file was deleted.

2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
yarn lint
4 changes: 0 additions & 4 deletions .husky/prepare-commit-msg

This file was deleted.

133 changes: 6 additions & 127 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,137 +12,11 @@ Some chain-specific domains are also scoped to the chain-specific folder, becaus

User-end bundlers are provided in each chain-specific folder, instantiating all the intermediary domain-specific bundlers and associated parameters (such as chain-specific protocol addresses, e.g. [`EthereumBundlerV2`](./src/ethereum/EthereumBundlerV2.sol)).

## Deployments

- [EthereumBundler](https://github.com/morpho-org/morpho-blue-bundlers/releases/tag/v1.0.0)
- [EthereumBundlerV2](https://github.com/morpho-org/morpho-blue-bundlers/releases/tag/v1.2.0)
- (TODO) AgnosticBundlerV2 on Base
MathisGD marked this conversation as resolved.
Show resolved Hide resolved

## Getting Started

### Package installation

```bash
npm install @morpho-org/morpho-blue-bundlers
```

```bash
yarn add @morpho-org/morpho-blue-bundlers
```

### Usage

Bundle a collateral supply and a borrow:

```typescript
import { BundlerAction } from "@morpho-org/morpho-blue-bundlers";

const collateral = 1_000000000000000000n;
const borrowedAssets = 1000_000000n;

const borrower = "0x...";
const marketParams = {
collateralToken: "0x...",
loanToken: "0x...",
irm: "0x...",
oracle: "0x...",
lltv: 86_0000000000000000n,
};

await bundler
.connect(supplier)
.multicall([
BundlerAction.transferFrom(marketParams.collateralToken, collateral),
BundlerAction.morphoSupplyCollateral(marketParams, collateral, borrower, "0x"),
BundlerAction.morphoBorrow(marketParams, borrowedAssets, 0n, borrower, borrower),
]);
```

Bundle a permit2 signature approval and a ERC-4626 deposit:

```typescript
import { Signature } from "ethers";

import { BundlerAction } from "@morpho-org/morpho-blue-bundlers";

const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3";

const permit2Config = {
domain: {
name: "Permit2",
chainId: "0x1",
verifyingContract: permit2Address,
},
types: {
PermitSingle: [
{
name: "details",
type: "PermitDetails",
},
{
name: "spender",
type: "address",
},
{
name: "sigDeadline",
type: "uint256",
},
],
PermitDetails: [
{
name: "token",
type: "address",
},
{
name: "amount",
type: "uint160",
},
{
name: "expiration",
type: "uint48",
},
{
name: "nonce",
type: "uint48",
},
],
},
};

const assetAddress = "0x...";
const assets = 1000_000000n;

const supplier = "0x...";
const bundlerAddress = "0x...";
const permitSingle = {
details: {
token: assetAddress,
amount: assets,
nonce: 0n,
expiration: 2n ** 48n - 1,
},
spender: bundlerAddress,
sigDeadline: 2n ** 48n - 1,
};

await bundler
.connect(supplier)
.multicall([
BundlerAction.approve2(
permitSingle,
Signature.from(await supplier.signTypedData(permit2Config.domain, permit2Config.types, permitSingle)),
false,
),
BundlerAction.transferFrom2(assetAddress, assets),
BundlerAction.erc4626Deposit(erc4626Address, assets, 0, supplier),
]);
```

## Development

Install dependencies with `yarn`.

Run tests with `yarn test:forge --chain <chainid>` (chainid can be 1 or 8453).
Run tests with `yarn test --chain <chainid>` (chainid can be 1 or 8453).

Note that the `EthereumBundlerV2` has been deployed with 80 000 optimizer runs.
To compile contracts with the same configuration, run `FOUNDRY_PROFILE=ethereumBundlerV2 forge b`.
Expand All @@ -154,3 +28,8 @@ All audits are stored in the [audits](./audits/)' folder.
## License

Bundlers are licensed under `GPL-2.0-or-later`, see [`LICENSE`](./LICENSE).

## Links

- [Deployments](https://docs.morpho.org/bundlers/addresses/#bundlers)
- [SDK](https://github.com/morpho-org/sdks/tree/main/packages/bundler-sdk-ethers)
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
names = true
sizes = true
src = "src"
MathisGD marked this conversation as resolved.
Show resolved Hide resolved
MathisGD marked this conversation as resolved.
Show resolved Hide resolved
test = "test/forge"
test = "test"
MathisGD marked this conversation as resolved.
Show resolved Hide resolved
fs_permissions = [
{ access = "read", path = "./out/"},
{ access = "read", path = "./config/"}
Expand Down
Loading
Loading