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

Product lines basic #70

Merged
merged 9 commits into from
Mar 25, 2024
Merged

Product lines basic #70

merged 9 commits into from
Mar 25, 2024

Conversation

dglowinski
Copy link
Collaborator

Core and Escrow product lines included.

Needs testing

@dglowinski dglowinski changed the title WIP: Product lines basic Product lines basic Mar 23, 2024
abstract contract BaseProductLine {
// Constants

uint256 constant REENTRANCYLOCK__UNLOCKED = 1;
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 inherit from OZ maybe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ideally we would decide on the import policy. We didn't use to do it at all, but now the synths are... but not the reentrancy lock.. Leave it for consistency? Or do it in the synths as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we discussed that eventually synths will be moved to a separate repo. I think we decided to do the same for the product lines, right? I think in repos outside EVK we should be using external dependencies freely

emit Genesis();
}

function makeNewVaultInternal(address asset, bool upgradeable, address oracle, address unitOfAccount)
Copy link
Contributor

Choose a reason for hiding this comment

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

make upgradable the first param

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea


uint256 private reentrancyLock;

mapping(address vault => bool created) public vaultLookup;
Copy link
Contributor

Choose a reason for hiding this comment

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

this can also be taken from OZ - enumerable set

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same as reentrancy test - either use the imports everywhere or not. The set is an overkill for the needs here and we'll still need the getters..

vault.setSymbol(string.concat("e", getTokenSymbol(asset)));

vault.setFeeReceiver(feeReceiver);
vault.setGovernorAdmin(governor);
Copy link
Contributor

Choose a reason for hiding this comment

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

what about IRM? we need to set something default which should probably be stored as immutable.

btw, I noticed that we have inconsistency in Governance module:
getter is called interestRateModel and setter is called setIRM

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the default value for IRM is address(0) which is handled as 0% interest set. Good point about the setter

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll fix the setter straight on master

Copy link
Contributor

@kasperpawlowski kasperpawlowski Mar 24, 2024

Choose a reason for hiding this comment

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

the default value for IRM is address(0) which is handled as 0% interest set.

I know and I think it's problematic. when a new borrowable vault enabled, it should at least have a default interest rate installed. similar to what we had in Euler v1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A new Core vault won't have any LTV's either, so its not usable without further config anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

we'll probably need some default set of collaterals that gets set up of every new core vault

IEVault vault = makeNewVaultInternal(asset, UPGRADEABLE, oracle, unitOfAccount);

vault.setName(string.concat("Core vault: ", getTokenName(asset)));
vault.setSymbol(string.concat("e", getTokenSymbol(asset)));
Copy link
Contributor

Choose a reason for hiding this comment

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

symbol must also encode the product line I think. otherwise there's no way to distinguish between two vaults of the same asset by looking at the symbol

Copy link
Collaborator Author

@dglowinski dglowinski Mar 24, 2024

Choose a reason for hiding this comment

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

even within a product line there could be duplicate assets. In core, the governor can simply change the name.

Escrow does enforce single asset per line. How about escrUSDC @hoytech ?

But what about Edge vaults? edgUSDCn? where n is a counter of USDC vaults?

Copy link
Contributor

Choose a reason for hiding this comment

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

good point re multiple vaults of the same asset. the UI assumes that vaults names and symbols also have numbers. I think without them, it will be harder to handle for FE team. why don't we have a counter for each asset and add a number to the name and symbol? i.e. coreUSDC3?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Product lines will be developed further for sure. Let's maybe keep these improvements in mind for further work? For now we want yAudit to get a sense of what these things are


if (isEVCCompatible(asset)) {
uint32 flags = IEVault(newVault).configFlags();
IEVault(newVault).setConfigFlags(flags | CFG_EVC_COMPATIBLE_ASSET);
Copy link
Member

@haythemsellami haythemsellami Mar 25, 2024

Choose a reason for hiding this comment

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

Will this BaseProductLine.sol be the governor address always? or should we transfer governance at the end of the creation?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see it is handled in the functions that inherits this one 👍🏽

Comment on lines +15 to +16
address public governor;
address public feeReceiver;
Copy link
Member

Choose a reason for hiding this comment

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

Should we have functions that allow to set those addresses by governor?

@dglowinski dglowinski merged commit c908f35 into master Mar 25, 2024
4 checks passed
@dglowinski dglowinski deleted the product-lines-basic branch March 25, 2024 12:15
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.

4 participants