-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/AstariaXYZ/starport into HEAD
- Loading branch information
Showing
11 changed files
with
280 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
TestStarLite:testNewLoan() (gas: 2424939) | ||
TestStarLite:testRepayLoan() (gas: 3078108) | ||
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecall() (gas: 952394) | ||
TestLoanManager:testStorage() (gas: 2283158165) | ||
TestLoanManager:testSupportsInterface() (gas: 6937) | ||
TestNewLoan:testBuyNowPayLater() (gas: 1141902) | ||
TestNewLoan:testNewLoanERC721CollateralDefaultTerms2():((uint256,address,address,address,address,(uint8,address,uint256,uint256)[],(uint8,address,uint256,uint256)[],(address,bytes,address,bytes,address,bytes))) (gas: 987750) | ||
TestNewLoan:testNewLoanERC721CollateralDefaultTermsRefinance() (gas: 648498) | ||
TestNewLoan:testNewLoanERC721CollateralDefaultTermsWithMerkleProof():((uint256,address,address,address,address,(uint8,address,uint256,uint256)[],(uint8,address,uint256,uint256)[],(address,bytes,address,bytes,address,bytes))) (gas: 581604) | ||
TestNewLoan:testSettleLoan() (gas: 1260468) | ||
TestRepayLoan:testRepayLoan() (gas: 718985) | ||
TestStarLiteUtils:testEncodeReceivedWithRecipient() (gas: 17955) | ||
TestStarLiteUtils:testSpentToReceived() (gas: 17796) |
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,25 @@ | ||
|
||
//Assert balances are correct after new loan is created | ||
modifier newLoanAssertions() { | ||
|
||
uint256 borrowerBalance; | ||
|
||
_; | ||
|
||
//Assert updated balances are correct | ||
|
||
} | ||
|
||
|
||
//Assert balances are correct after loan is repaid | ||
modifier repayAssertions() { | ||
|
||
uint256 borrowerBalance; | ||
|
||
_; | ||
|
||
//Assert updated balances are correct | ||
|
||
} | ||
|
||
|
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,64 @@ | ||
pragma solidity =0.8.17; | ||
|
||
import { | ||
ItemType, | ||
SpentItem, | ||
ReceivedItem | ||
} from "seaport-types/src/lib/ConsiderationStructs.sol"; | ||
import {Cast} from "test/utils/Cast.sol"; | ||
import "test/utils/FuzzStructs.sol" as Fuzz; | ||
import "forge-std/Test.sol"; | ||
|
||
abstract contract Bound is StdUtils { | ||
using Cast for *; | ||
|
||
function _boundItemType(uint8 itemType) internal pure returns (ItemType) { | ||
return | ||
_bound( | ||
itemType, | ||
uint8(ItemType.NATIVE), | ||
uint8(ItemType.ERC1155_WITH_CRITERIA) | ||
).toItemType(); | ||
} | ||
|
||
function _boundSpentItem( | ||
Fuzz.SpentItem memory input | ||
) internal pure returns (SpentItem memory ret) { | ||
ret = SpentItem({ | ||
itemType: _boundItemType(input.itemType), | ||
token: input.token, | ||
identifier: input.identifier, | ||
amount: input.amount | ||
}); | ||
} | ||
|
||
function _boundSpentItems( | ||
Fuzz.SpentItem[] memory input | ||
) internal pure returns (SpentItem[] memory ret) { | ||
ret = new SpentItem[](input.length); | ||
for (uint256 i = 0; i < input.length; i++) { | ||
ret[i] = _boundSpentItem(input[i]); | ||
} | ||
} | ||
|
||
function _boundReceivedItem( | ||
Fuzz.ReceivedItem memory input | ||
) internal pure returns (ReceivedItem memory ret) { | ||
ret = ReceivedItem({ | ||
itemType: _boundItemType(input.itemType), | ||
token: input.token, | ||
identifier: input.identifier, | ||
amount: input.amount, | ||
recipient: input.recipient | ||
}); | ||
} | ||
|
||
function _boundReceivedItems( | ||
Fuzz.ReceivedItem[] memory input | ||
) internal pure returns (ReceivedItem[] memory ret) { | ||
ret = new ReceivedItem[](input.length); | ||
for (uint256 i = 0; i < input.length; i++) { | ||
ret[i] = _boundReceivedItem(input[i]); | ||
} | ||
} | ||
} |
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 @@ | ||
pragma solidity =0.8.17; | ||
|
||
import { | ||
ItemType, | ||
SpentItem, | ||
ReceivedItem | ||
} from "seaport-types/src/lib/ConsiderationStructs.sol"; | ||
import "test/utils/FuzzStructs.sol" as Fuzz; | ||
import "forge-std/Test.sol"; | ||
|
||
library Cast { | ||
function toUint(uint8 input) internal pure returns (uint256 ret) { | ||
assembly { | ||
ret := input | ||
} | ||
} | ||
|
||
function toUint(address input) internal pure returns (uint256 ret) { | ||
assembly { | ||
ret := input | ||
} | ||
} | ||
|
||
function toItemType(uint256 input) internal pure returns (ItemType ret) { | ||
assembly { | ||
ret := input | ||
} | ||
} | ||
} |
Oops, something went wrong.