Skip to content

Commit

Permalink
construct bonus wrapper with gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-clippy committed Oct 18, 2024
1 parent ce1fc1d commit 5dc7cc0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion contracts/swap/SwapBonusWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

import "./LiquidityGaugeV3.sol";
import "./SwapBonus.sol";

contract SwapBonusWrapper is Ownable {
Expand All @@ -14,13 +15,17 @@ contract SwapBonusWrapper is Ownable {

address public immutable swapBonus;
address public immutable bonusToken;
LiquidityGaugeV3 public immutable liquidityGauge;

constructor(address swapBonus_) public {
constructor(LiquidityGaugeV3 liquidityGauge_) public {
liquidityGauge = liquidityGauge_;
address swapBonus_ = liquidityGauge_.swapBonus();
swapBonus = swapBonus_;
bonusToken = SwapBonus(swapBonus_).bonusToken();
}

function updateBonus(uint256 amount, uint256 interval) external onlyOwner {
liquidityGauge.syncWithVotingEscrow(address(0));
uint256 realAmount = amount.div(interval).mul(interval);
IERC20(bonusToken).safeTransferFrom(msg.sender, address(this), realAmount);
IERC20(bonusToken).approve(swapBonus, realAmount);
Expand Down

0 comments on commit 5dc7cc0

Please sign in to comment.