-
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 'init-overview-page' of github.com:thesis/acre into acre…
…-logo
- Loading branch information
Showing
13 changed files
with
530 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"extends": "thesis", | ||
"plugins": [], | ||
"rules": {} | ||
"plugins": [] | ||
} |
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 |
---|---|---|
@@ -1,9 +1,46 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity ^0.8.21; | ||
|
||
// Uncomment this line to use console.log | ||
// import "hardhat/console.sol"; | ||
import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol"; | ||
|
||
contract Acre { | ||
// TODO: add your implementation | ||
/// @title Acre | ||
/// @notice This contract implements the ERC-4626 tokenized vault standard. By | ||
/// staking tBTC, users acquire a liquid staking token called stBTC, | ||
/// commonly referred to as "shares". The staked tBTC is securely | ||
/// deposited into Acre's vaults, where it generates yield over time. | ||
/// Users have the flexibility to redeem stBTC, enabling them to | ||
/// withdraw their staked tBTC along with the accrued yield. | ||
/// @dev ERC-4626 is a standard to optimize and unify the technical parameters | ||
/// of yield-bearing vaults. This contract facilitates the minting and | ||
/// burning of shares (stBTC), which are represented as standard ERC20 | ||
/// tokens, providing a seamless exchange with tBTC tokens. | ||
contract Acre is ERC4626 { | ||
event StakeReferral(bytes32 indexed referral, uint256 assets); | ||
|
||
constructor( | ||
IERC20 tbtc | ||
) ERC4626(tbtc) ERC20("Acre Staked Bitcoin", "stBTC") {} | ||
|
||
/// @notice Stakes a given amount of tBTC token and mints shares to a | ||
/// receiver. | ||
/// @dev This function calls `deposit` function from `ERC4626` contract. The | ||
/// amount of the assets has to be pre-approved in the tBTC contract. | ||
/// @param assets Approved amount for the transfer and stake. | ||
/// @param receiver The address to which the shares will be minted. | ||
/// @param referral Data used for referral program. | ||
/// @return shares Minted shares. | ||
function stake( | ||
uint256 assets, | ||
address receiver, | ||
bytes32 referral | ||
) public returns (uint256) { | ||
// TODO: revisit the type of referral. | ||
uint256 shares = deposit(assets, receiver); | ||
|
||
if (referral != bytes32(0)) { | ||
emit StakeReferral(referral, assets); | ||
} | ||
|
||
return shares; | ||
} | ||
} |
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/ERC20.sol"; | ||
|
||
contract TestERC20 is ERC20 { | ||
constructor() ERC20("Test Token", "TEST") {} | ||
|
||
function mint(address account, uint256 value) external { | ||
_mint(account, value); | ||
} | ||
} |
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
Oops, something went wrong.