|
| 1 | +import { parseAbi } from 'viem' |
| 2 | + |
| 3 | +/** |
| 4 | + * BorrowerOperations ABI for Bold protocol trove operations |
| 5 | + * |
| 6 | + * Note: `as any` is used because viem's parseAbi returns a complex readonly tuple type |
| 7 | + * that can cause type verbosity. This doesn't compromise type safety - viem's |
| 8 | + * readContract/writeContract still infer types correctly from the ABI at usage sites. |
| 9 | + */ |
| 10 | +export const BORROWER_OPERATIONS_ABI = parseAbi([ |
| 11 | + // Core trove operations |
| 12 | + 'function openTrove(address _owner, uint256 _ownerIndex, uint256 _ETHAmount, uint256 _boldAmount, uint256 _upperHint, uint256 _lowerHint, uint256 _annualInterestRate, uint256 _maxUpfrontFee, address _addManager, address _removeManager, address _receiver) returns (uint256)', |
| 13 | + 'function openTroveAndJoinInterestBatchManager((address owner, uint256 ownerIndex, uint256 collAmount, uint256 boldAmount, uint256 upperHint, uint256 lowerHint, address interestBatchManager, uint256 maxUpfrontFee, address addManager, address removeManager, address receiver) _params) returns (uint256)', |
| 14 | + 'function addColl(uint256 _troveId, uint256 _ETHAmount)', |
| 15 | + 'function withdrawColl(uint256 _troveId, uint256 _amount)', |
| 16 | + 'function withdrawBold(uint256 _troveId, uint256 _amount, uint256 _maxUpfrontFee)', |
| 17 | + 'function repayBold(uint256 _troveId, uint256 _amount)', |
| 18 | + 'function closeTrove(uint256 _troveId)', |
| 19 | + 'function adjustTrove(uint256 _troveId, uint256 _collChange, bool _isCollIncrease, uint256 _debtChange, bool isDebtIncrease, uint256 _maxUpfrontFee)', |
| 20 | + 'function adjustZombieTrove(uint256 _troveId, uint256 _collChange, bool _isCollIncrease, uint256 _boldChange, bool _isDebtIncrease, uint256 _upperHint, uint256 _lowerHint, uint256 _maxUpfrontFee)', |
| 21 | + 'function adjustTroveInterestRate(uint256 _troveId, uint256 _newAnnualInterestRate, uint256 _upperHint, uint256 _lowerHint, uint256 _maxUpfrontFee)', |
| 22 | + 'function applyPendingDebt(uint256 _troveId, uint256 _lowerHint, uint256 _upperHint)', |
| 23 | + 'function claimCollateral()', |
| 24 | + |
| 25 | + // Batch manager operations |
| 26 | + 'function setInterestBatchManager(uint256 _troveId, address _newBatchManager, uint256 _upperHint, uint256 _lowerHint, uint256 _maxUpfrontFee)', |
| 27 | + 'function removeFromBatch(uint256 _troveId, uint256 _newAnnualInterestRate, uint256 _upperHint, uint256 _lowerHint, uint256 _maxUpfrontFee)', |
| 28 | + 'function switchBatchManager(uint256 _troveId, uint256 _removeUpperHint, uint256 _removeLowerHint, address _newBatchManager, uint256 _addUpperHint, uint256 _addLowerHint, uint256 _maxUpfrontFee)', |
| 29 | + |
| 30 | + // Individual delegate |
| 31 | + 'function setInterestIndividualDelegate(uint256 _troveId, address _delegate, uint128 _minInterestRate, uint128 _maxInterestRate, uint256 _newAnnualInterestRate, uint256 _upperHint, uint256 _lowerHint, uint256 _maxUpfrontFee, uint256 _minInterestRateChangePeriod)', |
| 32 | + 'function removeInterestIndividualDelegate(uint256 _troveId)', |
| 33 | + |
| 34 | + // View functions |
| 35 | + 'function hasBeenShutDown() view returns (bool)', |
| 36 | + 'function interestBatchManagerOf(uint256 _troveId) view returns (address)', |
| 37 | + 'function getInterestBatchManager(address _account) view returns ((uint128 minInterestRate, uint128 maxInterestRate, uint256 minInterestRateChangePeriod))', |
| 38 | + 'function checkBatchManagerExists(address _batchManager) view returns (bool)', |
| 39 | + 'function getInterestIndividualDelegateOf(uint256 _troveId) view returns ((address account, uint128 minInterestRate, uint128 maxInterestRate, uint256 minInterestRateChangePeriod))', |
| 40 | + |
| 41 | + // Inherited view functions from LiquityBase |
| 42 | + 'function getEntireBranchDebt() view returns (uint256)', |
| 43 | + 'function getEntireBranchColl() view returns (uint256)', |
| 44 | + |
| 45 | + 'function systemParams() view returns (address)', |
| 46 | + 'function CCR() view returns (uint256)', |
| 47 | + 'function MCR() view returns (uint256)', |
| 48 | + |
| 49 | + // Custom errors (BorrowerOperations.sol) |
| 50 | + 'error IsShutDown()', |
| 51 | + 'error TCRNotBelowSCR()', |
| 52 | + 'error ZeroAdjustment()', |
| 53 | + 'error NotOwnerNorInterestManager()', |
| 54 | + 'error TroveInBatch()', |
| 55 | + 'error TroveNotInBatch()', |
| 56 | + 'error InterestNotInRange()', |
| 57 | + 'error BatchInterestRateChangePeriodNotPassed()', |
| 58 | + 'error DelegateInterestRateChangePeriodNotPassed()', |
| 59 | + 'error TroveExists()', |
| 60 | + 'error TroveNotOpen()', |
| 61 | + 'error TroveNotActive()', |
| 62 | + 'error TroveNotZombie()', |
| 63 | + 'error TroveWithZeroDebt()', |
| 64 | + 'error UpfrontFeeTooHigh()', |
| 65 | + 'error ICRBelowMCR()', |
| 66 | + 'error ICRBelowMCRPlusBCR()', |
| 67 | + 'error RepaymentNotMatchingCollWithdrawal()', |
| 68 | + 'error TCRBelowCCR()', |
| 69 | + 'error DebtBelowMin()', |
| 70 | + 'error CollWithdrawalTooHigh()', |
| 71 | + 'error NotEnoughBoldBalance()', |
| 72 | + 'error InterestRateTooLow()', |
| 73 | + 'error InterestRateTooHigh()', |
| 74 | + 'error InterestRateNotNew()', |
| 75 | + 'error InvalidInterestBatchManager()', |
| 76 | + 'error BatchManagerExists()', |
| 77 | + 'error BatchManagerNotNew()', |
| 78 | + 'error NewFeeNotLower()', |
| 79 | + 'error CallerNotTroveManager()', |
| 80 | + 'error CallerNotPriceFeed()', |
| 81 | + 'error CallerNotSelf()', |
| 82 | + 'error MinGeMax()', |
| 83 | + 'error AnnualManagementFeeTooHigh()', |
| 84 | + 'error MinInterestRateChangePeriodTooLow()', |
| 85 | + 'error NewOracleFailureDetected()', |
| 86 | + 'error BatchSharesRatioTooLow()', |
| 87 | + |
| 88 | + // Custom errors (inherited from AddRemoveManagers) |
| 89 | + 'error EmptyManager()', |
| 90 | + 'error NotBorrower()', |
| 91 | + 'error NotOwnerNorAddManager()', |
| 92 | + 'error NotOwnerNorRemoveManager()', |
| 93 | +]) as any |
0 commit comments