// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IDexRouter {
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function getAmountsIn(
uint amountOut,
address[] memory path
) external view returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external view returns (uint amountB);
}
interface IDexPair is IERC20 {
function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);
}
contract DEFXFarm_eth is Ownable(msg.sender) {
struct UserInfo
{
uint depositedAmount;
uint earnedReward;
uint lastBlockTs;
uint defxAdded;
uint usdValAdded;
bool initialized;
}
struct FarmInfo
{
uint maxRewardRate;
uint minRewardRate;
uint ratioMinRate;
uint ratioMaxRate;
uint totalMaxAllocation;
uint totalCurrentAllocation;
uint totalLp;
bool isActive;
bool initialized;
IERC20 token;
IERC20 rewardToken;
IDexPair lpToken;
address[] usdPricePath;
}
FarmInfo farm;
address[] userList;
uint[] allocationList;
mapping(address => UserInfo) users;
mapping(uint => uint) allocations;
IDexRouter immutable DexRouter;
constructor(address _dexRouter)
{
DexRouter = IDexRouter(_dexRouter);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Farm management
////////////////////////////////////////////////////////////////////////////////////////////////////
function initFarm(address _token, address _lpToken, address _rewardToken, address[] memory _usdPricePath, uint _maxRewardRate, uint _minRewardRate, uint _ratioMaxRate, uint _ratioMinRate, uint[] memory _prices, uint[] memory _allocations)
external
onlyOwner
{
require(!farm.initialized, "Farm has already been initialized");
farm.totalCurrentAllocation = 0;
farm.token = IERC20(_token);
farm.rewardToken = IERC20(_rewardToken);
farm.usdPricePath = _usdPricePath;
farm.lpToken = IDexPair(_lpToken);
farm.totalLp = 0;
farm.maxRewardRate = _maxRewardRate*10**6;
farm.minRewardRate = _minRewardRate*10**6;
farm.ratioMaxRate = _ratioMaxRate*10**7;
farm.ratioMinRate = _ratioMinRate*10**7;
uint amnt = _prices.length;
for(uint i=0;i<amnt;i++){
allocationList.push(_prices[i]*10**7);
allocations[_prices[i]*10**7] = _allocations[i]*10**18;
}
userList = new address[](0);
farm.isActive = false;
farm.initialized = true;
}
function updateAllocationData(uint[] memory _prices, uint[] memory _allocations)
external
onlyOwner
{
require(farm.initialized, "Farm doesn't exist");
uint amnt = allocationList.length;
for(uint i=0;i<amnt;i++){
delete allocations[allocationList[i]];
}
delete allocationList;
uint newAmnt = _prices.length;
for(uint i=0;i<newAmnt;i++){
allocationList.push(_prices[i]*10**7);
allocations[_prices[i]*10**7] = _allocations[i]*10**18;
}
}
function setFarmStatus(bool _active)
external
onlyOwner
{
require(farm.initialized, "Farm doesn't exist");
farm.isActive = _active;
}
function updateRewardRate(uint _maxRewardRate, uint _minRewardRate, uint _ratioMaxRate, uint _ratioMinRate)
external
onlyOwner
{
require(farm.initialized, "Farm doesn't exist");
collectAllUserRewards();
farm.maxRewardRate = _maxRewardRate*10**6;
farm.minRewardRate = _minRewardRate*10**6;
farm.ratioMaxRate = _ratioMaxRate*10**7;
farm.ratioMinRate = _ratioMinRate*10**7;
}
function updateUsdPricePath(address[] memory _newUsdPricePath)
external
onlyOwner
{
require(farm.initialized, "Farm doesn't exist");
farm.usdPricePath = _newUsdPricePath;
}
////////////////////
function deposit(uint _amountToken, uint _slippage)
external
payable
{
require(farm.initialized, "Farm does not exist");
require(farm.isActive, "Farm isn't active");
require(msg.value > 5000000000000000, "Can't deposit less than 0.005 ETH");
require(_amountToken > 10000000000000000000, "Can't deposit less than 10 DEFX");
require(_slippage <= 200, "Slippage too high"); // max 2%
require(_amountToken <= getMaxFarmAmount(), "Not enough allocation available");
uint _amountETHmin = msg.value-(msg.value*_slippage/10000);
uint _amountTokenmin = _amountToken-(_amountToken*_slippage/10000);
collectUserRewards();
require(farm.token.transferFrom(_msgSender(), address(this), _amountToken), "Transfer failed");
require(farm.token.approve(address(DexRouter), _amountToken), "Failed to approve");
(uint amountToken, uint amountETH, uint liquidity) = DexRouter.addLiquidityETH{value: msg.value}(address(farm.token), _amountToken, _amountTokenmin, _amountETHmin, address(this), block.timestamp+3600);
require(amountToken >= _amountTokenmin && amountETH >= _amountETHmin && liquidity > 0, "Failed to add liquidity");
if(amountETH < msg.value){
payable(_msgSender()).transfer(msg.value-amountETH);
}
if(amountToken < _amountToken){
require(farm.token.transfer(_msgSender(), _amountToken-amountToken));
}
require(farm.totalLp + liquidity <= farm.lpToken.balanceOf(address(this)));
uint curPrice = getCurrentPrice();
UserInfo storage userInfo = users[_msgSender()];
if (!userInfo.initialized) {
userInfo.initialized = true;
userInfo.earnedReward = 0;
userInfo.depositedAmount = liquidity;
userInfo.usdValAdded = amountToken*curPrice/10**6;
userInfo.defxAdded = amountToken;
userList.push(_msgSender());
} else {
userInfo.usdValAdded += amountToken*curPrice/10**6;
userInfo.defxAdded += amountToken;
userInfo.depositedAmount += liquidity;
}
userInfo.lastBlockTs = block.timestamp;
farm.totalLp += liquidity;
farm.totalCurrentAllocation += amountToken;
}
function withdraw(uint _percentage, uint _slippage)
external
{
require(farm.initialized, "Farm does not exist");
require(_percentage > 0 && _percentage <= 100, "No valid percentage given");
require(_slippage <= 200, "Slippage too high"); // Max 2%
collectUserRewards();
UserInfo storage userInfo = users[_msgSender()];
require(userInfo.depositedAmount > 0, "User is not farming");
uint lpToTakeOut = userInfo.depositedAmount * _percentage / 100;
(uint112 _reserve0, uint112 _reserve1,) = farm.lpToken.getReserves();
uint totalLpSupply = farm.lpToken.totalSupply();
uint _amountToken = lpToTakeOut*10**18/totalLpSupply * _reserve0 / 10**18;
uint _amountTokenmin = _amountToken - (_amountToken * _slippage/10000);
uint _amountETH = lpToTakeOut*10**18/totalLpSupply * _reserve1 / 10**18;
uint _amountETHmin = _amountETH - (_amountETH * _slippage/10000);
require(farm.lpToken.approve(address(DexRouter), lpToTakeOut), "Failed to approve");
(uint amountToken, uint amountETH) = DexRouter.removeLiquidityETH(address(farm.token), lpToTakeOut, _amountTokenmin, _amountETHmin, address(this), block.timestamp+3600);
require(amountToken > 0 && amountETH > 0, "Failed to remove liquidity");
farm.totalLp -= lpToTakeOut;
farm.totalCurrentAllocation -= userInfo.defxAdded * _percentage / 100;
userInfo.depositedAmount -= lpToTakeOut;
userInfo.usdValAdded = userInfo.usdValAdded - (userInfo.usdValAdded * _percentage / 100);
userInfo.defxAdded = userInfo.defxAdded - (userInfo.defxAdded * _percentage / 100);
require(farm.token.transfer(_msgSender(), amountToken), "Failed to transfer asset to farmer");
payable(_msgSender()).transfer(amountETH);
}
function harvest(uint _amount)
external
{
require(farm.initialized, "Farm does not exist");
require(_amount > 0, "Can't harvest 0 rewards");
collectUserRewards();
UserInfo storage userInfo = users[_msgSender()];
require(userInfo.earnedReward >= _amount, "Harvest amount can't be greater than earned amount.");
userInfo.earnedReward -= _amount;
require(farm.rewardToken.transfer(_msgSender(), _amount), "Transfer failed");
}
function getDepositedAmount(address _user)
external
view
returns (uint, uint, uint)
{
uint userLP = users[_user].depositedAmount;
(uint112 _reserve0, uint112 _reserve1,) = farm.lpToken.getReserves();
uint totalLP = farm.lpToken.totalSupply();
uint defxInUserLp = userLP*10**9/totalLP * _reserve0 / 10**9;
uint ethInUserLp = userLP*10**9/totalLP * _reserve1 / 10**9;
return (userLP, ethInUserLp, defxInUserLp);
}
function getDepositedAssets(address _user)
external
view
returns (uint, uint)
{
return (users[_user].usdValAdded, users[_user].defxAdded);
}
function getTotalPendingRewards()
external
view
returns (uint)
{
uint totalPending = 0;
uint usercount = userList.length;
for(uint i = 0; i < usercount; i++){
UserInfo memory userInfo = users[userList[i]];
uint amntHours = (block.timestamp - userInfo.lastBlockTs) / 3600;
if(amntHours > 0 && userInfo.depositedAmount > 0){
uint pendingReward = userInfo.defxAdded * getUserRewardRate(userList[i]) / 8760 * amntHours / 10**8;
totalPending += userInfo.earnedReward + pendingReward;
}
}
return totalPending;
}
function getEarnedReward(address _user)
external
view
returns (uint)
{
UserInfo memory userInfo = users[_user];
uint amntHours = (block.timestamp - userInfo.lastBlockTs) / 3600;
uint totalReward = userInfo.earnedReward;
if(amntHours > 0 && userInfo.depositedAmount > 0){
uint pendingReward = userInfo.defxAdded * getUserRewardRate(_user) / 8760 * amntHours / 10**8;
totalReward = totalReward + pendingReward;
}
return totalReward;
}
function getUserRewardRate(address _user)
public
view
returns (uint)
{
UserInfo memory userInfo = users[_user];
if(!userInfo.initialized || userInfo.defxAdded == 0){
return 0;
}
uint averageEntry = userInfo.usdValAdded*10**9/userInfo.defxAdded;
if(averageEntry <= farm.ratioMinRate){
return farm.minRewardRate;
} else if(averageEntry >= farm.ratioMaxRate){
return farm.maxRewardRate;
}
uint p = (averageEntry-farm.ratioMinRate)*10**9 / (farm.ratioMaxRate-farm.ratioMinRate);
uint n = (farm.maxRewardRate-farm.minRewardRate) * p / 10**9;
uint userRewardRate = farm.minRewardRate + n;
return userRewardRate;
}
function getReserves()
external
view
returns(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)
{
return farm.lpToken.getReserves();
}
function getQuote(uint _amountDEFX, uint _amountETH)
external
view
returns(uint)
{
(uint reserveA, uint reserveB,) = farm.lpToken.getReserves();
if(_amountDEFX != 0){
return DexRouter.quote(_amountDEFX, reserveA, reserveB);
}
return DexRouter.quote(_amountETH, reserveB, reserveA);
}
function getCurrentPrice()
internal
view
returns(uint)
{
uint[] memory amounts = DexRouter.getAmountsIn(1000000000000000000, farm.usdPricePath);
return amounts[0];
}
function getMaxFarmAmount()
public
view
returns(uint)
{
uint curMax = getCurrentMaxAllocation();
if(curMax > farm.totalCurrentAllocation){
return curMax-farm.totalCurrentAllocation;
}
return 0;
}
function getAllocationData()
external
view
returns(uint, uint, uint, uint[] memory, uint[] memory)
{
uint maxFarmAmount = getMaxFarmAmount();
uint curMax = getCurrentMaxAllocation();
uint curPrice = getCurrentPrice();
uint amnt = allocationList.length;
uint[] memory allocs = new uint[](amnt);
for(uint i=0;i<amnt;i++){
allocs[i] = allocations[allocationList[i]];
}
return (maxFarmAmount, curMax, curPrice, allocationList, allocs);
}
function getCurrentMaxAllocation()
internal
view
returns(uint)
{
uint currentPrice = getCurrentPrice();
uint amnt = allocationList.length;
for(uint i=amnt;i>=1;i--){
if(currentPrice >= allocationList[i-1]/1000){
return allocations[allocationList[i-1]];
}
}
return 0;
}
function collectUserRewards()
internal
{
UserInfo storage userInfo = users[_msgSender()];
uint amntHours = (block.timestamp - userInfo.lastBlockTs) / 3600;
if(amntHours > 0 && userInfo.depositedAmount > 0){
uint pendingReward = userInfo.defxAdded * getUserRewardRate(_msgSender()) / 8760 * amntHours / 10**8;
userInfo.lastBlockTs = userInfo.lastBlockTs + (amntHours*3600);
userInfo.earnedReward += pendingReward;
}
}
function collectAllUserRewards()
internal
{
uint usercount = userList.length;
for(uint i = 0; i < usercount; i++){
UserInfo storage userInfo = users[userList[i]];
uint amntHours = (block.timestamp - userInfo.lastBlockTs) / 3600;
if(amntHours > 0 && userInfo.depositedAmount > 0){
uint pendingReward = userInfo.defxAdded * getUserRewardRate(userList[i]) / 8760 * amntHours / 10**8;
userInfo.lastBlockTs = userInfo.lastBlockTs + (amntHours*3600);
userInfo.earnedReward += pendingReward;
}
}
}
receive() external payable{}
/**
* @notice Enable recovery of ether sent by mistake to this contract's address.
*/
function drainStrayEther(uint _amount)
external
onlyOwner
returns (bool)
{
payable(owner()).transfer(_amount);
return true;
}
/**
* @notice Enable recovery of any ERC20 compatible token sent by mistake to this contract's address.
* The farms LP token can not be drained.
*/
function drainStrayTokens(IERC20 _token, uint _amount)
external
onlyOwner
returns (bool)
{
require(address(_token) != address(farm.lpToken), "LP tokens cannot be drained");
return _token.transfer(owner(), _amount);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
{
"compilationTarget": {
"contracts/DEFXFarm_eth.sol": "DEFXFarm_eth"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_dexRouter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"_amountToken","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"drainStrayEther","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"drainStrayTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllocationData","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getDepositedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getDepositedAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getEarnedReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxFarmAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountDEFX","type":"uint256"},{"internalType":"uint256","name":"_amountETH","type":"uint256"}],"name":"getQuote","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"_reserve0","type":"uint112"},{"internalType":"uint112","name":"_reserve1","type":"uint112"},{"internalType":"uint32","name":"_blockTimestampLast","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserRewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address[]","name":"_usdPricePath","type":"address[]"},{"internalType":"uint256","name":"_maxRewardRate","type":"uint256"},{"internalType":"uint256","name":"_minRewardRate","type":"uint256"},{"internalType":"uint256","name":"_ratioMaxRate","type":"uint256"},{"internalType":"uint256","name":"_ratioMinRate","type":"uint256"},{"internalType":"uint256[]","name":"_prices","type":"uint256[]"},{"internalType":"uint256[]","name":"_allocations","type":"uint256[]"}],"name":"initFarm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_active","type":"bool"}],"name":"setFarmStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_prices","type":"uint256[]"},{"internalType":"uint256[]","name":"_allocations","type":"uint256[]"}],"name":"updateAllocationData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxRewardRate","type":"uint256"},{"internalType":"uint256","name":"_minRewardRate","type":"uint256"},{"internalType":"uint256","name":"_ratioMaxRate","type":"uint256"},{"internalType":"uint256","name":"_ratioMinRate","type":"uint256"}],"name":"updateRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_newUsdPricePath","type":"address[]"}],"name":"updateUsdPricePath","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_percentage","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]