102 lines
2.9 KiB
Solidity
Raw Permalink Normal View History

2025-01-13 12:04:03 +01:00
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import "./vault/VaultBase.sol";
2025-01-13 12:04:03 +01:00
2025-01-22 11:32:22 +01:00
contract Vault is VaultBase {
// solhint-disable-next-line no-empty-blocks
constructor(IERC20 token) VaultBase(token) {}
2025-01-13 12:04:03 +01:00
function getBalance(
2025-02-04 09:53:31 +01:00
Fund fund,
Recipient recipient
) public view returns (uint128) {
Controller controller = Controller.wrap(msg.sender);
Balance memory balance = _getBalance(controller, fund, recipient);
return balance.available + balance.designated;
}
function getDesignatedBalance(
2025-02-04 09:53:31 +01:00
Fund fund,
Recipient recipient
) public view returns (uint128) {
Controller controller = Controller.wrap(msg.sender);
Balance memory balance = _getBalance(controller, fund, recipient);
return balance.designated;
2025-01-13 12:04:03 +01:00
}
function getLockStatus(Fund fund) public view returns (LockStatus) {
Controller controller = Controller.wrap(msg.sender);
return _getLockStatus(controller, fund);
}
function getLockExpiry(Fund fund) public view returns (Timestamp) {
Controller controller = Controller.wrap(msg.sender);
return _getLockExpiry(controller, fund);
}
2025-02-04 09:53:31 +01:00
function lock(Fund fund, Timestamp expiry, Timestamp maximum) public {
Controller controller = Controller.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_lock(controller, fund, expiry, maximum);
2025-01-13 12:04:03 +01:00
}
2025-02-04 09:53:31 +01:00
function extendLock(Fund fund, Timestamp expiry) public {
Controller controller = Controller.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_extendLock(controller, fund, expiry);
}
function deposit(Fund fund, Recipient recipient, uint128 amount) public {
Controller controller = Controller.wrap(msg.sender);
_deposit(controller, fund, recipient, amount);
2025-01-13 12:04:03 +01:00
}
2025-01-14 14:11:53 +01:00
function designate(
2025-02-04 09:53:31 +01:00
Fund fund,
Recipient recipient,
uint128 amount
) public {
2025-01-22 11:32:22 +01:00
Controller controller = Controller.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_designate(controller, fund, recipient, amount);
2025-01-14 14:11:53 +01:00
}
function transfer(
2025-02-04 09:53:31 +01:00
Fund fund,
Recipient from,
Recipient to,
uint128 amount
) public {
Controller controller = Controller.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_transfer(controller, fund, from, to, amount);
}
function flow(
2025-02-04 09:53:31 +01:00
Fund fund,
Recipient from,
Recipient to,
TokensPerSecond rate
) public {
Controller controller = Controller.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_flow(controller, fund, from, to, rate);
}
2025-02-04 09:53:31 +01:00
function burn(Fund fund, Recipient recipient) public {
Controller controller = Controller.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_burn(controller, fund, recipient);
}
2025-02-06 10:58:21 +01:00
function burnAll(Fund fund) public {
Controller controller = Controller.wrap(msg.sender);
_burnAll(controller, fund);
}
2025-02-04 09:53:31 +01:00
function withdraw(Fund fund, Recipient recipient) public {
Controller controller = Controller.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_withdraw(controller, fund, recipient);
}
2025-02-04 09:53:31 +01:00
function withdrawByRecipient(Controller controller, Fund fund) public {
Recipient recipient = Recipient.wrap(msg.sender);
2025-02-04 09:53:31 +01:00
_withdraw(controller, fund, recipient);
}
2025-01-13 12:04:03 +01:00
}