File size: 8,343 Bytes
f998fcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
  "language": "Solidity",
  "sources": {
    "@gearbox-protocol/integrations-v2/contracts/adapters/convex/ConvexV1_StakedPositionToken.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1\n// Gearbox Protocol. Generalized leverage for DeFi protocols\n// (c) Gearbox Holdings, 2021\npragma solidity ^0.8.10;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { PhantomERC20 } from \"@gearbox-protocol/core-v2/contracts/tokens/PhantomERC20.sol\";\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\n/// @title ConvexStakedPositionToken\n/// @dev Represents the balance of the staking token position in Convex pools\ncontract ConvexStakedPositionToken is PhantomERC20 {\n    address public immutable pool;\n\n    /// @dev Constructor\n    /// @param _pool The Convex pool where the balance is tracked\n    /// @param _lptoken The Convex LP token that is staked in the pool\n    constructor(address _pool, address _lptoken)\n        PhantomERC20(\n            _lptoken,\n            string(\n                abi.encodePacked(\n                    \"Convex Staked Position \",\n                    IERC20Metadata(_lptoken).name()\n                )\n            ),\n            string(abi.encodePacked(\"stk\", IERC20Metadata(_lptoken).symbol())),\n            IERC20Metadata(_lptoken).decimals()\n        )\n    {\n        pool = _pool;\n    }\n\n    /// @dev Returns the amount of Convex LP tokens staked in the pool\n    /// @param account The account for which the calculation is performed\n    function balanceOf(address account) public view returns (uint256) {\n        return IERC20(pool).balanceOf(account);\n    }\n}\n"
    },
    "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\n        address recipient,\n        uint256 amount\n    ) external returns (bool);\n\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"
    },
    "@gearbox-protocol/core-v2/contracts/tokens/PhantomERC20.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1\n// Gearbox Protocol. Generalized leverage for DeFi protocols\n// (c) Gearbox Holdings, 2021\npragma solidity ^0.8.10;\n\nimport { IPhantomERC20 } from \"../interfaces/IPhantomERC20.sol\";\n\n/// @dev PhantomERC20 is a pseudo-ERC20 that only implements totalSupply and balanceOf\n/// @notice Used to track positions that do not issue an explicit share token\n///         This is an abstract contract and balanceOf is implemented by concrete instances\nabstract contract PhantomERC20 is IPhantomERC20 {\n    address public immutable underlying;\n\n    string public override symbol;\n    string public override name;\n    uint8 public immutable override decimals;\n\n    constructor(\n        address _underlying,\n        string memory _name,\n        string memory _symbol,\n        uint8 _decimals\n    ) {\n        symbol = _symbol;\n        name = _name;\n        decimals = _decimals;\n        underlying = _underlying;\n    }\n\n    function totalSupply() external view virtual override returns (uint256) {\n        return IPhantomERC20(underlying).totalSupply();\n    }\n\n    function transfer(address, uint256) external pure override returns (bool) {\n        return false;\n    }\n\n    function allowance(address, address)\n        external\n        pure\n        override\n        returns (uint256)\n    {\n        return 0;\n    }\n\n    function approve(address, uint256) external pure override returns (bool) {\n        return false;\n    }\n\n    function transferFrom(\n        address,\n        address,\n        uint256\n    ) external pure override returns (bool) {\n        return false;\n    }\n}\n"
    },
    "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
    },
    "@gearbox-protocol/core-v2/contracts/interfaces/IPhantomERC20.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n// Gearbox Protocol. Generalized leverage for DeFi protocols\n// (c) Gearbox Holdings, 2021\npragma solidity ^0.8.10;\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\n/// @title IPhantomERC20\n/// @dev Phantom tokens track balances in pools / contracts\n///      that do not mint an LP or a share token. Non-transferrabl.\ninterface IPhantomERC20 is IERC20Metadata {\n    /// @dev Returns the address of the token that is staked into the tracked position\n    function underlying() external view returns (address);\n}\n"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 1000000
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "libraries": {}
  }
}