Skip to content

Commit

Permalink
Merge pull request #8 from AstariaXYZ/feat/formatting
Browse files Browse the repository at this point in the history
updated gh action and formatted
  • Loading branch information
0xgregthedev authored Sep 16, 2023
2 parents 402dc07 + 00ef31f commit d8146e2
Show file tree
Hide file tree
Showing 48 changed files with 3,632 additions and 4,300 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env:
jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -19,7 +18,18 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18

- run: yarn

- uses: onbjerg/foundry-toolchain@v1
- run: forge test --ffi -vvv

- name: lint
run: forge fmt --check

- name: test
run: forge test --ffi -vvv

- name: snapshot
run: forge snapshot

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

forge fmt && git update-index --again
3 changes: 3 additions & 0 deletions .husky/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

forge fmt
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"dependencies": {
"@chainlink/contracts": "^0.6.1",
"chai": "^4.3.7",
"husky": "^8.0.3",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"prettier-plugin-solidity": "^1.1.3"
Expand Down
81 changes: 37 additions & 44 deletions src/CapitalPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,45 @@ pragma solidity ^0.8.17;

import {ERC20, ERC4626} from "solady/src/tokens/ERC4626.sol";
import {LoanManager} from "src/LoanManager.sol";
import {
ConduitControllerInterface
} from "seaport-sol/src/ConduitControllerInterface.sol";
import {ConduitControllerInterface} from "seaport-sol/src/ConduitControllerInterface.sol";

import "forge-std/console.sol";

contract CapitalPool is ERC4626 {
address immutable underlying;

bytes32 conduitKey;
address public immutable conduit;

constructor(
address underlying_,
ConduitControllerInterface cc_,
address originator_
) {
bytes32 ck = bytes32(uint256(uint160(address(address(this)))) << 96);
address c = cc_.createConduit(ck, address(this));
cc_.updateChannel(c, originator_, true);
ERC20(underlying_).approve(c, type(uint256).max);
conduit = c;
conduitKey = ck;
underlying = underlying_;
}

function asset() public view override returns (address) {
return underlying;
}

function name() public pure override returns (string memory) {
return "AstariaV1Pool";
}

function symbol() public pure override returns (string memory) {
return "AV1P";
}

function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) public pure returns (bytes4) {
LoanManager.Loan memory loan = abi.decode(data, (LoanManager.Loan));
//handle any logic here from when you receive a loan
return this.onERC721Received.selector;
}
address immutable underlying;

bytes32 conduitKey;
address public immutable conduit;

constructor(address underlying_, ConduitControllerInterface cc_, address originator_) {
bytes32 ck = bytes32(uint256(uint160(address(address(this)))) << 96);
address c = cc_.createConduit(ck, address(this));
cc_.updateChannel(c, originator_, true);
ERC20(underlying_).approve(c, type(uint256).max);
conduit = c;
conduitKey = ck;
underlying = underlying_;
}

function asset() public view override returns (address) {
return underlying;
}

function name() public pure override returns (string memory) {
return "AstariaV1Pool";
}

function symbol() public pure override returns (string memory) {
return "AV1P";
}

function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
public
pure
returns (bytes4)
{
LoanManager.Loan memory loan = abi.decode(data, (LoanManager.Loan));
//handle any logic here from when you receive a loan
return this.onERC721Received.selector;
}
}
Loading

0 comments on commit d8146e2

Please sign in to comment.