UNPKG

@etherisc/depeg-contracts

Version:

Etherisc's smart contracts for a depeg insurance for stable coins.

896 lines 26.5 kB
{ "abi": [ { "inputs": [ { "components": [ { "internalType": "uint96", "name": "id", "type": "uint96" }, { "internalType": "uint96", "name": "target", "type": "uint96" }, { "internalType": "uint256", "name": "stakeBalance", "type": "uint256" }, { "internalType": "uint256", "name": "rewardBalance", "type": "uint256" }, { "internalType": "uint40", "name": "createdAt", "type": "uint40" }, { "internalType": "uint40", "name": "updatedAt", "type": "uint40" }, { "internalType": "uint48", "name": "version", "type": "uint48" } ], "internalType": "struct IStakingFacadeExt.StakeInfo", "name": "stakeInfo", "type": "tuple" } ], "name": "calculateRewardsIncrement", "outputs": [ { "internalType": "uint256", "name": "rewardsAmount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint96", "name": "targetNftId", "type": "uint96" } ], "name": "capitalSupport", "outputs": [ { "internalType": "uint256", "name": "capitalAmount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getDip", "outputs": [ { "internalType": "contract IERC20Metadata", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint96", "name": "id", "type": "uint96" } ], "name": "getInfo", "outputs": [ { "components": [ { "internalType": "uint96", "name": "id", "type": "uint96" }, { "internalType": "uint96", "name": "target", "type": "uint96" }, { "internalType": "uint256", "name": "stakeBalance", "type": "uint256" }, { "internalType": "uint256", "name": "rewardBalance", "type": "uint256" }, { "internalType": "uint40", "name": "createdAt", "type": "uint40" }, { "internalType": "uint40", "name": "updatedAt", "type": "uint40" }, { "internalType": "uint48", "name": "version", "type": "uint48" } ], "internalType": "struct IStakingFacadeExt.StakeInfo", "name": "info", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getRegistry", "outputs": [ { "internalType": "contract IChainRegistryFacade", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getStakingWallet", "outputs": [ { "internalType": "address", "name": "stakingWallet", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "implementsIStaking", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "maxRewardRate", "outputs": [ { "internalType": "uint256", "name": "rate", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "rateDecimals", "outputs": [ { "internalType": "uint256", "name": "decimals", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "rewardBalance", "outputs": [ { "internalType": "uint256", "name": "dipAmount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "rewardRate", "outputs": [ { "internalType": "uint256", "name": "rate", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "rewardReserves", "outputs": [ { "internalType": "uint256", "name": "dipAmount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "stakeBalance", "outputs": [ { "internalType": "uint256", "name": "dipAmount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes5", "name": "chain", "type": "bytes5" }, { "internalType": "address", "name": "token", "type": "address" } ], "name": "stakingRate", "outputs": [ { "internalType": "uint256", "name": "rate", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "chainId", "type": "uint256" } ], "name": "toChain", "outputs": [ { "internalType": "bytes5", "name": "", "type": "bytes5" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "int8", "name": "exp", "type": "int8" } ], "name": "toRate", "outputs": [ { "internalType": "uint256", "name": "rate", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "version", "outputs": [ { "internalType": "uint48", "name": "", "type": "uint48" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "versionParts", "outputs": [ { "internalType": "uint16", "name": "major", "type": "uint16" }, { "internalType": "uint16", "name": "minor", "type": "uint16" }, { "internalType": "uint16", "name": "patch", "type": "uint16" } ], "stateMutability": "view", "type": "function" } ], "allSourcePaths": { "4": "/home/vscode/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.7.3/contracts/token/ERC20/IERC20.sol", "5": "/home/vscode/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.7.3/contracts/token/ERC20/extensions/IERC20Metadata.sol", "59": "contracts/registry/IChainNftFacade.sol", "60": "contracts/registry/IChainRegistryFacade.sol", "62": "contracts/staking/IStakingFacade.sol", "63": "contracts/staking/IStakingFacadeExt.sol" }, "ast": { "absolutePath": "contracts/staking/IStakingFacadeExt.sol", "exportedSymbols": { "IStakingFacade": [ 7660 ], "IStakingFacadeExt": [ 7698 ] }, "id": 7699, "license": "Apache-2.0", "nodeType": "SourceUnit", "nodes": [ { "id": 7662, "literals": [ "solidity", "0.8", ".2" ], "nodeType": "PragmaDirective", "src": "39:22:63" }, { "absolutePath": "contracts/staking/IStakingFacade.sol", "file": "./IStakingFacade.sol", "id": 7664, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 7699, "sourceUnit": 7661, "src": "540:52:63", "symbolAliases": [ { "foreign": { "id": 7663, "name": "IStakingFacade", "nodeType": "Identifier", "overloadedDeclarations": [], "src": "548:14:63", "typeDescriptions": {} }, "nameLocation": "-1:-1:-1" } ], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "baseName": { "id": 7665, "name": "IStakingFacade", "nodeType": "IdentifierPath", "referencedDeclaration": 7660, "src": "625:14:63" }, "id": 7666, "nodeType": "InheritanceSpecifier", "src": "625:14:63" } ], "contractDependencies": [ 7660 ], "contractKind": "interface", "fullyImplemented": false, "id": 7698, "linearizedBaseContracts": [ 7698, 7660 ], "name": "IStakingFacadeExt", "nameLocation": "604:17:63", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "IStakingFacadeExt.StakeInfo", "id": 7681, "members": [ { "constant": false, "id": 7668, "mutability": "mutable", "name": "id", "nameLocation": "681:2:63", "nodeType": "VariableDeclaration", "scope": 7681, "src": "674:9:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint96", "typeString": "uint96" }, "typeName": { "id": 7667, "name": "uint96", "nodeType": "ElementaryTypeName", "src": "674:6:63", "typeDescriptions": { "typeIdentifier": "t_uint96", "typeString": "uint96" } }, "visibility": "internal" }, { "constant": false, "id": 7670, "mutability": "mutable", "name": "target", "nameLocation": "700:6:63", "nodeType": "VariableDeclaration", "scope": 7681, "src": "693:13:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint96", "typeString": "uint96" }, "typeName": { "id": 7669, "name": "uint96", "nodeType": "ElementaryTypeName", "src": "693:6:63", "typeDescriptions": { "typeIdentifier": "t_uint96", "typeString": "uint96" } }, "visibility": "internal" }, { "constant": false, "id": 7672, "mutability": "mutable", "name": "stakeBalance", "nameLocation": "724:12:63", "nodeType": "VariableDeclaration", "scope": 7681, "src": "716:20:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 7671, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "716:7:63", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 7674, "mutability": "mutable", "name": "rewardBalance", "nameLocation": "754:13:63", "nodeType": "VariableDeclaration", "scope": 7681, "src": "746:21:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 7673, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "746:7:63", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 7676, "mutability": "mutable", "name": "createdAt", "nameLocation": "784:9:63", "nodeType": "VariableDeclaration", "scope": 7681, "src": "777:16:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint40", "typeString": "uint40" }, "typeName": { "id": 7675, "name": "uint40", "nodeType": "ElementaryTypeName", "src": "777:6:63", "typeDescriptions": { "typeIdentifier": "t_uint40", "typeString": "uint40" } }, "visibility": "internal" }, { "constant": false, "id": 7678, "mutability": "mutable", "name": "updatedAt", "nameLocation": "810:9:63", "nodeType": "VariableDeclaration", "scope": 7681, "src": "803:16:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint40", "typeString": "uint40" }, "typeName": { "id": 7677, "name": "uint40", "nodeType": "ElementaryTypeName", "src": "803:6:63", "typeDescriptions": { "typeIdentifier": "t_uint40", "typeString": "uint40" } }, "visibility": "internal" }, { "constant": false, "id": 7680, "mutability": "mutable", "name": "version", "nameLocation": "836:7:63", "nodeType": "VariableDeclaration", "scope": 7681, "src": "829:14:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint48", "typeString": "uint48" }, "typeName": { "id": 7679, "name": "uint48", "nodeType": "ElementaryTypeName", "src": "829:6:63", "typeDescriptions": { "typeIdentifier": "t_uint48", "typeString": "uint48" } }, "visibility": "internal" } ], "name": "StakeInfo", "nameLocation": "654:9:63", "nodeType": "StructDefinition", "scope": 7698, "src": "647:203:63", "visibility": "public" }, { "functionSelector": "4c3371cd", "id": 7689, "implemented": false, "kind": "function", "modifiers": [], "name": "getInfo", "nameLocation": "865:7:63", "nodeType": "FunctionDefinition", "parameters": { "id": 7684, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 7683, "mutability": "mutable", "name": "id", "nameLocation": "880:2:63", "nodeType": "VariableDeclaration", "scope": 7689, "src": "873:9:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint96", "typeString": "uint96" }, "typeName": { "id": 7682, "name": "uint96", "nodeType": "ElementaryTypeName", "src": "873:6:63", "typeDescriptions": { "typeIdentifier": "t_uint96", "typeString": "uint96" } }, "visibility": "internal" } ], "src": "872:11:63" }, "returnParameters": { "id": 7688, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 7687, "mutability": "mutable", "name": "info", "nameLocation": "923:4:63", "nodeType": "VariableDeclaration", "scope": 7689, "src": "906:21:63", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_StakeInfo_$7681_memory_ptr", "typeString": "struct IStakingFacadeExt.StakeInfo" }, "typeName": { "id": 7686, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 7685, "name": "StakeInfo", "nodeType": "IdentifierPath", "referencedDeclaration": 7681, "src": "906:9:63" }, "referencedDeclaration": 7681, "src": "906:9:63", "typeDescriptions": { "typeIdentifier": "t_struct$_StakeInfo_$7681_storage_ptr", "typeString": "struct IStakingFacadeExt.StakeInfo" } }, "visibility": "internal" } ], "src": "905:23:63" }, "scope": 7698, "src": "856:73:63", "stateMutability": "view", "virtual": false, "visibility": "external" }, { "functionSelector": "f682f208", "id": 7697, "implemented": false, "kind": "function", "modifiers": [], "name": "calculateRewardsIncrement", "nameLocation": "943:25:63", "nodeType": "FunctionDefinition", "parameters": { "id": 7693, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 7692, "mutability": "mutable", "name": "stakeInfo", "nameLocation": "986:9:63", "nodeType": "VariableDeclaration", "scope": 7697, "src": "969:26:63", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_StakeInfo_$7681_memory_ptr", "typeString": "struct IStakingFacadeExt.StakeInfo" }, "typeName": { "id": 7691, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 7690, "name": "StakeInfo", "nodeType": "IdentifierPath", "referencedDeclaration": 7681, "src": "969:9:63" }, "referencedDeclaration": 7681, "src": "969:9:63", "typeDescriptions": { "typeIdentifier": "t_struct$_StakeInfo_$7681_storage_ptr", "typeString": "struct IStakingFacadeExt.StakeInfo" } }, "visibility": "internal" } ], "src": "968:28:63" }, "returnParameters": { "id": 7696, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 7695, "mutability": "mutable", "name": "rewardsAmount", "nameLocation": "1027:13:63", "nodeType": "VariableDeclaration", "scope": 7697, "src": "1019:21:63", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 7694, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1019:7:63", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "1018:23:63" }, "scope": 7698, "src": "934:108:63", "stateMutability": "view", "virtual": false, "visibility": "external" } ], "scope": 7699, "src": "594:450:63" } ], "src": "39:1005:63" }, "bytecode": "", "bytecodeSha1": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "compiler": { "evm_version": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "version": "0.8.2+commit.661d1103" }, "contractName": "IStakingFacadeExt", "coverageMap": { "branches": {}, "statements": {} }, "dependencies": [ "IChainNftFacade", "IChainRegistryFacade", "OpenZeppelin/openzeppelin-contracts@4.7.3/IERC20", "OpenZeppelin/openzeppelin-contracts@4.7.3/IERC20Metadata", "IStakingFacade" ], "deployedBytecode": "", "deployedSourceMap": "", "language": "Solidity", "natspec": { "kind": "dev", "methods": {}, "version": 1 }, "offset": [ 594, 1044 ], "opcodes": "", "pcMap": {}, "sha1": "7181d2aa72c779d9be64b75e43f99d4f4a698ddc", "source": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.2;\n\n/**\n * @dev this facade is intended for user contracts with limited \n * interactions with the actual contract and that need to work \n * with older solidity versions that do not support user defined \n * types.\n * \n * usage: \n * (1) copy this interface into your repository\n * (2) adapt the pragma to your needsd\n * (3) use it in your contracts, ie. cast actual contract \n * address to this interface, then usd the resulting facade \n * to interact with the actual contract\n */\n\nimport {IStakingFacade} from \"./IStakingFacade.sol\";\n\ninterface IStakingFacadeExt is IStakingFacade {\n\n struct StakeInfo {\n uint96 id;\n uint96 target;\n uint256 stakeBalance;\n uint256 rewardBalance;\n uint40 createdAt;\n uint40 updatedAt;\n uint48 version;\n }\n\n function getInfo(uint96 id) external view returns(StakeInfo memory info);\n function calculateRewardsIncrement(StakeInfo memory stakeInfo) external view returns(uint256 rewardsAmount);\n}", "sourceMap": "", "sourcePath": "contracts/staking/IStakingFacadeExt.sol", "type": "interface" }