Skip to content

Commit

Permalink
[PDE-306] add reinitializer to AggregateToken (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyqs authored Dec 27, 2024
1 parent 4279b90 commit c2f995e
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion nest/src/AggregateToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,35 @@ contract AggregateToken is ComponentToken, IAggregateToken, ERC1155Holder {
$.paused = false;
}

/**
* @notice Reinitialize the AggregateToken
* @param owner Address of the owner of the AggregateToken
* @param name Name of the AggregateToken
* @param symbol Symbol of the AggregateToken
* @param asset_ Asset used to mint and burn the AggregateToken
* @param askPrice Price at which users can buy the AggregateToken using `asset`, times the base
* @param bidPrice Price at which users can sell the AggregateToken to receive `asset`, times the base
*/
function reinitialize(
address owner,
string memory name,
string memory symbol,
IComponentToken asset_,
uint256 askPrice,
uint256 bidPrice
) public onlyRole(UPGRADER_ROLE) reinitializer(2) {
super.reinitialize(owner, name, symbol, IERC20(address(asset_)), false, true);

AggregateTokenStorage storage $ = _getAggregateTokenStorage();
if (!$.componentTokenMap[asset_]) {
$.componentTokenList.push(asset_);
$.componentTokenMap[asset_] = true;
emit ComponentTokenListed(asset_);
}
$.askPrice = askPrice;
$.bidPrice = bidPrice;
}

// Override Functions

/**
Expand Down Expand Up @@ -380,7 +409,7 @@ contract AggregateToken is ComponentToken, IAggregateToken, ERC1155Holder {

/**
* @notice Request to sell ComponentToken.
* @dev Only the manager can call this function. This function requests
* @dev Only the manager can call this function. This function requests
* the sale of ComponentToken, which will be processed later.
* @param componentToken ComponentToken to sell
* @param componentTokenAmount Amount of ComponentToken to sell
Expand Down

0 comments on commit c2f995e

Please sign in to comment.