-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:thesis/acre into stake-form
- Loading branch information
Showing
25 changed files
with
816 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ build/ | |
cache/ | ||
export.json | ||
export/ | ||
gen/ | ||
typechain/ |
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,37 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity ^0.8.21; | ||
|
||
import "@openzeppelin/contracts/interfaces/IERC4626.sol"; | ||
|
||
/// @title Router | ||
/// @notice Router is a contract that routes tBTC from stBTC (Acre) to | ||
/// a given vault and back. Vaults supply yield strategies with tBTC that | ||
/// generate yield for Bitcoin holders. | ||
abstract contract Router { | ||
/// Thrown when amount of shares received is below the min set by caller. | ||
/// @param vault Address of the vault. | ||
/// @param sharesOut Amount of shares received by Acre. | ||
/// @param minSharesOut Minimum amount of shares expected to receive. | ||
error MinSharesError( | ||
address vault, | ||
uint256 sharesOut, | ||
uint256 minSharesOut | ||
); | ||
|
||
/// @notice Routes funds from stBTC (Acre) to a vault. The amount of tBTC to | ||
/// Shares of deposited tBTC are minted to the stBTC contract. | ||
/// @param vault Address of the vault to route the funds to. | ||
/// @param receiver Address of the receiver of the shares. | ||
/// @param amount Amount of tBTC to deposit. | ||
/// @param minSharesOut Minimum amount of shares to receive. | ||
function deposit( | ||
IERC4626 vault, | ||
address receiver, | ||
uint256 amount, | ||
uint256 minSharesOut | ||
) internal returns (uint256 sharesOut) { | ||
if ((sharesOut = vault.deposit(amount, receiver)) < minSharesOut) { | ||
revert MinSharesError(address(vault), sharesOut, minSharesOut); | ||
} | ||
} | ||
} |
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,12 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity ^0.8.21; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol"; | ||
|
||
contract TestERC4626 is ERC4626 { | ||
constructor( | ||
IERC20 asset, | ||
string memory tokenName, | ||
string memory tokenSymbol | ||
) ERC4626(asset) ERC20(tokenName, tokenSymbol) {} | ||
} |
Oops, something went wrong.