Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
0xgregthedev committed Sep 16, 2023
1 parent 03f1fff commit 00ef31f
Show file tree
Hide file tree
Showing 29 changed files with 1,787 additions and 2,180 deletions.
24 changes: 7 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,12 @@ jobs:

- uses: onbjerg/foundry-toolchain@v1

- run: forge test --ffi -vvv
- name: lint
run: forge fmt --check

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

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

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

- run: yarn

- uses: onbjerg/foundry-toolchain@v1
- name: snapshot
run: forge snapshot

- run: forge fmt --check
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 00ef31f

Please sign in to comment.