Liquidus Finance
  • Liquidus Finance
  • Overview
    • 💡The Vision
    • ✨Our Features
    • 📜Litepaper
  • Liquidus Wallet App
    • 📲Download Now
    • 🔒Create & Import A Wallet or Account
      • How to create a wallet in Liquidus
      • Import an existing wallet with Liquidus
      • Adding a new account, importing or switching accounts
      • Change the account name or color
    • 👣Wallet Basics
      • Receive tokens or find out your address
      • Send Tokens
      • Check your transaction history
      • The side menu and what to do there
        • Import a custom network
        • Import a custom token
    • 📈Track Your Holdings & Pools
      • Track the value of your crypto portfolio
      • Farm and pool details
    • 🔄Swap Tokens
      • Swapping tokens using the best exchange rates
      • Swap Settings
    • 🌊Manage Pools & Farms
      • Top Up a Farm or Pool
      • Check out the Liquidus Security Rating
      • Withdraw tokens from a farm or pool
      • Harvesting farms
    • 💰Find the highest interest-paying farms
    • ⁉️Have problems or need to get help?
  • Liquidus Farm
    • 👨‍🌾LIQ Yield Farming
    • 💰How To Start Farming
    • ➡️Harvest & Withdraw
  • Technical Details
    • ℹ️Wallet and Infrastructure Security Features
    • 🔐Wallet App Encryption & Security
    • ⛓️Smart Contracts
      • LIQ Token Contracts
      • Wallet App Contracts
        • KyberSwapLIQ.sol
        • LiquidusAutoLP.sol
        • LiquidusBoost.sol
        • LiquidusFeeEstimation.sol
      • Single Token Farm Contracts
      • Liquidity Pool Farm Contracts
      • Liquidus NFT Contracts
    • 🛡️Audits
    • 🐞Bug Bounty
  • LIQ TOKEN
    • 💧The Liquidus LIQ Token
    • 🔥Buyback & Burning Mechanism
    • 🥇Premium Tiers
  • About Liquidus
    • 🧑‍🤝‍🧑Community
    • 🏢The Liquidus Company
    • 📩Liquidus Insider
    • 🏛️Legal
Powered by GitBook
On this page
  1. Technical Details
  2. Smart Contracts
  3. Wallet App Contracts

LiquidusBoost.sol

Contract used to boost farms and pools with LIQ.

Smart Contract Code

// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract LiquidusBoost is Ownable, Pausable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address public rewardToken;

    mapping (address => mapping(uint => bool)) nonceUsed;

    event AdminTokenRecovery(address tokenRecovered, uint256 amount);


    function hashEthMsg(bytes32 _messageHash) public pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash));
    }


    function hash(bytes memory x) public pure returns (bytes32) {
        return keccak256(x);
    }

    function encode(uint256 amount, uint chainId, uint256 nonce, address sender) public pure returns (bytes memory) {
                return abi.encode(
                    amount,
                    chainId,
                    nonce,
                    sender
                );
    }

    function claimBoost (uint256 amount, uint256 nonce, uint8 v, bytes32 r, bytes32 s) public nonReentrant whenNotPaused {
            bytes memory encoded = encode(amount, block.chainid, nonce, msg.sender);
            bytes32 hashed = hash(encoded);
            hashed = hashEthMsg(hashed);
            address recoveredAddress = ecrecover(hashed, v, r, s);
            require(recoveredAddress != address(0) && recoveredAddress == owner(), 'Invalid Signature!');
            require(nonceUsed[msg.sender][nonce] == false, 'Nonce already used!');
            nonceUsed[msg.sender][nonce] = true;
            IERC20(rewardToken).safeTransfer(msg.sender, amount);
    }
    
    function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) public onlyOwner {
        IERC20(_tokenAddress).safeTransfer(address(msg.sender), _tokenAmount);
        emit AdminTokenRecovery(_tokenAddress, _tokenAmount);
    }

    function setRewardToken (address _rewardToken) public onlyOwner {
        rewardToken = _rewardToken;
    }

    function pause() public onlyOwner {
        _pause();
    }

    function unpause() public onlyOwner {
        _unpause();
    }

    receive() external payable {}
}
PreviousLiquidusAutoLP.solNextLiquidusFeeEstimation.sol

Last updated 2 years ago

⛓️