Skip to content

Conversation

bergben
Copy link
Owner

@bergben bergben commented Sep 5, 2022

No description provided.

{
require(_quantity > 0, "Redeem quantity must be > 0");

address hookContract = _callManagerPreRedeemHooks(_setToken, _quantity, msg.sender, _to);
Copy link
Owner Author

Choose a reason for hiding this comment

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

DIM doesn't have manager pre redeem hooks. not sure if we need that even if we add module hooks.

Choose a reason for hiding this comment

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

Yeah, since neither DIM nor BIMv1 have this, I guess it wouldn't be needed. The only example of managerHooks I found in our tests is the max supply hook (see here) which only needs to be called at issuance.

* @param _setToken Instance of the SetToken to update manager hook
* @param _newHook New manager hook contract address
*/
function updateManagerIssuanceHook(
Copy link
Owner Author

Choose a reason for hiding this comment

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

this functionality is new. Not sure if really needed. Could be excluded because we have module hooks?

Choose a reason for hiding this comment

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

We do use the supplyCapHook which is a manager issuance hook, so could be good to have a way to update it.

require(!_setToken.hasExternalPosition(components[i]), "Only default positions are supported");

notionalUnits[i] = _setToken.getDefaultPositionRealUnit(components[i]).toUint256().preciseMulCeil(_quantity);
uint256 units = _setToken.getDefaultPositionRealUnit(components[i]).toUint256();
Copy link
Owner Author

Choose a reason for hiding this comment

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

not exactly as in DIM, but almost

* If a pre-redeem hook has been configured, call the external-protocol contract's pre-redeem function.
* Pre-issue hook logic can contain arbitrary logic including validations, external function calls, etc.
*/
function _callManagerPreRedeemHooks(
Copy link
Owner Author

Choose a reason for hiding this comment

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

again, DIM doesn't call manager pre redeem hooks

Copy link

@ckoopmann ckoopmann left a comment

Choose a reason for hiding this comment

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

Generally LGTM.
ManagerPreredeemHook is probably not needed as you hinted at already.

If we do decide to go ahead with this we would probably want to implement the changes first in our set protocol fork though, and also test it there. (Also we probably want to add a new contract "BasicIssuanceModuleV2" instead of modifying the existing one).

{
require(_quantity > 0, "Redeem quantity must be > 0");

address hookContract = _callManagerPreRedeemHooks(_setToken, _quantity, msg.sender, _to);

Choose a reason for hiding this comment

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

Yeah, since neither DIM nor BIMv1 have this, I guess it wouldn't be needed. The only example of managerHooks I found in our tests is the max supply hook (see here) which only needs to be called at issuance.

* @param _setToken Instance of the SetToken to update manager hook
* @param _newHook New manager hook contract address
*/
function updateManagerIssuanceHook(

Choose a reason for hiding this comment

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

We do use the supplyCapHook which is a manager issuance hook, so could be good to have a way to update it.

* @return uint256[] List of component units required to issue the quantity of SetTokens
*/
function getRequiredComponentUnitsForIssue(
function getRequiredComponentIssuanceUnits(

Choose a reason for hiding this comment

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

This is nice. Having different names for this method between BIM and DIM was really annoying before :+1

Copy link
Owner Author

Choose a reason for hiding this comment

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

just noticed that they also differ in returned values...
ideally BIMv2 would have to return an empty array as return param 3 (for debt positions) I think

Copy link

@ckoopmann ckoopmann left a comment

Choose a reason for hiding this comment

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

Actually just found an issue with missing protection of the removeModule function.

* have a way to redeem their Sets
* SET TOKEN ONLY: Allows removal (and deletion of state) of BasicIssuanceModuleV2
*/
function removeModule() external override {

Choose a reason for hiding this comment

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

This method is not protected right ? So anyone can call it ?

Copy link

@ckoopmann ckoopmann Sep 8, 2022

Choose a reason for hiding this comment

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

Nevermind / False alarm: I just figured out that the method would fail if the caller is not a set token 👍

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