Skip to content

Commit

Permalink
remove on Loan settled callback from starport, can be done via new po…
Browse files Browse the repository at this point in the history
…stSettlement/postRepayment flows
  • Loading branch information
androolloyd committed Nov 4, 2023
1 parent b81cb03 commit 0904eac
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
8 changes: 0 additions & 8 deletions src/Starport.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ import {Ownable} from "solady/src/auth/Ownable.sol";
import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol";
import {PausableNonReentrant} from "starport-core/lib/PausableNonReentrant.sol";

interface LoanSettledCallback {
function onLoanSettled(Starport.Loan calldata loan) external;
}

contract Starport is ERC721, PausableNonReentrant {
using FixedPointMathLib for uint256;

Expand Down Expand Up @@ -473,10 +469,6 @@ contract Starport is ERC721, PausableNonReentrant {
_burn(tokenId);
}
_setExtraData(tokenId, uint8(FieldFlags.INACTIVE));

if (loan.issuer.code.length > 0) {
loan.issuer.call(abi.encodeWithSelector(LoanSettledCallback.onLoanSettled.selector, loan));
}
emit Close(tokenId);
}

Expand Down
27 changes: 0 additions & 27 deletions test/unit-testing/TestCustodian.sol
Original file line number Diff line number Diff line change
Expand Up @@ -239,32 +239,6 @@ contract TestCustodian is StarportTest, DeepEq, MockCall {
address(this), new SpentItem[](0), activeDebt, abi.encode(Actions.Repayment, activeLoan)
);
}
//TODO: add assertions

function testGenerateOrderRepayERC1155WithRevert() public {
// 1155
Starport.Loan memory originationDetails = _generateOriginationDetails(
_getERC1155SpentItem(erc1155s[0]), _getERC20SpentItem(erc20s[0], borrowAmount), address(issuer)
);

Starport.Loan memory loan =
newLoan(originationDetails, bytes32(uint256(2)), bytes32(uint256(2)), address(issuer));
skip(1);

loan.toStorage(activeLoan);
vm.prank(seaportAddr);
//function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;
vm.mockCallRevert(
address(issuer),
abi.encodeWithSelector(
LoanSettledCallback.onLoanSettled.selector, abi.encode(Actions.Repayment, activeLoan)
),
new bytes(0)
);
custodian.generateOrder(
activeLoan.borrower, new SpentItem[](0), activeDebt, abi.encode(Actions.Repayment, activeLoan)
);
}

function testGenerateOrdersWithLoanStartAtBlockTimestampInvalidLoan() public {
// 1155
Expand All @@ -276,7 +250,6 @@ contract TestCustodian is StarportTest, DeepEq, MockCall {
newLoan(originationDetails, bytes32(uint256(2)), bytes32(uint256(2)), address(issuer));
loan.toStorage(activeLoan);
vm.prank(seaportAddr);
//function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;
vm.expectRevert(abi.encodeWithSelector(Custodian.InvalidLoan.selector));
custodian.generateOrder(
activeLoan.borrower, new SpentItem[](0), activeDebt, abi.encode(Actions.Repayment, activeLoan)
Expand Down

0 comments on commit 0904eac

Please sign in to comment.