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

ICredbull.VaultParams should be broken up. #37

Closed
lucasia opened this issue May 8, 2024 · 1 comment
Closed

ICredbull.VaultParams should be broken up. #37

lucasia opened this issue May 8, 2024 · 1 comment
Assignees
Labels
code quality Improve the implementation quality.

Comments

@lucasia
Copy link
Member

lucasia commented May 8, 2024

https://github.com/credbull/credbull-defi/blob/8a910043673f8c3e5d7f68f6e5e496e138806786/packages/contracts/src/interface/ICredbull.sol#L12C1-L28C6

We have some great patterns with Plugins to extend Vault Behaviour and Factories to create different vault types. However, we are sharing the same VaultParams across all Vaults and Plugin types. This means the VaultParams will grow forever. :)

Let's split this VaultParams up, and push the logic into the VaultFactories. For example:

BaseVault only really needs the following:

 struct ContractRoles {
        address owner;
        address operator;
    }

    //Struct defining parameters for a vault
    struct BaseVaultParams {
        IERC20 asset;
        string shareName;
        string shareSymbol;
    }

Adding a WindowPlugin we need to also provide:

    // Window add-on
    struct WindowParams {
        uint256 opensAt;
        uint256 closesAt;
    }

    struct WindowVaultParams {
        WindowParams depositWindow;
        WindowParams matureWindow;
    }

This is likely a large refactoring across contracts, api, sdk and scripts. So, suggest we keep this in mind, but not start on it without improving our test cover and merge our scripts and sdk.

@lucasia lucasia added the code quality Improve the implementation quality. label May 8, 2024
@lucasia
Copy link
Member Author

lucasia commented Jun 26, 2024

Closed, see #48

@lucasia lucasia closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improve the implementation quality.
Projects
None yet
Development

No branches or pull requests

2 participants