Skip to content

Commit

Permalink
Merge branch 'treasury' of https://github.com/CanzaApps/Baki-contracts
Browse files Browse the repository at this point in the history
…into treasury
  • Loading branch information
David405 committed Apr 8, 2024
2 parents 2b6e163 + d8a7cdf commit b4d66f8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions contracts/Treasury.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ contract Treasury is ITreasury, AccessControl, ReentrancyGuard {
address indexed _token,
uint256 _amount
);
event UnauthorizedAccess(address indexed _user, bool status);

bytes32 public constant VAULT_ROLE = keccak256("VAULT_ROLE");

Expand Down Expand Up @@ -62,8 +61,13 @@ contract Treasury is ITreasury, AccessControl, ReentrancyGuard {
string memory _asset
) external isPaused nonReentrant {
require(hasRole(VAULT_ROLE, msg.sender), " Not vault");

bool transferSuccess = IERC20(currencies[_asset]).transfer(
require(
IERC20(currencies[_asset]).balanceOf(address(this)) >= _amount,
"Insufficient balance"
);
IERC20(currencies[_asset]).approve(address(this), _amount);
bool transferSuccess = IERC20(currencies[_asset]).transferFrom(
address(this),
_to,
_amount
);
Expand Down

0 comments on commit b4d66f8

Please sign in to comment.