@levxdao/ve
Version:
VE and Gauge Voting for NFTs
325 lines • 66.2 kB
JSON
{
"address": "0x7e2979cAE78CC88ECd1adEE6e9C5eE642A8ebd27",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_ve",
"type": "address"
},
{
"internalType": "address",
"name": "_lpToken",
"type": "address"
},
{
"internalType": "address",
"name": "_discountToken",
"type": "address"
},
{
"internalType": "bool",
"name": "_isToken1",
"type": "bool"
},
{
"internalType": "uint256",
"name": "_minAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_maxBoost",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "discount",
"type": "uint256"
},
{
"indexed": true,
"internalType": "uint256",
"name": "locktime",
"type": "uint256"
}
],
"name": "CreateLock",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "discount",
"type": "uint256"
}
],
"name": "IncreaseAmount",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "addr",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "penaltyRate",
"type": "uint256"
}
],
"name": "Withdraw",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "duration",
"type": "uint256"
}
],
"name": "createLock",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "duration",
"type": "uint256"
}
],
"name": "createLockDiscounted",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "discountToken",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "increaseAmount",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "increaseAmountDiscounted",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "locked",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lockedTotal",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "maxBoost",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "minAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ve",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
},
{
"internalType": "uint256",
"name": "penaltyRate",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"transactionHash": "0x56cf89dffb926e5359801e662dc6df67241784b64479fd7469b6aa450dad5df5",
"receipt": {
"to": null,
"from": "0x5b8C253517b6Bd003369173109693B01cb6841B5",
"contractAddress": "0x7e2979cAE78CC88ECd1adEE6e9C5eE642A8ebd27",
"transactionIndex": 278,
"gasUsed": "1102717",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x03e34d2ac4db73c203e04015e3cc97b13b4de1d0c7cc6d556455e592476e4540",
"transactionHash": "0x56cf89dffb926e5359801e662dc6df67241784b64479fd7469b6aa450dad5df5",
"logs": [],
"blockNumber": 14903256,
"cumulativeGasUsed": "19676245",
"status": 1,
"byzantium": true
},
"args": [
"0x77D3d884FeA1E389150a26D4569b20ebA284A86d",
"0xdE0C1dC7f2b67705Cca50039418715F9C7F8D53B",
"0xb8b07d0f2990ddd5b99b6db59dd8356ca2b1302d",
true,
"333000000000000000",
"1000000000000000000000"
],
"solcInputHash": "e47e3caa7a97fd9ed213c8c8516f216a",
"metadata": "{\"compiler\":{\"version\":\"0.8.14+commit.80d49f37\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_ve\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_lpToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_discountToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"_isToken1\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"locktime\",\"type\":\"uint256\"}],\"name\":\"CreateLock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"}],\"name\":\"IncreaseAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"penaltyRate\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"createLock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"createLockDiscounted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"discountToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"increaseAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"increaseAmountDiscounted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"locked\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lockedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"penaltyRate\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/LPVotingEscrowDelegate.sol\":\"LPVotingEscrowDelegate\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/LPVotingEscrowDelegate.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.14;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"./uniswapv2/interfaces/IUniswapV2Pair.sol\\\";\\nimport \\\"./VotingEscrowDelegate.sol\\\";\\nimport \\\"./interfaces/IVotingEscrowMigrator.sol\\\";\\n\\ncontract LPVotingEscrowDelegate is VotingEscrowDelegate {\\n using SafeERC20 for IERC20;\\n\\n struct LockedBalance {\\n uint256 amount;\\n uint256 end;\\n }\\n\\n bool internal immutable isToken1;\\n uint256 public immutable minAmount;\\n uint256 public immutable maxBoost;\\n\\n uint256 public lockedTotal;\\n mapping(address => uint256) public locked;\\n\\n constructor(\\n address _ve,\\n address _lpToken,\\n address _discountToken,\\n bool _isToken1,\\n uint256 _minAmount,\\n uint256 _maxBoost\\n ) VotingEscrowDelegate(_ve, _lpToken, _discountToken) {\\n isToken1 = _isToken1;\\n minAmount = _minAmount;\\n maxBoost = _maxBoost;\\n }\\n\\n function _createLock(\\n uint256 amount,\\n uint256 duration,\\n bool discounted\\n ) internal override {\\n require(amount >= minAmount, \\\"LSVED: AMOUNT_TOO_LOW\\\");\\n\\n super._createLock(amount, duration, discounted);\\n\\n lockedTotal += amount;\\n locked[msg.sender] += amount;\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n function _increaseAmount(uint256 amount, bool discounted) internal override {\\n require(amount >= minAmount, \\\"LSVED: AMOUNT_TOO_LOW\\\");\\n\\n super._increaseAmount(amount, discounted);\\n\\n lockedTotal += amount;\\n locked[msg.sender] += amount;\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n function _getAmounts(uint256 amount, uint256)\\n internal\\n view\\n override\\n returns (uint256 amountVE, uint256 amountToken)\\n {\\n (uint112 reserve0, uint112 reserve1, ) = IUniswapV2Pair(token).getReserves();\\n uint256 reserve = isToken1 ? uint256(reserve1) : uint256(reserve0);\\n\\n uint256 totalSupply = IUniswapV2Pair(token).totalSupply();\\n uint256 _amountToken = (amount * reserve) / totalSupply;\\n\\n amountVE = _amountToken + (_amountToken * maxBoost * (totalSupply - lockedTotal)) / totalSupply / totalSupply;\\n uint256 upperBound = (_amountToken * 333) / 10;\\n if (amountVE > upperBound) {\\n amountVE = upperBound;\\n }\\n amountToken = 0;\\n }\\n\\n function withdraw(address addr, uint256 penaltyRate) external override {\\n require(msg.sender == ve, \\\"LSVED: FORBIDDEN\\\");\\n\\n uint256 amount = locked[addr];\\n require(amount > 0, \\\"LSVED: LOCK_NOT_FOUND\\\");\\n\\n lockedTotal -= amount;\\n locked[addr] = 0;\\n IERC20(token).safeTransfer(addr, (amount * (1e18 - penaltyRate)) / 1e18);\\n\\n emit Withdraw(addr, amount, penaltyRate);\\n }\\n}\\n\",\"keccak256\":\"0x726b6da9f6e044d3a4cff5fb99ac5d72b8dbddceee3019ecf2e23cce9f668a10\",\"license\":\"UNLICENSED\"},\"contracts/VotingEscrowDelegate.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.14;\\n\\nimport \\\"./interfaces/IVotingEscrowDelegate.sol\\\";\\nimport \\\"./interfaces/IVotingEscrow.sol\\\";\\nimport \\\"./interfaces/INFT.sol\\\";\\n\\nabstract contract VotingEscrowDelegate is IVotingEscrowDelegate {\\n address public immutable ve;\\n address public immutable token;\\n address public immutable discountToken;\\n\\n uint256 internal immutable _maxDuration;\\n uint256 internal immutable _interval;\\n\\n event CreateLock(address indexed account, uint256 amount, uint256 discount, uint256 indexed locktime);\\n event IncreaseAmount(address indexed account, uint256 amount, uint256 discount);\\n\\n constructor(\\n address _ve,\\n address _token,\\n address _discountToken\\n ) {\\n ve = _ve;\\n token = _token;\\n discountToken = _discountToken;\\n\\n _maxDuration = IVotingEscrow(_ve).maxDuration();\\n _interval = IVotingEscrow(ve).interval();\\n }\\n\\n modifier eligibleForDiscount {\\n require(INFT(discountToken).balanceOf(msg.sender) > 0, \\\"VED: DISCOUNT_TOKEN_NOT_OWNED\\\");\\n _;\\n }\\n\\n function createLockDiscounted(uint256 amount, uint256 duration) external eligibleForDiscount {\\n _createLock(amount, duration, true);\\n }\\n\\n function createLock(uint256 amount, uint256 duration) external {\\n _createLock(amount, duration, false);\\n }\\n\\n function _createLock(\\n uint256 amount,\\n uint256 duration,\\n bool discounted\\n ) internal virtual {\\n require(duration <= _maxDuration, \\\"VED: DURATION_TOO_LONG\\\");\\n\\n uint256 unlockTime = ((block.timestamp + duration) / _interval) * _interval; // rounded down to a multiple of interval\\n uint256 _duration = unlockTime - block.timestamp;\\n (uint256 amountVE, uint256 amountToken) = _getAmounts(amount, _duration);\\n if (discounted) {\\n amountVE = (amountVE * 100) / 90;\\n }\\n\\n emit CreateLock(msg.sender, amountVE, amountVE - amountToken, unlockTime);\\n IVotingEscrow(ve).createLockFor(msg.sender, amountVE, amountVE - amountToken, _duration);\\n }\\n\\n function increaseAmountDiscounted(uint256 amount) external eligibleForDiscount {\\n _increaseAmount(amount, true);\\n }\\n\\n function increaseAmount(uint256 amount) external {\\n _increaseAmount(amount, false);\\n }\\n\\n function _increaseAmount(uint256 amount, bool discounted) internal virtual {\\n uint256 unlockTime = IVotingEscrow(ve).unlockTime(msg.sender);\\n require(unlockTime > 0, \\\"VED: LOCK_NOT_FOUND\\\");\\n\\n (uint256 amountVE, uint256 amountToken) = _getAmounts(amount, unlockTime - block.timestamp);\\n if (discounted) {\\n amountVE = (amountVE * 100) / 90;\\n }\\n\\n emit IncreaseAmount(msg.sender, amountVE, amountVE - amountToken);\\n IVotingEscrow(ve).increaseAmountFor(msg.sender, amountVE, amountVE - amountToken);\\n }\\n\\n function _getAmounts(uint256 amount, uint256 duration)\\n internal\\n view\\n virtual\\n returns (uint256 amountVE, uint256 amountToken);\\n\\n function withdraw(address, uint256) external virtual override {\\n // Empty\\n }\\n}\\n\",\"keccak256\":\"0xd12a2a8f7b94e4aa59f1802d592aedd5a55fdc57aae2d550f810fc1c6a08b2c8\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/INFT.sol\":{\"content\":\"// SPDX-License-Identifier: WTFPL\\npragma solidity ^0.8.0;\\n\\ninterface INFT {\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n function mint(\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n function mintBatch(\\n address to,\\n uint256[] calldata tokenIds,\\n bytes calldata data\\n ) external;\\n\\n function burn(\\n uint256 tokenId,\\n uint256 label,\\n bytes32 data\\n ) external;\\n}\\n\",\"keccak256\":\"0xc83595af93e7a8388326fde207d30ab71ef7c661c366a65da9f918a099918141\",\"license\":\"WTFPL\"},\"contracts/interfaces/IVotingEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IVotingEscrow {\\n event SetMigrator(address indexed account);\\n event SetDelegate(address indexed account, bool isDelegate);\\n event Deposit(\\n address indexed provider,\\n uint256 value,\\n uint256 discount,\\n uint256 indexed unlockTime,\\n int128 indexed _type,\\n uint256 ts\\n );\\n event Cancel(address indexed provider, uint256 value, uint256 discount, uint256 penaltyRate, uint256 ts);\\n event Withdraw(address indexed provider, uint256 value, uint256 discount, uint256 ts);\\n event Migrate(address indexed provider, uint256 value, uint256 discount, uint256 ts);\\n event Supply(uint256 prevSupply, uint256 supply);\\n\\n function interval() external view returns (uint256);\\n\\n function maxDuration() external view returns (uint256);\\n\\n function token() external view returns (address);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function migrator() external view returns (address);\\n\\n function isDelegate(address account) external view returns (bool);\\n\\n function supply() external view returns (uint256);\\n\\n function migrated(address account) external view returns (bool);\\n\\n function delegateAt(address account, uint256 index) external view returns (address);\\n\\n function locked(address account)\\n external\\n view\\n returns (\\n int128 amount,\\n int128 discount,\\n uint256 start,\\n uint256 end\\n );\\n\\n function epoch() external view returns (uint256);\\n\\n function pointHistory(uint256 epoch)\\n external\\n view\\n returns (\\n int128 bias,\\n int128 slope,\\n uint256 ts,\\n uint256 blk\\n );\\n\\n function userPointHistory(address account, uint256 epoch)\\n external\\n view\\n returns (\\n int128 bias,\\n int128 slope,\\n uint256 ts,\\n uint256 blk\\n );\\n\\n function userPointEpoch(address account) external view returns (uint256);\\n\\n function slopeChanges(uint256 epoch) external view returns (int128);\\n\\n function delegateLength(address addr) external view returns (uint256);\\n\\n function getLastUserSlope(address addr) external view returns (int128);\\n\\n function getCheckpointTime(address _addr, uint256 _idx) external view returns (uint256);\\n\\n function unlockTime(address _addr) external view returns (uint256);\\n\\n function setMigrator(address _migrator) external;\\n\\n function setDelegate(address account, bool _isDelegate) external;\\n\\n function checkpoint() external;\\n\\n function depositFor(address _addr, uint256 _value) external;\\n\\n function createLockFor(\\n address _addr,\\n uint256 _value,\\n uint256 _discount,\\n uint256 _duration\\n ) external;\\n\\n function createLock(uint256 _value, uint256 _duration) external;\\n\\n function increaseAmountFor(\\n address _addr,\\n uint256 _value,\\n uint256 _discount\\n ) external;\\n\\n function increaseAmount(uint256 _value) external;\\n\\n function increaseUnlockTime(uint256 _duration) external;\\n\\n function cancel() external;\\n\\n function withdraw() external;\\n\\n function migrate() external;\\n\\n function balanceOf(address addr) external view returns (uint256);\\n\\n function balanceOf(address addr, uint256 _t) external view returns (uint256);\\n\\n function balanceOfAt(address addr, uint256 _block) external view returns (uint256);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function totalSupply(uint256 t) external view returns (uint256);\\n\\n function totalSupplyAt(uint256 _block) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3ac00d3de6b34a0c5cb777b5e9477af3982061f7e9021848dc662508f1cf0f1b\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IVotingEscrowDelegate.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IVotingEscrowDelegate {\\n event Withdraw(address indexed addr, uint256 amount, uint256 penaltyRate);\\n\\n function withdraw(address addr, uint256 penaltyRate) external;\\n}\\n\",\"keccak256\":\"0x6ba70000f8e426991d384d100a94596b815599f7698c49a95ffac88fbebab8a1\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IVotingEscrowMigrator.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IVotingEscrowMigrator {\\n function migrate(\\n address account,\\n int128 amount,\\n int128 discount,\\n uint256 start,\\n uint256 end,\\n address[] calldata delegates\\n ) external;\\n}\\n\",\"keccak256\":\"0xfa001d759be1d07823598ae2b590d6a2cb8e57e4c68f22468471c39480f9e97d\",\"license\":\"UNLICENSED\"},\"contracts/uniswapv2/interfaces/IUniswapV2Pair.sol\":{\"content\":\"pragma solidity >=0.5.0;\\n\\ninterface IUniswapV2Pair {\\n event Approval(address indexed owner, address indexed spender, uint value);\\n event Transfer(address indexed from, address indexed to, uint value);\\n\\n function name() external pure returns (string memory);\\n function symbol() external pure returns (string memory);\\n function decimals() external pure returns (uint8);\\n function totalSupply() external view returns (uint);\\n function balanceOf(address owner) external view returns (uint);\\n function allowance(address owner, address spender) external view returns (uint);\\n\\n function approve(address spender, uint value) external returns (bool);\\n function transfer(address to, uint value) external returns (bool);\\n function transferFrom(address from, address to, uint value) external returns (bool);\\n\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n function PERMIT_TYPEHASH() external pure returns (bytes32);\\n function nonces(address owner) external view returns (uint);\\n\\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\\n\\n event Mint(address indexed sender, uint amount0, uint amount1);\\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\\n event Swap(\\n address indexed sender,\\n uint amount0In,\\n uint amount1In,\\n uint amount0Out,\\n uint amount1Out,\\n address indexed to\\n );\\n event Sync(uint112 reserve0, uint112 reserve1);\\n\\n function MINIMUM_LIQUIDITY() external pure returns (uint);\\n function factory() external view returns (address);\\n function token0() external view returns (address);\\n function token1() external view returns (address);\\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\\n function price0CumulativeLast() external view returns (uint);\\n function price1CumulativeLast() external view returns (uint);\\n function kLast() external view returns (uint);\\n\\n function mint(address to) external returns (uint liquidity);\\n function burn(address to) external returns (uint amount0, uint amount1);\\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\\n function skim(address to) external;\\n function sync() external;\\n\\n function initialize(address, address) external;\\n}\",\"keccak256\":\"0x95203b071357552345aa2c4b2afd770ce49d671f41fc370e06112a37a4f6709f\"}},\"version\":1}",
"bytecode": "0x6101806040523480156200001257600080fd5b506040516200159238038062001592833981016040819052620000359162000164565b6001600160a01b03808716608081905281871660a05290851660c05260408051636db5c8fd60e01b81529051889288928892636db5c8fd916004808201926020929091908290030181865afa15801562000093573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000b99190620001db565b60e081815250506080516001600160a01b031663947a36fb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000101573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001279190620001db565b6101005250505091151561012052610140526101605250620001f5915050565b80516001600160a01b03811681146200015f57600080fd5b919050565b60008060008060008060c087890312156200017e57600080fd5b620001898762000147565b9550620001996020880162000147565b9450620001a96040880162000147565b935060608701518015158114620001bf57600080fd5b809350506080870151915060a087015190509295509295509295565b600060208284031215620001ee57600080fd5b5051919050565b60805160a05160c05160e051610100516101205161014051610160516112d6620002bc600039600081816101170152610e5601526000818161015f015281816105ba015261069c01526000610d6301526000610a8a01526000610a1f0152600081816101cc01528181610257015261035001526000818161020f01528181610548015281816106720152818161075501528181610cda0152610da601526000818160d301528181610426015281816107fd015281816109410152610b5901526112d66000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063cbf9fe5f11610071578063cbf9fe5f14610194578063e8103656146101b4578063ea61226c146101c7578063f145c73b146101ee578063f3fef3a3146101f7578063fc0c546a1461020a57600080fd5b806315456eba146100b95780631f850716146100ce57806337090c2f1461011257806383e995a1146101475780639b2cb5d81461015a578063b52c05fe14610181575b600080fd5b6100cc6100c7366004611061565b610231565b005b6100f57f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101397f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610109565b6100cc61015536600461107a565b61023f565b6101397f000000000000000000000000000000000000000000000000000000000000000081565b6100cc61018f36600461107a565b61032c565b6101396101a23660046110b8565b60016020526000908152604090205481565b6100cc6101c2366004611061565b610338565b6100f57f000000000000000000000000000000000000000000000000000000000000000081565b61013960005481565b6100cc6102053660046110d3565b61041b565b6100f57f000000000000000000000000000000000000000000000000000000000000000081565b61023c8160006105b8565b50565b6040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156102a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ca91906110fd565b1161031c5760405162461bcd60e51b815260206004820152601d60248201527f5645443a20444953434f554e545f544f4b454e5f4e4f545f4f574e454400000060448201526064015b60405180910390fd5b6103288282600161069a565b5050565b6103288282600061069a565b6040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561039f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c391906110fd565b116104105760405162461bcd60e51b815260206004820152601d60248201527f5645443a20444953434f554e545f544f4b454e5f4e4f545f4f574e45440000006044820152606401610313565b61023c8160016105b8565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104865760405162461bcd60e51b815260206004820152601060248201526f2629ab22a21d102327a92124a22222a760811b6044820152606401610313565b6001600160a01b038216600090815260016020526040902054806104e45760405162461bcd60e51b81526020600482015260156024820152741314d591510e881313d0d2d7d393d517d193d55391605a1b6044820152606401610313565b806000808282546104f5919061112c565b90915550506001600160a01b03831660009081526001602052604081205561056f83670de0b6b3a764000061052a858261112c565b6105349085611143565b61053e9190611162565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610782565b60408051828152602081018490526001600160a01b038516917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a2505050565b7f00000000000000000000000000000000000000000000000000000000000000008210156106205760405162461bcd60e51b81526020600482015260156024820152744c535645443a20414d4f554e545f544f4f5f4c4f5760581b6044820152606401610313565b61062a82826107e5565b8160008082825461063b9190611184565b9091555050336000908152600160205260408120805484929061065f908490611184565b9091555061032890506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330856109df565b7f00000000000000000000000000000000000000000000000000000000000000008310156107025760405162461bcd60e51b81526020600482015260156024820152744c535645443a20414d4f554e545f544f4f5f4c4f5760581b6044820152606401610313565b61070d838383610a1d565b8260008082825461071e9190611184565b90915550503360009081526001602052604081208054859290610742908490611184565b9091555061077d90506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330866109df565b505050565b6040516001600160a01b03831660248201526044810182905261077d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610c00565b6040516376b467b760e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906376b467b790602401602060405180830381865afa15801561084c573d6000803e3d6000fd5b505050506040513d601f19601f8201168