Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Refinance update #110

Merged
merged 6 commits into from
Nov 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/AstariaRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ contract AstariaRouter is Auth, ERC4626Router, Pausable, IAstariaRouter {
s.minInterestBPS = uint32((uint256(1e15) * 5) / (365 days));
s.minEpochLength = uint32(7 days);
s.maxEpochLength = uint32(45 days);
s.maxInterestRate = ((uint256(1e16) * 200) / (365 days)).safeCastTo88(); //63419583966; // 200% apy / second
s.maxInterestRate = ((uint256(1e16) * 200) / (365 days)).safeCastTo88();
//63419583966; // 200% apy / second
dangerousfood marked this conversation as resolved.
Show resolved Hide resolved
s.strategistFeeNumerator = uint32(200);
s.strategistFeeDenominator = uint32(1000);
s.buyoutFeeNumerator = uint32(100);
Expand Down Expand Up @@ -279,7 +280,8 @@ contract AstariaRouter is Auth, ERC4626Router, Pausable, IAstariaRouter {
*/
function fileGuardian(File[] calldata file) external {
RouterStorage storage s = _loadRouterSlot();
require(address(msg.sender) == address(s.guardian)); //only the guardian can call this
require(address(msg.sender) == address(s.guardian));
//only the guardian can call this
dangerousfood marked this conversation as resolved.
Show resolved Hide resolved
for (uint256 i = 0; i < file.length; i++) {
FileType what = file[i].what;
bytes memory data = file[i].data;
Expand Down Expand Up @@ -635,15 +637,15 @@ contract AstariaRouter is Auth, ERC4626Router, Pausable, IAstariaRouter {
ILienToken.Stack[] calldata stack
) external view returns (bool) {
RouterStorage storage s = _loadRouterSlot();
uint256 minNewRate = uint256(stack[position].lien.details.rate) -
uint256 maxNewRate = uint256(stack[position].lien.details.rate) -
s.minInterestBPS;

return
!((newLien.details.rate < minNewRate) ||
(block.timestamp +
newLien.details.duration -
stack[position].point.end <
s.minDurationIncrease));
(newLien.details.rate < maxNewRate &&
newLien.details.duration >= stack[position].point.end) ||
dangerousfood marked this conversation as resolved.
Show resolved Hide resolved
(block.timestamp + newLien.details.duration - stack[position].point.end >
dangerousfood marked this conversation as resolved.
Show resolved Hide resolved
s.minDurationIncrease &&
newLien.details.rate <= stack[position].lien.details.rate);
}

//INTERNAL FUNCS
Expand Down