Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foundry #10

Merged
merged 9 commits into from
Nov 19, 2022
Merged

Add foundry #10

merged 9 commits into from
Nov 19, 2022

Conversation

shibacrypt
Copy link

This PR intends to add foundry support with all the tests ported from hardhat as-is (as much as possible) and does not aim to replace hardhat.

If there is demand for hardhat to be replaced, I would be happy to do that in a separate PR. Also happy to refactor the current foundry tests; didn't do that for this PR as its meant to be a as-is port over so it is easier to verify each tests.

There is a similar PR which seems stale, so this PR aims to supersede that.

To run the tests:

forge install
forge test

Some Notes:

The owner reference is being used very loosely in the hardhat tests. Sometimes it meant 'owner of NFT', 'owner of loan', 'owner of lendingPool', so this has been renamed to a more specific role.

This test in hardhat currently fails: https://github.com/LlamaLend/contracts/blob/master/test/lendingPool.js#L108 due to the older version of OpenZeppelin's ERC721 being used. Would recommend to update this test to reflect the error message from the updated OZ ERC721 contract. This shouldn't affect the integrity of the test because this test is for the MockNFT hence not too important. This occured because package-lock.json isn't committed so a user would always grab the newest OZ packages, so do consider committing this file for consistency.

I believe this is a typo: https://github.com/LlamaLend/contracts/blob/master/test/listNfts.js#L39 , it seems to be MockNFT instead of MockEnumerableNFT.

This test is incorrect: https://github.com/LlamaLend/contracts/blob/master/test/listNfts.js#L50 , the MockNFT does _currentTokenId++ so the tokenId starts from 0, hence pulling id 101 to 201 should return [101, 102, 103, 104], hence length of 4.

Some Opinions:

Consider removing the test for the Mock NFTs, its not too useful to test mocks.

Consider moving the contracts in contracts/mocks to test folder, then set the test path. Reference: https://hardhat.org/hardhat-runner/docs/config#path-configuration

@0xngmi 0xngmi merged commit b7bce19 into LlamaLend:master Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants