92 lines
2.6 KiB
Solidity
Raw 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(
Context context,
Recipient recipient
) public view returns (uint128) {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 15:58:34 +01:00
Balance memory b = _getBalance(controller, context, recipient);
return b.available + b.designated;
}
function getDesignatedBalance(
Context context,
Recipient recipient
) public view returns (uint128) {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 15:58:34 +01:00
Balance memory b = _getBalance(controller, context, recipient);
return b.designated;
2025-01-13 12:04:03 +01:00
}
function getLock(Context context) public view returns (Lock memory) {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 11:32:22 +01:00
return _getLock(controller, context);
}
function deposit(Context context, address from, uint128 amount) public {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 11:32:22 +01:00
_deposit(controller, context, from, amount);
2025-01-13 12:04:03 +01:00
}
2025-01-22 11:32:22 +01:00
function withdraw(Context context, Recipient recipient) public {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 11:32:22 +01:00
_withdraw(controller, context, recipient);
}
2025-01-22 11:32:22 +01:00
function withdrawByRecipient(Controller controller, Context context) public {
Recipient recipient = Recipient.wrap(msg.sender);
_withdraw(controller, context, recipient);
2025-01-13 12:04:03 +01:00
}
2025-01-14 14:11:53 +01:00
function burn(Context context, Recipient recipient) public {
2025-01-22 11:32:22 +01:00
Controller controller = Controller.wrap(msg.sender);
_burn(controller, context, recipient);
2025-01-14 14:11:53 +01:00
}
function transfer(
Context context,
Recipient from,
Recipient to,
uint128 amount
) public {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 11:32:22 +01:00
_transfer(controller, context, from, to, amount);
}
function designate(
Context context,
Recipient recipient,
uint128 amount
) public {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 11:32:22 +01:00
_designate(controller, context, recipient, amount);
}
function lock(Context context, Timestamp expiry, Timestamp maximum) public {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 11:32:22 +01:00
_lockup(controller, context, expiry, maximum);
}
function extendLock(Context context, Timestamp expiry) public {
Controller controller = Controller.wrap(msg.sender);
2025-01-22 11:32:22 +01:00
_extendLock(controller, context, expiry);
}
function flow(
Context context,
Recipient from,
Recipient to,
TokensPerSecond rate
) public {
Controller controller = Controller.wrap(msg.sender);
_flow(controller, context, from, to, rate);
}
2025-01-13 12:04:03 +01:00
}