CLGaugeFactory

0x6bdf3b9a782c28d6259356d0cb7ae22ab1368863

Verification
Verified
v0.7.6+commit.7338295f
Type
Contract
1,859 bytes
ABI entries
9
4 read · 3 write
License
none

Contract information

Address
0x6bdf3b9a782c28d6259356d0cb7ae22ab1368863
Chain
Robinhood Chain (4663)
Compiler
v0.7.6+commit.7338295f
Optimization
Enabled
Creation tx
0x0ae5bb24fb…4334b740a9

Token

Not a token

This contract does not expose ERC-20 metadata.

Read contract (4)

implementation()address
nft()address
notifyAdmin()address
voter()address

Events (1)

SetNotifyAdmin

ABI

[
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_voter",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "_implementation",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "notifyAdmin",
        "type": "address"
      }
    ],
    "name": "SetNotifyAdmin",
    "type": "event"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "_pool",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "_feesVotingReward",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "_rewardToken",
        "type": "address"
      },
      {
        "internalType": "bool",
        "name": "_isPool",
        "type": "bool"
      }
    ],
    "name": "createGauge",
    "outputs": [
      {
        "internalType": "address",
        "name": "_gauge",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "implementation",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "nft",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "notifyAdmin",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_nft",
        "type": "address"
      }
    ],
    "name": "setNonfungiblePositionManager",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_admin",
        "type": "address"
      }
    ],
    "name": "setNotifyAdmin",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "voter",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  }
]

Source code

// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.7.6;

import "contracts/core/interfaces/ICLPool.sol";
import "./interfaces/ICLGaugeFactory.sol";
import "./CLGauge.sol";
import "lib/openzeppelin-contracts/contracts/proxy/Clones.sol";

contract CLGaugeFactory is ICLGaugeFactory {
    /// @inheritdoc ICLGaugeFactory
    address public immutable override voter;
    /// @inheritdoc ICLGaugeFactory
    address public immutable override implementation;
    /// @inheritdoc ICLGaugeFactory
    address public override nft;
    /// @inheritdoc ICLGaugeFactory
    address public override notifyAdmin;
    address private owner;

    constructor(address _voter, address _implementation) {
        voter = _voter;
        owner = msg.sender;
        notifyAdmin = msg.sender;
        implementation = _implementation;
    }

    /// @inheritdoc ICLGaugeFactory
    function setNotifyAdmin(address _admin) external override {
        require(notifyAdmin == msg.sender, "NA");
        require(_admin != address(0), "ZA");
        notifyAdmin = _admin;
        emit SetNotifyAdmin(_admin);
    }

    /// @inheritdoc ICLGaugeFactory
    function setNonfungiblePositionManager(address _nft) external override {
        require(nft == address(0), "AI");
        require(owner == msg.sender, "NA");
        require(_nft != address(0), "ZA");
        nft = _nft;
        delete owner;
    }

    /// @inheritdoc ICLGaugeFactory
    function createGauge(
        address, /* _forwarder */
        address _pool,
        address _feesVotingReward,
        address _rewardToken,
        bool _isPool
    ) external override returns (address _gauge) {
        require(msg.sender == voter, "NV");
        address token0 = ICLPool(_pool).token0();
        address token1 = ICLPool(_pool).token1();
        int24 tickSpacing = ICLPool(_pool).tickSpacing();
        _gauge = Clones.clone({master: implementation});
        ICLGauge(_gauge).initialize({
            _pool: _pool,
            _feesVotingReward: _feesVotingReward,
            _rewardToken: _rewardToken,
            _voter: voter,
            _nft: nft,
            _token0: token0,
            _token1: token1,
            _tickSpacing: tickSpacing,
            _isPool: _isPool
        });
        ICLPool(_pool).setGaugeAndPositionManager({_gauge: _gauge, _nft: nft});
    }
}
Chain explorer3165msChain node76ms