mirror of https://github.com/logos-co/staking.git
chore(StakeManager): change revert to use custom error
This commit is contained in:
parent
4f590049d4
commit
c764142909
|
@ -20,6 +20,7 @@ contract StakeManager is Ownable {
|
||||||
error StakeManager__AccountNotInitialized();
|
error StakeManager__AccountNotInitialized();
|
||||||
error StakeManager__InvalidMigration();
|
error StakeManager__InvalidMigration();
|
||||||
error StakeManager__AlreadyProcessedEpochs();
|
error StakeManager__AlreadyProcessedEpochs();
|
||||||
|
error StakeManager__InsufficientFunds();
|
||||||
|
|
||||||
struct Account {
|
struct Account {
|
||||||
address rewardAddress;
|
address rewardAddress;
|
||||||
|
@ -158,7 +159,7 @@ contract StakeManager is Ownable {
|
||||||
function unstake(uint256 _amount) external onlyVault onlyInitialized(msg.sender) noMigration processEpoch {
|
function unstake(uint256 _amount) external onlyVault onlyInitialized(msg.sender) noMigration processEpoch {
|
||||||
Account storage account = accounts[msg.sender];
|
Account storage account = accounts[msg.sender];
|
||||||
if (_amount > account.balance) {
|
if (_amount > account.balance) {
|
||||||
revert("StakeManager: Amount exceeds balance");
|
revert StakeManager__InsufficientFunds();
|
||||||
}
|
}
|
||||||
if (account.lockUntil > block.timestamp) {
|
if (account.lockUntil > block.timestamp) {
|
||||||
revert StakeManager__FundsLocked();
|
revert StakeManager__FundsLocked();
|
||||||
|
|
Loading…
Reference in New Issue