Skip to content

Commit

Permalink
add more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
neokry committed Oct 27, 2023
1 parent 153dfe0 commit de3e3b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/deployers/L2MigrationDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ contract L2MigrationDeployer {
function depositToTreasury() external payable onlyCrossDomainMessenger {
(, , , address treasury, ) = _getDAOAddressesFromSender();

// Transfer ether to treasury
(bool success, ) = treasury.call{ value: msg.value }("");

// Revert if transfer fails
Expand All @@ -174,19 +175,25 @@ contract L2MigrationDeployer {
/// ///

function _xMsgSender() private view returns (address) {
// Return the xDomain message sender from the Optimism cross domain messenger
return ICrossDomainMessenger(crossDomainMessenger).xDomainMessageSender();
}

function _setTokenDeployer(address token) private returns (address deployer) {
deployer = _xMsgSender();

// Set the deployer state so the xDomain caller can easily access in future calls
// Also prevents accidental re-deployment
crossDomainDeployerToToken[deployer] = token;
}

function _resetTokenDeployer() private {
// Reset the deployer state so the xDomain caller can redeploy
delete crossDomainDeployerToToken[_xMsgSender()];
}

function _getTokenFromSender() private view returns (address) {
// Return the token address if it has been deployed by the xDomain caller
return crossDomainDeployerToToken[_xMsgSender()];
}

Expand All @@ -202,8 +209,10 @@ contract L2MigrationDeployer {
{
address _token = _getTokenFromSender();

// Revert if no token has been deployed
if (_token == address(0)) revert NO_DAO_DEPLOYED();

// Get the DAO addresses
(address _metadata, address _auction, address _treasury, address _governor) = IManager(manager).getAddresses(_token);
return (_token, _metadata, _auction, _treasury, _governor);
}
Expand Down
2 changes: 2 additions & 0 deletions src/manager/IManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ interface IManager is IUUPS, IOwnable {
/// @notice The auction parameters
/// @param reservePrice The reserve price of each auction
/// @param duration The duration of each auction
/// @param founderRewardRecipent The address to send founder rewards to
/// @param founderRewardBps Percent of the auction bid in BPS to send to the founder recipent
struct AuctionParams {
uint256 reservePrice;
uint256 duration;
Expand Down

0 comments on commit de3e3b0

Please sign in to comment.