@volare.finance/volare.js
Version:
The SDK for Volare Protocol
86 lines • 3.62 kB
JavaScript
;
/**
* @file errors.ts
* @author astra <astra@volare.com>
* @date 2022
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.reason = exports.LIB_ACTIONS = exports.CONTROLLER = void 0;
// Controller Error Codes
exports.CONTROLLER = {
C1: 'sender is not full pauser',
C2: 'sender is not partial pauser',
C3: 'callee is not a whitelisted address',
C4: 'system is partially paused',
C5: 'system is fully paused',
C6: 'msg.sender is not authorized to run action',
C7: 'invalid addressbook address',
C8: 'invalid owner address',
C9: 'invalid input',
C10: 'fullPauser cannot be set to address zero',
C11: 'partialPauser cannot be set to address zero',
C12: 'can not run actions for different owners',
C13: 'can not run actions on different vaults',
C14: 'invalid final vault state',
C15: 'can not run actions on inexistent vault',
C16: 'cannot deposit long vToken from this address',
C17: 'vToken is not whitelisted to be used as collateral',
C18: 'vToken used as collateral is already expired',
C19: 'can not withdraw an expired vToken',
C20: 'cannot deposit collateral from this address',
C21: 'asset is not whitelisted to be used as collateral',
C22: 'can not withdraw collateral from a vault with an expired short vToken',
C23: 'vToken is not whitelisted to be minted',
C24: 'can not mint expired vToken',
C25: 'cannot burn from this address',
C26: 'can not burn expired vToken',
C27: 'vToken is not whitelisted to be redeemed',
C28: 'can not redeem un-expired vToken',
C29: 'asset prices not finalized yet',
C30: "can't settle vault with no vToken",
C31: 'can not settle vault with un-expired vToken',
C32: 'can not settle under collateralized vault',
C33: 'can not liquidate vault',
C34: 'can not leave less than collateral dust',
C35: 'invalid vault id',
C36: 'cap amount should be greater than zero',
C37: 'collateral exceed naked margin cap',
};
// LibActions Error Codes
exports.LIB_ACTIONS = {
A1: 'can only parse arguments for open vault actions',
A2: 'cannot open vault for an invalid account',
A3: 'cannot open vault with an invalid type',
A4: 'can only parse arguments for mint actions',
A5: 'cannot mint from an invalid account',
A6: 'can only parse arguments for burn actions',
A7: 'cannot burn from an invalid account',
A8: 'can only parse arguments for deposit actions',
A9: 'cannot deposit to an invalid account',
A10: 'can only parse arguments for withdraw actions',
A11: 'cannot withdraw from an invalid account',
A12: 'cannot withdraw to an invalid account',
A13: 'can only parse arguments for redeem actions',
A14: 'cannot redeem to an invalid account',
A15: 'can only parse arguments for settle vault actions',
A16: 'cannot settle vault for an invalid account',
A17: 'cannot withdraw payout to an invalid account',
A18: 'can only parse arguments for liquidate action',
A19: 'cannot liquidate vault for an invalid account owner',
A20: 'cannot send collateral to an invalid account',
A21: 'cannot parse liquidate action with no round id',
A22: 'can only parse arguments for call actions',
A23: 'target address cannot be address(0)',
};
function reason(tag) {
switch (tag[0]) {
case 'C':
return exports.CONTROLLER[tag];
case 'A':
return exports.LIB_ACTIONS[tag];
default:
return 'unknown error';
}
}
exports.reason = reason;
//# sourceMappingURL=errors.js.map