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

Improve test fixtures #64

Merged
merged 29 commits into from
Dec 13, 2023
Merged

Improve test fixtures #64

merged 29 commits into from
Dec 13, 2023

Conversation

nkuba
Copy link
Member

@nkuba nkuba commented Dec 5, 2023

Depends on: #58

Improve test fixtures used in Acre contract tests:

  • use Acre and TBTC contracts deployed with hardhat development scripts (Include tBTC reference in the Acre contract deployment scripts #58)
  • use unnamed signers as stakers, to not overlap with named signers defined in hardhat.config.ts. ethers.getSigners() returns all signers, regardless of whether it is a Hardhat named or unnamed account

This PR contains changes from #62 which were unintentionally merged to this branch.

AcreRouter contract should manage ERC4626 vaults within the Acre system.
Owner of the contract should be able to add or remove vaults.
@nkuba nkuba requested a review from r-czajkowski December 5, 2023 16:49
@nkuba nkuba self-assigned this Dec 5, 2023
@nkuba nkuba added the 🔗 Solidity Solidity contracts label Dec 5, 2023
@nkuba nkuba added this to the MVP milestone Dec 5, 2023
dimpar and others added 5 commits December 6, 2023 14:23
Upgradability will be handled down the road in a separate PR(s)
Get contract deployed with hardhat deployment scripts to use them in
tests.
Hardhat have named signers that can be defined in the hardhat.config.ts
file and unnamed signers.
We need to use them separately in tests.
- use Acre and TBTC contracts deployed with hardhat dpeloyment scripts
- use unnamed signers as stakers, to not overlap with named signers
  (deployer and governance)
Base automatically changed from deploy-scripts to main December 7, 2023 11:47
@dimpar
Copy link
Member

dimpar commented Dec 7, 2023

There were a couple of comments left in #58 to unblock this PR and other PRs. @nkuba can you pls take a look and address if you agree with them?

@nkuba nkuba marked this pull request as ready for review December 8, 2023 12:24
As per #58 (comment)
realpath is not available out of the box on OSX. Instead of installing
additional package, we changed the way the path is resolved.
- Renamed VauldAdded->VaultAuthorized and
  VaultRemoved->VaultDeauthorized events
- Returning vaults array instead of vaults array length
- Replaced Address type with a String type
- Added test fixture just like we have in Acre.test.ts
- Various renames
@nkuba
Copy link
Member Author

nkuba commented Dec 12, 2023

@dimpar I answered all the open comments from #58.

* @returns Map of named Hardhat Ethers Signers.
*/
export async function getNamedSigner(): Promise<{
[name: string]: HardhatEthersSigner
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's define type eg. type NamedSigners = { [name: string]: HardhatEthersSigner } and we can use it in the line below:

  const namedSigners: NamedSigners = {}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a straightforward mapping holding broadly used HardhatEthersSigner properties.

When you use the function, you see what to expect:
Screen Shot 2023-12-13 at 08 54 08

With NamedSigners type, you don't see right away what the function will return:
Screen Shot 2023-12-13 at 08 58 04

IMHO, it will be more convenient for development to define this helper function using the current approach, HardhatEthersSigner, rather than a custom type.

core/test/helpers/signer.ts Outdated Show resolved Hide resolved
nkuba and others added 2 commits December 13, 2023 08:41
AcreRouter contract should manage ERC4626 vaults within the Acre
ecosystem. Owner of the contract should be able to add or remove vaults.

There's a `Vault` struct inside of the `AcreRouter` that holds only one
boolean `approved`. This struct will grow in the next PR(s) adding
things like "distribution percent" for each vault.
Co-authored-by: Rafał Czajkowski <[email protected]>
@nkuba nkuba requested a review from r-czajkowski December 13, 2023 08:01
Fix `@typescript-eslint/return-await` error returned by eslint.
Copy link
Member

@dimpar dimpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Leaving final approval to @r-czajkowski because of the unresolved comments.

@nkuba nkuba dismissed r-czajkowski’s stale review December 13, 2023 08:44

We need to merge this PR. We will handle otustanding comments in a follow-up PR.

@dimpar dimpar merged commit 574cec8 into main Dec 13, 2023
9 checks passed
@dimpar dimpar deleted the test-fixtures branch December 13, 2023 08:50
@nkuba nkuba mentioned this pull request Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔗 Solidity Solidity contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants