-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
962 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.18; | ||
|
||
interface IGasPool { | ||
// empty | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.18; | ||
|
||
import "../ActivePool.sol"; | ||
|
||
contract ActivePoolTester is ActivePool { | ||
|
||
function unprotectedIncreaseBoldDebt(uint _amount) external { | ||
boldDebt = boldDebt + _amount; | ||
} | ||
|
||
function unprotectedPayable() external payable { | ||
ETH = ETH + msg.value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.18; | ||
|
||
import "../Interfaces/IBoldToken.sol"; | ||
|
||
contract BoldTokenCaller { | ||
IBoldToken Bold; | ||
|
||
function setBold(IBoldToken _bold) external { | ||
Bold = _bold; | ||
} | ||
|
||
function boldMint(address _account, uint _amount) external { | ||
Bold.mint(_account, _amount); | ||
} | ||
|
||
function boldBurn(address _account, uint _amount) external { | ||
Bold.burn(_account, _amount); | ||
} | ||
|
||
function boldSendToPool(address _sender, address _poolAddress, uint256 _amount) external { | ||
Bold.sendToPool(_sender, _poolAddress, _amount); | ||
} | ||
|
||
function boldReturnFromPool(address _poolAddress, address _receiver, uint256 _amount ) external { | ||
Bold.returnFromPool(_poolAddress, _receiver, _amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.18; | ||
|
||
import "../BoldToken.sol"; | ||
|
||
contract BoldTokenTester is BoldToken { | ||
|
||
bytes32 private immutable _PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; | ||
|
||
constructor( | ||
address _troveManagerAddress, | ||
address _stabilityPoolAddress, | ||
address _borrowerOperationsAddress | ||
) public BoldToken(_troveManagerAddress, | ||
_stabilityPoolAddress, | ||
_borrowerOperationsAddress) {} | ||
|
||
function unprotectedMint(address _account, uint256 _amount) external { | ||
// No check on caller here | ||
|
||
_mint(_account, _amount); | ||
} | ||
|
||
function unprotectedBurn(address _account, uint _amount) external { | ||
// No check on caller here | ||
|
||
_burn(_account, _amount); | ||
} | ||
|
||
function unprotectedSendToPool(address _sender, address _poolAddress, uint256 _amount) external { | ||
// No check on caller here | ||
|
||
_transfer(_sender, _poolAddress, _amount); | ||
} | ||
|
||
function unprotectedReturnFromPool(address _poolAddress, address _receiver, uint256 _amount ) external { | ||
// No check on caller here | ||
|
||
_transfer(_poolAddress, _receiver, _amount); | ||
} | ||
|
||
function callInternalApprove(address owner, address spender, uint256 amount) external returns (bool) { | ||
_approve(owner, spender, amount); | ||
} | ||
|
||
function getChainId() external view returns (uint256 chainID) { | ||
//return _chainID(); // it’s private | ||
assembly { | ||
chainID := chainid() | ||
} | ||
} | ||
|
||
function getDigest(address owner, address spender, uint amount, uint nonce, uint deadline) external view returns (bytes32) { | ||
return keccak256(abi.encodePacked( | ||
uint16(0x1901), | ||
domainSeparator(), | ||
keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, amount, nonce, deadline)) | ||
) | ||
); | ||
} | ||
|
||
function recoverAddress(bytes32 digest, uint8 v, bytes32 r, bytes32 s) external pure returns (address) { | ||
return ecrecover(digest, v, r, s); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
contracts/src/OldTestContracts/BorrowerOperationsTester.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.18; | ||
|
||
import "../BorrowerOperations.sol"; | ||
|
||
/* Tester contract inherits from BorrowerOperations, and provides external functions | ||
for testing the parent's internal functions. */ | ||
contract BorrowerOperationsTester is BorrowerOperations { | ||
|
||
function getNewICRFromTroveChange | ||
( | ||
uint _coll, | ||
uint _debt, | ||
uint _collChange, | ||
bool isCollIncrease, | ||
uint _debtChange, | ||
bool isDebtIncrease, | ||
uint _price | ||
) | ||
external | ||
pure | ||
returns (uint) | ||
{ | ||
return _getNewICRFromTroveChange(_coll, _debt, _collChange, isCollIncrease, _debtChange, isDebtIncrease, _price); | ||
} | ||
|
||
function getNewTCRFromTroveChange | ||
( | ||
uint _collChange, | ||
bool isCollIncrease, | ||
uint _debtChange, | ||
bool isDebtIncrease, | ||
uint _price | ||
) | ||
external | ||
view | ||
returns (uint) | ||
{ | ||
return _getNewTCRFromTroveChange(_collChange, isCollIncrease, _debtChange, isDebtIncrease, _price); | ||
} | ||
|
||
function getUSDValue(uint _coll, uint _price) external pure returns (uint) { | ||
return _getUSDValue(_coll, _price); | ||
} | ||
|
||
function callInternalAdjustLoan | ||
( | ||
address _borrower, | ||
uint _collWithdrawal, | ||
uint _debtChange, | ||
bool _isDebtIncrease, | ||
address _upperHint, | ||
address _lowerHint) | ||
external | ||
{ | ||
_adjustTrove(_borrower, _collWithdrawal, _debtChange, _isDebtIncrease, _upperHint, _lowerHint, 0); | ||
} | ||
|
||
|
||
// Payable fallback function | ||
receive() external payable { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.18; | ||
|
||
import "../TroveManager.sol"; | ||
|
||
/* Tester contract inherits from TroveManager, and provides external functions | ||
for testing the parent's internal functions. */ | ||
|
||
contract TroveManagerTester is TroveManager { | ||
|
||
function computeICR(uint _coll, uint _debt, uint _price) external pure returns (uint) { | ||
return LiquityMath._computeCR(_coll, _debt, _price); | ||
} | ||
|
||
function getCollGasCompensation(uint _coll) external pure returns (uint) { | ||
return _getCollGasCompensation(_coll); | ||
} | ||
|
||
function getBoldGasCompensation() external pure returns (uint) { | ||
return BOLD_GAS_COMPENSATION; | ||
} | ||
|
||
function getCompositeDebt(uint _debt) external pure returns (uint) { | ||
return _getCompositeDebt(_debt); | ||
} | ||
|
||
function unprotectedDecayBaseRateFromBorrowing() external returns (uint) { | ||
baseRate = _calcDecayedBaseRate(); | ||
assert(baseRate >= 0 && baseRate <= DECIMAL_PRECISION); | ||
|
||
_updateLastFeeOpTime(); | ||
return baseRate; | ||
} | ||
|
||
function minutesPassedSinceLastFeeOp() external view returns (uint) { | ||
return _minutesPassedSinceLastFeeOp(); | ||
} | ||
|
||
function setLastFeeOpTimeToNow() external { | ||
lastFeeOperationTime = block.timestamp; | ||
} | ||
|
||
function setBaseRate(uint _baseRate) external { | ||
baseRate = _baseRate; | ||
} | ||
|
||
function callGetRedemptionFee(uint _ETHDrawn) external view returns (uint) { | ||
_getRedemptionFee(_ETHDrawn); | ||
} | ||
|
||
function getActualDebtFromComposite(uint _debtVal) external pure returns (uint) { | ||
return _getNetDebt(_debtVal); | ||
} | ||
|
||
function callInternalRemoveTroveOwner(address _troveOwner) external { | ||
uint troveOwnersArrayLength = TroveOwners.length; | ||
_removeTroveOwner(_troveOwner, troveOwnersArrayLength); | ||
} | ||
} |
Oops, something went wrong.