ETH Price: $2,357.04 (+0.69%)

Contract

0x930388c769Da7B4616493d47B5D093D8ec26C969

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Farming Cent...102342023-03-28 12:16:24535 days ago1680005784IN
0x930388c7...8ec26C969
0 ETH0.0007030816
0x60a06040102252023-03-28 12:14:17535 days ago1680005657IN
 Create: FarmingCenterVault
0 ETH0.0067074516

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FarmingCenterVault

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 99999999 runs

Other Settings:
default evmVersion
File 1 of 4 : FarmingCenterVault.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;

import 'algebra-periphery/contracts/libraries/TransferHelper.sol';
import './interfaces/IFarmingCenterVault.sol';

contract FarmingCenterVault is IFarmingCenterVault {
    address public farmingCenter;
    address public immutable owner;
    // tokenId => IncentiveId => TokenAmount
    mapping(uint256 => mapping(bytes32 => uint256)) public override balances;

    constructor() {
        owner = msg.sender;
    }

    function lockTokens(
        uint256 tokenId,
        bytes32 incentiveId,
        uint256 tokenAmount
    ) external override {
        require(msg.sender == farmingCenter, 'onlyFarming');
        balances[tokenId][incentiveId] = tokenAmount;
    }

    function setFarmingCenter(address _farmingCenter) external override {
        require(msg.sender == owner, 'onlyOwner');
        require(farmingCenter == address(0), 'Already initialized');
        farmingCenter = _farmingCenter;
    }

    function claimTokens(
        address multiplierToken,
        address to,
        uint256 tokenId,
        bytes32 incentiveId
    ) external override {
        require(msg.sender == farmingCenter, 'onlyFarming');

        uint256 balance = balances[tokenId][incentiveId];
        if (balance > 0) {
            TransferHelper.safeTransfer(multiplierToken, to, balance);
            balances[tokenId][incentiveId] = 0;
        }
    }
}

File 2 of 4 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 3 of 4 : TransferHelper.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-periphery
library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers NativeToken to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferNative(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}

File 4 of 4 : IFarmingCenterVault.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.7.6;

interface IFarmingCenterVault {
    function claimTokens(
        address token,
        address to,
        uint256 tokenId,
        bytes32 incentiveId
    ) external;

    function setFarmingCenter(address farming) external;

    function lockTokens(
        uint256 tokenId,
        bytes32 incentiveId,
        uint256 tokenAmount
    ) external;

    function balances(uint256 tokenId, bytes32 incentiveId) external view returns (uint256 balance);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 99999999
  },
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"multiplierToken","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"incentiveId","type":"bytes32"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"farmingCenter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"incentiveId","type":"bytes32"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"lockTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_farmingCenter","type":"address"}],"name":"setFarmingCenter","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405234801561001057600080fd5b5033606081901b6080526106b06100366000398061024652806103a052506106b06000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c806392ae44e11161005057806392ae44e114610106578063b84ffe391461014f578063dd56e5d81461018457610072565b80632113e817146100775780634d10862d146100a25780638da5cb5b146100d5575b600080fd5b6100a06004803603606081101561008d57600080fd5b508035906020810135906040013561018c565b005b6100a0600480360360208110156100b857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661022e565b6100dd61039e565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100a06004803603608081101561011c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604081013590606001356103c2565b6101726004803603604081101561016557600080fd5b5080359060200135610495565b60408051918252519081900360200190f35b6100dd6104b2565b60005473ffffffffffffffffffffffffffffffffffffffff16331461021257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f6f6e6c794661726d696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000928352600160209081526040808520938552929052912055565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146102d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6f6e6c794f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60005473ffffffffffffffffffffffffffffffffffffffff161561035757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f416c726561647920696e697469616c697a656400000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005473ffffffffffffffffffffffffffffffffffffffff16331461044857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f6f6e6c794661726d696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000828152600160209081526040808320848452909152902054801561048e576104738585836104ce565b60008381526001602090815260408083208584529091528120555b5050505050565b600160209081526000928352604080842090915290825290205481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b602083106105a357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610566565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610605576040519150601f19603f3d011682016040523d82523d6000602084013e61060a565b606091505b5091509150818015610638575080511580610638575080806020019051602081101561063557600080fd5b50515b61048e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fdfea164736f6c6343000706000a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100725760003560e01c806392ae44e11161005057806392ae44e114610106578063b84ffe391461014f578063dd56e5d81461018457610072565b80632113e817146100775780634d10862d146100a25780638da5cb5b146100d5575b600080fd5b6100a06004803603606081101561008d57600080fd5b508035906020810135906040013561018c565b005b6100a0600480360360208110156100b857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661022e565b6100dd61039e565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100a06004803603608081101561011c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604081013590606001356103c2565b6101726004803603604081101561016557600080fd5b5080359060200135610495565b60408051918252519081900360200190f35b6100dd6104b2565b60005473ffffffffffffffffffffffffffffffffffffffff16331461021257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f6f6e6c794661726d696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000928352600160209081526040808520938552929052912055565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000476307dac3fd170166e007fcaa14f0a12972146316146102d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6f6e6c794f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60005473ffffffffffffffffffffffffffffffffffffffff161561035757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f416c726561647920696e697469616c697a656400000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b7f000000000000000000000000476307dac3fd170166e007fcaa14f0a12972146381565b60005473ffffffffffffffffffffffffffffffffffffffff16331461044857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f6f6e6c794661726d696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000828152600160209081526040808320848452909152902054801561048e576104738585836104ce565b60008381526001602090815260408083208584529091528120555b5050505050565b600160209081526000928352604080842090915290825290205481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b602083106105a357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610566565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610605576040519150601f19603f3d011682016040523d82523d6000602084013e61060a565b606091505b5091509150818015610638575080511580610638575080806020019051602081101561063557600080fd5b50515b61048e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fdfea164736f6c6343000706000a

Block Transaction Gas Used Reward
view all blocks sequenced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.