Skip to content

Commit

Permalink
fix: update inheritance on
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Bray committed Aug 7, 2024
1 parent 6c192c2 commit 4b38fff
Showing 1 changed file with 32 additions and 42 deletions.
74 changes: 32 additions & 42 deletions src/XeonHedging.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.20;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
Expand All @@ -22,22 +23,11 @@ interface IPriceOracle {
/**
* @title XeonHedging
*/
contract XeonHedging {
contract XeonHedging is Ownable, ReentrancyGuard{
using SafeERC20 for IERC20;

bool private isExecuting;

modifier nonReentrant() {
require(!isExecuting, "Function is currently being executed");
isExecuting = true;
_;
isExecuting = false;
}

modifier onlyOwner() {
require(msg.sender == owner, "You are not the owner");
_;
}
bool private isAdmin;

struct userBalance {
uint256 deposited; // incremented on successful deposit
Expand Down Expand Up @@ -200,7 +190,6 @@ contract XeonHedging {
address public usdcAddress;
address public xeonAddress;
address public stakingAddress;
address public owner;

// events
event Received(address, uint256);
Expand Down Expand Up @@ -236,33 +225,34 @@ contract XeonHedging {
event FeeUpdated(uint256 feeNumerator, uint256 feeDenominator);
event EtherWithdrawn(address indexed to, uint256 amount);

// constructor
constructor(
address _uniswapV2Factory,
address _uniswapV3Factory,
address _priceOracle,
XeonStaking _stakingContract
) {
require(_uniswapV2Factory != address(0), "Invalid UniswapV2Factory address");
require(_uniswapV3Factory != address(0), "Invalid UniswapV3Factory address");
require(_priceOracle != address(0), "Invalid Oracle Address");
require(address(_stakingContract) != address(0), "Invalid StakingContract Address");

uniswapV2Factory = IUniswapV2Factory(_uniswapV2Factory);
uniswapV3Factory = IUniswapV3Factory(_uniswapV3Factory);
priceOracle = _priceOracle;
stakingContract = XeonStaking(_stakingContract);

wethAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH address on Sepolia
usdtAddress = 0x297B8d4B35294e730087ADF0597A31a9bC1746af; // USDT address on Sepolia
usdcAddress = 0x8267cF9254734C6Eb452a7bb9AAF97B392258b21; // USDC address on Sepolia
xeonAddress = 0xDb90a9f7cEaA33a32Ec836Bbadeeaa8772Ad9797; // V2.1 deployed 14/01/2024 21:52:48

feeNumerator = 5;
feeDenominator = 1000;

emit ContractInitialized(_priceOracle, address(_stakingContract));
}
// constructor
constructor(
address _uniswapV2Factory,
address _uniswapV3Factory,
address _priceOracle,
XeonStaking _stakingContract
) Ownable(msg.sender) ReentrancyGuard() { // Properly call the Ownable constructor
require(_uniswapV2Factory != address(0), "Invalid UniswapV2Factory address");
require(_uniswapV3Factory != address(0), "Invalid UniswapV3Factory address");
require(_priceOracle != address(0), "Invalid Oracle Address");
require(address(_stakingContract) != address(0), "Invalid StakingContract Address");

uniswapV2Factory = IUniswapV2Factory(_uniswapV2Factory);
uniswapV3Factory = IUniswapV3Factory(_uniswapV3Factory);
priceOracle = _priceOracle;
stakingContract = XeonStaking(_stakingContract);

wethAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH address on Sepolia
usdtAddress = 0x297B8d4B35294e730087ADF0597A31a9bC1746af; // USDT address on Sepolia
usdcAddress = 0x8267cF9254734C6Eb452a7bb9AAF97B392258b21; // USDC address on Sepolia
xeonAddress = 0xDb90a9f7cEaA33a32Ec836Bbadeeaa8772Ad9797; // V2.1 deployed 14/01/2024 21:52:48

feeNumerator = 5;
feeDenominator = 1000;

emit ContractInitialized(_priceOracle, address(_stakingContract));
}


/**
* @dev Allows users to deposit ERC-20 tokens into the protocol.
Expand Down Expand Up @@ -1312,7 +1302,7 @@ contract XeonHedging {
uint256 token0Decimals;
uint256 token1Decimals;
}

//todo: getunderlyingvlue and price funcs should be in their own contract
// Get token value in paired currency.
// paired value is always the pair address of the token provided.
// TWAP oracle is used to get the price.
Expand Down

0 comments on commit 4b38fff

Please sign in to comment.