Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/token-vault' into deploy-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuba committed Dec 5, 2023
2 parents 7530c3d + 05fb49d commit 62d293f
Show file tree
Hide file tree
Showing 18 changed files with 517 additions and 128 deletions.
5 changes: 1 addition & 4 deletions core/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "thesis",
"plugins": [],
"rules": {
"func-visibility": ["off", { "ignoreConstructors": true }]
}
"plugins": []
}
18 changes: 13 additions & 5 deletions core/contracts/Acre.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ pragma solidity ^0.8.21;

import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";

/// @title Acre
/// @notice Implementation of the ERR-4626 tokenized vault standard. ERC-4626 is
/// a standard to optimize and unify the technical parameters of
/// yield-bearing vaults. This contract allows the minting and burning
/// of shares, represented as standard ERC20 token, in exchange for tBTC
/// tokens.
/// @dev ERC-4626 standard extends the ERC-20 token.
contract Acre is ERC4626 {
event Staked(bytes32 indexed referral, uint256 assets, uint256 shares);

constructor(
IERC20 _token
) ERC4626(_token) ERC20("Acre Staked Bitcoin", "stBTC") {}
IERC20 tbtc
) ERC4626(tbtc) ERC20("Acre Staked Bitcoin", "stBTC") {}

/// @notice Stakes a given amount of underlying token and mints shares to a
/// @notice Stakes a given amount of tBTC token and mints shares to a
/// receiver.
/// @dev This function calls `deposit` function from `ERC4626` contract.
/// @param assets Approved amount for the transfer and stake.
Expand All @@ -21,8 +28,9 @@ contract Acre is ERC4626 {
uint256 assets,
address receiver,
bytes32 referral
) public returns (uint256 shares) {
shares = deposit(assets, receiver);
) public returns (uint256) {
// TODO: revisit the type of referral.
uint256 shares = deposit(assets, receiver);

emit Staked(referral, assets, shares);

Expand Down
21 changes: 1 addition & 20 deletions core/contracts/test/TestToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,11 @@
pragma solidity ^0.8.21;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@thesis/solidity-contracts/contracts/token/IApproveAndCall.sol";
import "@thesis/solidity-contracts/contracts/token/IReceiveApproval.sol";

contract TestToken is ERC20, IApproveAndCall {
contract TestERC20 is ERC20 {
constructor() ERC20("Test Token", "TEST") {}

function mint(address account, uint256 value) external {
_mint(account, value);
}

function approveAndCall(
address spender,
uint256 amount,
bytes memory extraData
) external returns (bool) {
if (approve(spender, amount)) {
IReceiveApproval(spender).receiveApproval(
msg.sender,
amount,
address(this),
extraData
);
return true;
}
return false;
}
}
3 changes: 1 addition & 2 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"typescript": "^5.3.2"
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.0",
"@thesis/solidity-contracts": "github:thesis/solidity-contracts#c315b9d"
"@openzeppelin/contracts": "^5.0.0"
}
}
Loading

0 comments on commit 62d293f

Please sign in to comment.