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

added beacon & refactored #4

Merged
merged 8 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PRIVATE_KEY=YOUR PRIVATE KEY

# RPC Endpoints
INFURA_KEY=INFURA PROJECT ID
ALCHEMY_KEY=ALCHEMY PROJECT ID

# Additional keys
ETHERSCAN_KEY=ETHERSCAN API KEY
Expand Down
108 changes: 0 additions & 108 deletions contracts/Factory.sol

This file was deleted.

19 changes: 2 additions & 17 deletions contracts/L1/Distribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.20;

import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import {PRECISION} from "@solarity/solidity-lib/utils/Globals.sol";
Expand All @@ -13,11 +12,9 @@ import {IDistribution} from "../interfaces/L1/IDistribution.sol";
import {IFeeConfig} from "../interfaces/L1/IFeeConfig.sol";
import {IL1Sender} from "../interfaces/L1/IL1Sender.sol";

contract Distribution is IDistribution, OwnableUpgradeable, UUPSUpgradeable {
contract Distribution is IDistribution, OwnableUpgradeable {
using SafeERC20 for IERC20;

bool public isNotUpgradeable;

address public depositToken;
address public l1Sender;
address public feeConfig;
Expand Down Expand Up @@ -60,7 +57,6 @@ contract Distribution is IDistribution, OwnableUpgradeable, UUPSUpgradeable {
Pool[] calldata poolsInfo_
) external initializer {
__Ownable_init();
__UUPSUpgradeable_init();

for (uint256 i; i < poolsInfo_.length; ++i) {
createPool(poolsInfo_[i]);
Expand All @@ -72,7 +68,7 @@ contract Distribution is IDistribution, OwnableUpgradeable, UUPSUpgradeable {
}

/**********************************************************************************************/
/*** Pool managment and data retrieval ***/
/*** Pool management and data retrieval ***/
/**********************************************************************************************/
function createPool(Pool calldata pool_) public onlyOwner {
require(pool_.payoutStart > block.timestamp, "DS: invalid payout start value");
Expand Down Expand Up @@ -358,15 +354,4 @@ contract Distribution is IDistribution, OwnableUpgradeable, UUPSUpgradeable {

return bridgeMessageId_;
}

/**********************************************************************************************/
/*** UUPS ***/
/**********************************************************************************************/
function removeUpgradeability() external onlyOwner {
isNotUpgradeable = true;
}

function _authorizeUpgrade(address) internal view override onlyOwner {
require(!isNotUpgradeable, "DS: upgrade isn't available");
}
}
6 changes: 1 addition & 5 deletions contracts/L1/FeeConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
pragma solidity ^0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

import {PRECISION} from "@solarity/solidity-lib/utils/Globals.sol";

import {IFeeConfig} from "../interfaces/L1/IFeeConfig.sol";

contract FeeConfig is IFeeConfig, OwnableUpgradeable, UUPSUpgradeable {
contract FeeConfig is IFeeConfig, OwnableUpgradeable {
address public treasury;
uint256 public baseFee;

mapping(address => uint256) public fees;

function __FeeConfig_init(address treasury_, uint256 baseFee_) external initializer {
__Ownable_init();
__UUPSUpgradeable_init();

treasury = treasury_;
baseFee = baseFee_;
Expand Down Expand Up @@ -48,6 +46,4 @@ contract FeeConfig is IFeeConfig, OwnableUpgradeable, UUPSUpgradeable {

return (fee_, treasury);
}

function _authorizeUpgrade(address) internal override onlyOwner {}
}
6 changes: 1 addition & 5 deletions contracts/L1/L1Sender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import {ILayerZeroEndpoint} from "@layerzerolabs/lz-evm-sdk-v1-0.7/contracts/int
import {IGatewayRouter} from "@arbitrum/token-bridge-contracts/contracts/tokenbridge/libraries/gateway/IGatewayRouter.sol";

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import {IWStETH} from "../interfaces/tokens/IWStETH.sol";
import {IL1Sender, IERC165} from "../interfaces/L1/IL1Sender.sol";

contract L1Sender is IL1Sender, OwnableUpgradeable, UUPSUpgradeable {
contract L1Sender is IL1Sender, OwnableUpgradeable {
address public unwrappedDepositToken;
address public distribution;

Expand All @@ -34,7 +33,6 @@ contract L1Sender is IL1Sender, OwnableUpgradeable, UUPSUpgradeable {
DepositTokenConfig calldata depositTokenConfig_
) external initializer {
__Ownable_init();
__UUPSUpgradeable_init();

distribution = distribution_;
rewardTokenConfig = rewardTokenConfig_;
Expand Down Expand Up @@ -112,6 +110,4 @@ contract L1Sender is IL1Sender, OwnableUpgradeable, UUPSUpgradeable {
config.adapterParams // adapterParams (see "Advanced Features")
);
}

function _authorizeUpgrade(address) internal view override onlyOwner {}
}
6 changes: 1 addition & 5 deletions contracts/L2/L2MessageReceiver.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import {IMOR20} from "../interfaces/L2/IMOR20.sol";
import {IL2MessageReceiver} from "../interfaces/L2/IL2MessageReceiver.sol";

contract L2MessageReceiver is IL2MessageReceiver, OwnableUpgradeable, UUPSUpgradeable {
contract L2MessageReceiver is IL2MessageReceiver, OwnableUpgradeable {
address public rewardToken;

Config public config;
Expand All @@ -20,7 +19,6 @@ contract L2MessageReceiver is IL2MessageReceiver, OwnableUpgradeable, UUPSUpgrad

function L2MessageReceiver__init(address rewardToken_, Config calldata config_) external initializer {
__Ownable_init();
__UUPSUpgradeable_init();

rewardToken = rewardToken_;
config = config_;
Expand Down Expand Up @@ -108,6 +106,4 @@ contract L2MessageReceiver is IL2MessageReceiver, OwnableUpgradeable, UUPSUpgrad

IMOR20(rewardToken).mint(user_, amount_);
}

function _authorizeUpgrade(address) internal view override onlyOwner {}
}
6 changes: 1 addition & 5 deletions contracts/L2/L2TokenReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import {ISwapRouter} from "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
Expand All @@ -11,7 +10,7 @@ import {TransferHelper} from "@uniswap/v3-periphery/contracts/libraries/Transfer
import {IL2TokenReceiver, IERC165, IERC721Receiver} from "../interfaces/L2/IL2TokenReceiver.sol";
import {INonfungiblePositionManager} from "../interfaces/uniswap-v3/INonfungiblePositionManager.sol";

contract L2TokenReceiver is IL2TokenReceiver, OwnableUpgradeable, UUPSUpgradeable {
contract L2TokenReceiver is IL2TokenReceiver, OwnableUpgradeable {
address public router;
address public nonfungiblePositionManager;

Expand All @@ -29,7 +28,6 @@ contract L2TokenReceiver is IL2TokenReceiver, OwnableUpgradeable, UUPSUpgradeabl
SwapParams memory secondSwapParams_
) external initializer {
__Ownable_init();
__UUPSUpgradeable_init();

router = router_;
nonfungiblePositionManager = nonfungiblePositionManager_;
Expand Down Expand Up @@ -177,6 +175,4 @@ contract L2TokenReceiver is IL2TokenReceiver, OwnableUpgradeable, UUPSUpgradeabl
function _getSwapParams(bool isUseFirstSwapParams_) internal view returns (SwapParams memory) {
return isUseFirstSwapParams_ ? firstSwapParams : secondSwapParams;
}

function _authorizeUpgrade(address) internal view override onlyOwner {}
}
Loading
Loading