Created
October 14, 2023 05:14
-
-
Save codinghistorian/19a635aa70b647ed42bd522cefa1299a to your computer and use it in GitHub Desktop.
Revisions
-
codinghistorian created this gist
Oct 14, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ { "overrides": [ { "files": "*.sol", "options": { "printWidth": 80, "tabWidth": 4, "useTabs": false, "singleQuote": false, "bracketSpacing": false } }, { "files": "*.yml", "options": {} }, { "files": "*.yaml", "options": {} }, { "files": "*.toml", "options": {} }, { "files": "*.json", "options": {} }, { "files": "*.js", "options": {} }, { "files": "*.ts", "options": {} } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ REMIX DEFAULT WORKSPACE Remix default workspace is present when: i. Remix loads for the very first time ii. A new workspace is created with 'Default' template iii. There are no files existing in the File Explorer This workspace contains 3 directories: 1. 'contracts': Holds three contracts with increasing levels of complexity. 2. 'scripts': Contains four typescript files to deploy a contract. It is explained below. 3. 'tests': Contains one Solidity test file for 'Ballot' contract & one JS test file for 'Storage' contract. SCRIPTS The 'scripts' folder has four typescript files which help to deploy the 'Storage' contract using 'web3.js' and 'ethers.js' libraries. For the deployment of any other contract, just update the contract's name from 'Storage' to the desired contract and provide constructor arguments accordingly in the file `deploy_with_ethers.ts` or `deploy_with_web3.ts` In the 'tests' folder there is a script containing Mocha-Chai unit tests for 'Storage' contract. To run a script, right click on file name in the file explorer and click 'Run'. Remember, Solidity file must already be compiled. Output from script will appear in remix terminal. Please note, require/import is supported in a limited manner for Remix supported modules. For now, modules supported by Remix are ethers, web3, swarmgw, chai, multihashes, remix and hardhat only for hardhat.ethers object/plugin. For unsupported modules, an error like this will be thrown: '<module_name> module require is not supported by Remix IDE' will be shown. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.2 <0.9.0; contract Example { function division(uint256 a, uint256 b) external pure returns (uint256) { return a / b; } //example 3 RAD divided by 1 RAY //3123456789123456789123456789123456789123456789 / } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.2 <0.9.0; contract Example { function _convertTo18(uint256 decimals, uint256 _amt) external pure returns (uint256 _wad) { _wad = decimals < 18 ? _amt * (10 ** (18 - decimals)) : _amt / (10 ** (decimals - 18)); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2093 @@ /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [////IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * ////IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount ) external returns (bool); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; ////import "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol"; // solhint-disable func-name-mixedcase interface IAccessControlConfig is IAccessControlUpgradeable { function OWNER_ROLE() external view returns (bytes32); function GOV_ROLE() external view returns (bytes32); function PRICE_ORACLE_ROLE() external view returns (bytes32); function ADAPTER_ROLE() external view returns (bytes32); function LIQUIDATION_ENGINE_ROLE() external view returns (bytes32); function STABILITY_FEE_COLLECTOR_ROLE() external view returns (bytes32); function SHOW_STOPPER_ROLE() external view returns (bytes32); function POSITION_MANAGER_ROLE() external view returns (bytes32); function MINTABLE_ROLE() external view returns (bytes32); function BOOK_KEEPER_ROLE() external view returns (bytes32); function COLLATERAL_MANAGER_ROLE() external view returns (bytes32); } // solhint-enable func-name-mixedcase /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface ICollateralPoolConfig { struct CollateralPool { uint256 totalDebtShare; // Total debt share of Fathom Stablecoin of this collateral pool [wad] uint256 debtAccumulatedRate; // Accumulated rates (equivalent to ibToken Price) [ray] uint256 priceWithSafetyMargin; // Price with safety margin (taken into account the Collateral Ratio) [ray] uint256 debtCeiling; // Debt ceiling of this collateral pool [rad] uint256 debtFloor; // Position debt floor of this collateral pool [rad] address priceFeed; // Price Feed uint256 liquidationRatio; // Liquidation ratio or Collateral ratio [ray] uint256 stabilityFeeRate; // Collateral-specific, per-second stability fee debtAccumulatedRate or mint interest debtAccumulatedRate [ray] uint256 lastAccumulationTime; // Time of last call to `collect` [unix epoch time] address adapter; uint256 closeFactorBps; // Percentage (BPS) of how much of debt could be liquidated in a single liquidation uint256 liquidatorIncentiveBps; // Percentage (BPS) of how much additional collateral will be given to the liquidator incentive uint256 treasuryFeesBps; // Percentage (BPS) of how much additional collateral will be transferred to the treasury address strategy; // Liquidation strategy for this collateral pool uint256 positionDebtCeiling; // position debt ceiling of this collateral pool [rad] } struct CollateralPoolInfo { uint256 debtAccumulatedRate; // [ray] uint256 totalDebtShare; // [wad] uint256 debtCeiling; // [rad] uint256 priceWithSafetyMargin; // [ray] uint256 debtFloor; // [rad] uint256 positionDebtCeiling; // [rad] } function setPriceWithSafetyMargin(bytes32 collateralPoolId, uint256 priceWithSafetyMargin) external; function setTotalDebtShare(bytes32 _collateralPoolId, uint256 _totalDebtShare) external; function setDebtAccumulatedRate(bytes32 _collateralPoolId, uint256 _debtAccumulatedRate) external; function setPositionDebtCeiling(bytes32 _collateralPoolId, uint256 _positionDebtCeiling) external; function updateLastAccumulationTime(bytes32 _collateralPoolId) external; function collateralPools(bytes32 _collateralPoolId) external view returns (CollateralPool memory); function getTotalDebtShare(bytes32 _collateralPoolId) external view returns (uint256); function getDebtAccumulatedRate(bytes32 _collateralPoolId) external view returns (uint256); function getPriceWithSafetyMargin(bytes32 _collateralPoolId) external view returns (uint256); function getDebtCeiling(bytes32 _collateralPoolId) external view returns (uint256); function getDebtFloor(bytes32 _collateralPoolId) external view returns (uint256); function getPositionDebtCeiling(bytes32 _collateralPoolId) external view returns (uint256); function getPriceFeed(bytes32 _collateralPoolId) external view returns (address); function getLiquidationRatio(bytes32 _collateralPoolId) external view returns (uint256); function getStabilityFeeRate(bytes32 _collateralPoolId) external view returns (uint256); function getLastAccumulationTime(bytes32 _collateralPoolId) external view returns (uint256); function getAdapter(bytes32 _collateralPoolId) external view returns (address); function getCloseFactorBps(bytes32 _collateralPoolId) external view returns (uint256); function getLiquidatorIncentiveBps(bytes32 _collateralPoolId) external view returns (uint256); function getTreasuryFeesBps(bytes32 _collateralPoolId) external view returns (uint256); function getStrategy(bytes32 _collateralPoolId) external view returns (address); function getCollateralPoolInfo(bytes32 _collateralPoolId) external view returns (CollateralPoolInfo memory); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; ////import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IStablecoin is IERC20 { event Rename(string name); function mint(address, uint256) external; function burn(address, uint256) external; function increaseAllowance(address, uint256) external returns (bool); function decreaseAllowance(address, uint256) external returns (bool); function rename(string memory) external; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; ////import "../interfaces/ICollateralPoolConfig.sol"; ////import "../interfaces/IAccessControlConfig.sol"; interface IBookKeeper { function addCollateral( bytes32 collateralPoolId, address ownerAddress, int256 amount // [wad] ) external; function movePosition(bytes32 collateralPoolId, address src, address dst, int256 collateralAmount, int256 debtShare) external; function adjustPosition( bytes32 collateralPoolId, address positionAddress, address collateralOwner, address stablecoinOwner, int256 collateralValue, int256 debtShare ) external; function totalStablecoinIssued() external returns (uint256); function moveStablecoin( address src, address dst, uint256 value // [rad] ) external; function moveCollateral( bytes32 collateralPoolId, address src, address dst, uint256 amount // [wad] ) external; function confiscatePosition( bytes32 collateralPoolId, address positionAddress, address collateralCreditor, address stablecoinDebtor, int256 collateralAmount, // [wad] int256 debtShare // [wad] ) external; function mintUnbackedStablecoin( address from, address to, uint256 value // [rad] ) external; function accrueStabilityFee( bytes32 collateralPoolId, address stabilityFeeRecipient, int256 debtAccumulatedRate // [ray] ) external; function settleSystemBadDebt(uint256 value) external; // [rad] function whitelist(address toBeWhitelistedAddress) external; function blacklist(address toBeBlacklistedAddress) external; function collateralToken(bytes32 collateralPoolId, address ownerAddress) external view returns (uint256); function positionWhitelist(address positionAddress, address whitelistedAddress) external view returns (uint256); function stablecoin(address ownerAddress) external view returns (uint256); function positions( bytes32 collateralPoolId, address positionAddress ) external view returns ( uint256 lockedCollateral, // [wad] uint256 debtShare // [wad] ); function systemBadDebt(address ownerAddress) external view returns (uint256); // [rad] function poolStablecoinIssued(bytes32 collateralPoolId) external view returns (uint256); // [rad] function collateralPoolConfig() external view returns (address); function accessControlConfig() external view returns (address); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [////IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * ////IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; ////import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; ////import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT pragma solidity 0.8.17; contract CommonMath { uint256 internal constant BLN = 10 ** 9; uint256 internal constant WAD = 10 ** 18; uint256 internal constant RAY = 10 ** 27; // one uint256 internal constant RAD = 10 ** 45; function add(uint256 x, int256 y) internal pure returns (uint256 z) { unchecked { z = x + uint256(y); } require(y >= 0 || z <= x); require(y <= 0 || z >= x); } function sub(uint256 x, int256 y) internal pure returns (uint256 z) { unchecked { z = x - uint256(y); } require(y <= 0 || z <= x); require(y >= 0 || z >= x); } function mul(uint256 x, int256 y) internal pure returns (int256 z) { unchecked { z = int256(x) * y; } require(int256(x) >= 0); require(y == 0 || z / y == int256(x)); } function divup(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { _z = (_x + _y - 1) / _y; } function rdiv(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { _z = (_x * RAY) / _y; } function wdiv(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { _z = (_x * WAD) / _y; } function wdivup(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { _z = divup(_x * WAD, _y); } function wmul(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { _z = (_x * _y) / WAD; } function rmul(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { _z = (_x * _y) / RAY; } function rmulup(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { _z = divup(_x * _y, RAY); } function min(uint256 _x, uint256 _y) internal pure returns (uint256 _z) { return _x <= _y ? _x : _y; } function diff(uint256 _x, uint256 _y) internal pure returns (int256 _z) { _z = int256(_x) - int256(_y); require(int256(_x) >= 0 && int256(_y) >= 0); } function both(bool _x, bool _y) internal pure returns (bool _z) { assembly { _z := and(_x, _y) } } function either(bool _x, bool _y) internal pure returns (bool _z) { assembly { _z := or(_x, _y) } } function rpow(uint256 x, uint256 n, uint256 b) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := b } default { z := 0 } } default { switch mod(n, 2) case 0 { z := b } default { z := x } let half := div(b, 2) // for rounding. for { n := div(n, 2) } n { n := div(n, 2) } { let xx := mul(x, x) if iszero(eq(div(xx, x), x)) { revert(0, 0) } let xxRound := add(xx, half) if lt(xxRound, xx) { revert(0, 0) } x := div(xxRound, b) if mod(n, 2) { let zx := mul(z, x) if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0, 0) } let zxRound := add(zx, half) if lt(zxRound, zx) { revert(0, 0) } z := div(zxRound, b) } } } } } function toRad(uint256 _wad) internal pure returns (uint256 _rad) { _rad = _wad * RAY; } } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT pragma solidity 0.8.17; ////import "@openzeppelin/contracts/utils/Address.sol"; interface ERC20Interface { function balanceOf(address user) external view returns (uint256); } library SafeToken { function myBalance(address token) internal view returns (uint256) { return ERC20Interface(token).balanceOf(address(this)); } function balanceOf(address token, address user) internal view returns (uint256) { return ERC20Interface(token).balanceOf(user); } function safeApprove(address token, address to, uint256 value) internal { require(Address.isContract(token), "safeApprove: non-contract address"); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); // bytes4(keccak256(bytes('approve(address,uint256)'))); require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeApprove"); } function safeTransfer(address token, address to, uint256 value) internal { require(Address.isContract(token), "safeTransfer: non-contract address"); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); // bytes4(keccak256(bytes('transfer(address,uint256)'))); require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeTransfer"); } function safeTransferFrom(address token, address from, address to, uint256 value) internal { require(Address.isContract(token), "safeTransferFrom: non-contract address"); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeTransferFrom"); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{ value: value }(new bytes(0)); require(success, "!safeTransferETH"); } } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT pragma solidity 0.8.17; interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; ////import "../interfaces/IBookKeeper.sol"; ////import "../interfaces/IStablecoin.sol"; interface IStablecoinAdapter { function bookKeeper() external returns (IBookKeeper); function stablecoin() external returns (IStablecoin); function deposit(address positionAddress, uint256 wad, bytes calldata data) external; function depositRAD(address positionAddress, uint256 rad, bytes calldata data) external; function withdraw(address positionAddress, uint256 wad, bytes calldata data) external; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface IGenericTokenAdapter { function decimals() external returns (uint256); function deposit(address positionAddress, uint256 wad, bytes calldata data) external; function withdraw(address positionAddress, uint256 wad, bytes calldata data) external; function emergencyWithdraw(address _to) external; function collateralToken() external returns (address); function collateralPoolId() external view returns (bytes32); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface IFlashLendingCallee { function flashLendingCall( address caller, uint256 debtValueToRepay, // [rad] uint256 collateralAmountToLiquidate, // [wad] bytes calldata ) external; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface ISystemDebtEngine { function settleSystemBadDebt(uint256 value) external; // [rad] function surplusBuffer() external view returns (uint256); // [rad] } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface ILiquidationStrategy { function execute( bytes32 collateralPoolId, uint256 positionDebtShare, // Debt Value [rad] uint256 positionCollateralAmount, // Collateral Amount [wad] address positionAddress, // Address that will receive any leftover collateral uint256 debtShareToBeLiquidated, // The value of debt to be liquidated as specified by the liquidator [wad] uint256 maxDebtShareToBeLiquidated, // The maximum value of debt to be liquidated as specified by the liquidator in case of full liquidation for slippage control [rad] address _liquidatorAddress, address collateralRecipient, bytes calldata data ) external; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface ILiquidationEngine { function liquidate( bytes32 _collateralPoolId, address _positionAddress, uint256 _debtShareToBeLiquidated, // [wad] uint256 _maxDebtShareToBeLiquidated, // [wad] address _collateralRecipient, bytes calldata data ) external; function liquidateForBatch( bytes32 _collateralPoolId, address _positionAddress, uint256 _debtShareToBeLiquidated, // [wad] uint256 _maxDebtShareToBeLiquidated, // [wad] address _collateralRecipient, bytes calldata data, address sender ) external; function batchLiquidate( bytes32[] calldata _collateralPoolIds, address[] calldata _positionAddresses, uint256[] calldata _debtShareToBeLiquidateds, // [wad] uint256[] calldata _maxDebtShareToBeLiquidateds, // [wad] address[] calldata _collateralRecipients, bytes[] calldata datas ) external; function live() external view returns (uint256); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface IPriceOracle { function stableCoinReferencePrice() external view returns (uint256); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; interface IPriceFeed { event LogSetPriceLife(address indexed _caller, uint256 _second); function peekPrice() external returns (uint256, bool); // [wad] function readPrice() external view returns (uint256); // [wad] function isPriceOk() external view returns (bool); function isPriceFresh() external view returns (bool); function poolId() external view returns (bytes32); } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; ////import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; ////import "../utils/ContextUpgradeable.sol"; ////import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } /** * SourceUnit: /Users/sangjun.lee/Sangjun/fathom-stablecoin-smart-contracts/contracts/main/stablecoin-core/liquidation-strategies/FixedSpreadLiquidationStrategy.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-or-later pragma solidity 0.8.17; ////import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; ////import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; ////import "../../interfaces/IBookKeeper.sol"; ////import "../../interfaces/IPriceFeed.sol"; ////import "../../interfaces/IPriceOracle.sol"; ////import "../../interfaces/ILiquidationEngine.sol"; ////import "../../interfaces/ILiquidationStrategy.sol"; ////import "../../interfaces/ISystemDebtEngine.sol"; ////import "../../interfaces/IFlashLendingCallee.sol"; ////import "../../interfaces/IGenericTokenAdapter.sol"; ////import "../../interfaces/IStablecoinAdapter.sol"; ////import "../../interfaces/IERC165.sol"; ////import "../../utils/SafeToken.sol"; ////import "../../utils/CommonMath.sol"; /** * @title FixedSpreadLiquidationStrategy * @notice A contract representing a fixed spread liquidation strategy. * This strategy is used for liquidating undercollateralized positions in a collateral pool. * The strategy calculates the amount of debt and collateral to be liquidated based on current market conditions. * @dev The FixedSpreadLiquidationStrategy contract implements the ILiquidationStrategy interface. */ contract FixedSpreadLiquidationStrategy is CommonMath, PausableUpgradeable, ReentrancyGuardUpgradeable, ILiquidationStrategy { using SafeToken for address; struct LiquidationInfo { uint256 positionDebtShare; // [wad] uint256 positionCollateralAmount; // [wad] uint256 debtShareToBeLiquidated; // [wad] uint256 maxDebtShareToBeLiquidated; // [wad] uint256 actualDebtValueToBeLiquidated; // [rad] uint256 actualDebtShareToBeLiquidated; // [wad] uint256 collateralAmountToBeLiquidated; // [wad] uint256 treasuryFees; // [wad] uint256 maxLiquidatableDebtShare; // [wad] } struct LocalVars { uint256 debtAccumulatedRate; // [ray] uint256 closeFactorBps; uint256 liquidatorIncentiveBps; uint256 debtFloor; // [rad] uint256 treasuryFeesBps; } IBookKeeper public bookKeeper; // Core CDP Engine ILiquidationEngine public liquidationEngine; // Liquidation module ISystemDebtEngine public systemDebtEngine; // Recipient of FUSD raised in auctions IPriceOracle public priceOracle; // Collateral price module IStablecoinAdapter public stablecoinAdapter; //StablecoinAdapter to deposit FXD to bookKeeper uint256 public flashLendingEnabled; bytes4 internal constant FLASH_LENDING_ID = 0xaf7bd142; event LogFixedSpreadLiquidate( bytes32 indexed _collateralPoolId, uint256 _positionDebtShare, uint256 _positionCollateralAmount, address indexed _positionAddress, uint256 _debtShareToBeLiquidated, uint256 _maxDebtShareToBeLiquidated, address indexed _liquidatorAddress, address _collateralRecipient, uint256 _actualDebtShareToBeLiquidated, uint256 _actualDebtValueToBeLiquidated, uint256 _collateralAmountToBeLiquidated, uint256 _treasuryFees ); event LogSetFlashLendingEnabled(address indexed caller, uint256 _flashLendingEnabled); modifier onlyOwnerOrGov() { IAccessControlConfig _accessControlConfig = IAccessControlConfig(bookKeeper.accessControlConfig()); require( _accessControlConfig.hasRole(_accessControlConfig.OWNER_ROLE(), msg.sender) || _accessControlConfig.hasRole(_accessControlConfig.GOV_ROLE(), msg.sender), "!(ownerRole or govRole)" ); _; } modifier onlyOwner() { IAccessControlConfig _accessControlConfig = IAccessControlConfig(bookKeeper.accessControlConfig()); require(_accessControlConfig.hasRole(_accessControlConfig.OWNER_ROLE(), msg.sender), "!ownerRole"); _; } /** * @notice Initializes the FixedSpreadLiquidationStrategy contract with required dependencies. * @param _bookKeeper The address of the BookKeeper contract. * @param _priceOracle The address of the PriceOracle contract. * @param _liquidationEngine The address of the LiquidationEngine contract. * @param _systemDebtEngine The address of the SystemDebtEngine contract. * @param _stablecoinAdapter The address of the StablecoinAdapter contract used for depositing FXD to the BookKeeper. * @dev Reverts if any of the input parameters are the zero address or invalid. */ function initialize( address _bookKeeper, address _priceOracle, address _liquidationEngine, address _systemDebtEngine, address _stablecoinAdapter ) external initializer { PausableUpgradeable.__Pausable_init(); ReentrancyGuardUpgradeable.__ReentrancyGuard_init(); require(IBookKeeper(_bookKeeper).totalStablecoinIssued() >= 0, "FixedSpreadLiquidationStrategy/invalid-bookKeeper"); // Sanity Check Call bookKeeper = IBookKeeper(_bookKeeper); require(IPriceOracle(_priceOracle).stableCoinReferencePrice() >= 0, "FixedSpreadLiquidationStrategy/invalid-priceOracle"); // Sanity Check Call priceOracle = IPriceOracle(_priceOracle); require(ILiquidationEngine(_liquidationEngine).live() == 1, "FixedSpreadLiquidationStrategy/liquidationEngine-not-live"); // Sanity Check Call liquidationEngine = ILiquidationEngine(_liquidationEngine); require(ISystemDebtEngine(_systemDebtEngine).surplusBuffer() >= 0, "FixedSpreadLiquidationStrategy/invalid-systemDebtEngine"); // Sanity Check Call systemDebtEngine = ISystemDebtEngine(_systemDebtEngine); require( address(IStablecoinAdapter(_stablecoinAdapter).stablecoin()) != address(0), "FixedSpreadLiquidationStrategy/invalid-stablecoinAdapter" ); // Sanity Check Call stablecoinAdapter = IStablecoinAdapter(_stablecoinAdapter); //StablecoinAdapter to deposit FXD to bookKeeper } /// @dev access: OWNER_ROLE, GOV_ROLE function pause() external onlyOwnerOrGov { _pause(); } /// @dev access: OWNER_ROLE, GOV_ROLE function unpause() external onlyOwnerOrGov { _unpause(); } /** * @notice Sets the flash lending feature to enabled or disabled. * @param _flashLendingEnabled The value indicating whether flash lending should be enabled (1) or disabled (0). * @dev This function can only be called by the contract owner or governance. * @dev Emits a LogSetFlashLendingEnabled event upon a successful update. */ function setFlashLendingEnabled(uint256 _flashLendingEnabled) external onlyOwnerOrGov { flashLendingEnabled = _flashLendingEnabled; emit LogSetFlashLendingEnabled(msg.sender, _flashLendingEnabled); } // solhint-disable function-max-lines function execute( bytes32 _collateralPoolId, uint256 _positionDebtShare, // positionDebtShare [wad] uint256 _positionCollateralAmount, // positionLockedCollateral [wad] address _positionAddress, // Address that will receive any leftover collateral uint256 _debtShareToBeLiquidated, // The value of debt to be liquidated as specified by the liquidator [wad] uint256 _maxDebtShareToBeLiquidated, // The maximum value of debt to be liquidated as specified by the liquidator in case of full liquidation for slippage control [wad] address _liquidatorAddress, address _collateralRecipient, bytes calldata _data // Data to pass in external call; if length 0, no call is done ) external override nonReentrant whenNotPaused { require( IAccessControlConfig(bookKeeper.accessControlConfig()).hasRole( IAccessControlConfig(bookKeeper.accessControlConfig()).LIQUIDATION_ENGINE_ROLE(), msg.sender ), "!liquidationEngingRole" ); require(_positionDebtShare > 0, "FixedSpreadLiquidationStrategy/zero-debt"); require(_positionCollateralAmount > 0, "FixedSpreadLiquidationStrategy/zero-collateral-amount"); require(_positionAddress != address(0), "FixedSpreadLiquidationStrategy/zero-position-address"); uint256 _currentCollateralPrice = getFeedPrice(_collateralPoolId); // [ray] require(_currentCollateralPrice > 0, "FixedSpreadLiquidationStrategy/zero-collateral-price"); LiquidationInfo memory info = _calculateLiquidationInfo( _collateralPoolId, _debtShareToBeLiquidated, _currentCollateralPrice, _positionCollateralAmount, _positionDebtShare ); require( info.actualDebtShareToBeLiquidated <= _maxDebtShareToBeLiquidated, "FixedSpreadLiquidationStrategy/exceed-max-debt-value-to-be-liquidated" ); require( info.collateralAmountToBeLiquidated < 2 ** 255 && info.actualDebtShareToBeLiquidated < 2 ** 255, "FixedSpreadLiquidationStrategy/overflow" ); bookKeeper.confiscatePosition( _collateralPoolId, _positionAddress, address(this), address(systemDebtEngine), -int256(info.collateralAmountToBeLiquidated), -int256(info.actualDebtShareToBeLiquidated) ); IGenericTokenAdapter _adapter = IGenericTokenAdapter(ICollateralPoolConfig(bookKeeper.collateralPoolConfig()).getAdapter(_collateralPoolId)); if (info.treasuryFees > 0) { bookKeeper.moveCollateral(_collateralPoolId, address(this), address(systemDebtEngine), info.treasuryFees); } if ( flashLendingEnabled == 1 && _data.length > 0 && _collateralRecipient != address(bookKeeper) && _collateralRecipient != address(liquidationEngine) && IERC165(_collateralRecipient).supportsInterface(FLASH_LENDING_ID) ) { //there should be ERC165 function selector check added to above condition bookKeeper.moveCollateral( _collateralPoolId, address(this), _collateralRecipient, info.collateralAmountToBeLiquidated - info.treasuryFees ); IFlashLendingCallee(_collateralRecipient).flashLendingCall( msg.sender, info.actualDebtValueToBeLiquidated, info.collateralAmountToBeLiquidated - info.treasuryFees, _data ); } else { _adapter.withdraw(_collateralRecipient, info.collateralAmountToBeLiquidated - info.treasuryFees, abi.encode(0)); address _stablecoin = address(stablecoinAdapter.stablecoin()); _stablecoin.safeTransferFrom(_liquidatorAddress, address(this), ((info.actualDebtValueToBeLiquidated / RAY) + 1)); _stablecoin.safeApprove(address(stablecoinAdapter), ((info.actualDebtValueToBeLiquidated / RAY) + 1)); stablecoinAdapter.depositRAD(_liquidatorAddress, info.actualDebtValueToBeLiquidated, abi.encode(0)); } bookKeeper.moveStablecoin(_liquidatorAddress, address(systemDebtEngine), info.actualDebtValueToBeLiquidated); info.positionDebtShare = _positionDebtShare; info.positionCollateralAmount = _positionCollateralAmount; info.debtShareToBeLiquidated = _debtShareToBeLiquidated; info.maxDebtShareToBeLiquidated = _maxDebtShareToBeLiquidated; emit LogFixedSpreadLiquidate( _collateralPoolId, info.positionDebtShare, info.positionCollateralAmount, _positionAddress, info.debtShareToBeLiquidated, info.maxDebtShareToBeLiquidated, _liquidatorAddress, _collateralRecipient, info.actualDebtShareToBeLiquidated, info.actualDebtValueToBeLiquidated, info.collateralAmountToBeLiquidated, info.treasuryFees ); } // solhint-enable function-max-lines function setPriceOracle(address _priceOracle) external onlyOwner { require(IPriceOracle(_priceOracle).stableCoinReferencePrice() >= 0, "FixedSpreadLiquidationStrategy/invalid-priceOracle"); // Sanity Check Call priceOracle = IPriceOracle(_priceOracle); } function setBookKeeper(address _bookKeeper) external onlyOwner { require(IBookKeeper(_bookKeeper).totalStablecoinIssued() >= 0, "FixedSpreadLiquidationStrategy/invalid-bookKeeper"); // Sanity Check Call bookKeeper = IBookKeeper(_bookKeeper); } function setLiquidationEngine(address _liquidationEngine) external onlyOwner { require(ILiquidationEngine(_liquidationEngine).live() == 1, "FixedSpreadLiquidationStrategy/liquidationEngine-not-live"); // Sanity Check Call liquidationEngine = ILiquidationEngine(_liquidationEngine); } function getFeedPrice(bytes32 collateralPoolId) internal returns (uint256 feedPrice) { address _priceFeedAddress = ICollateralPoolConfig(bookKeeper.collateralPoolConfig()).getPriceFeed(collateralPoolId); IPriceFeed _priceFeed = IPriceFeed(_priceFeedAddress); (uint256 price, bool priceOk) = _priceFeed.peekPrice(); require(priceOk, "FixedSpreadLiquidationStrategy/invalid-price"); // (price [wad] * BLN [10 ** 9] ) [ray] / priceOracle.stableCoinReferencePrice [ray] feedPrice = rdiv(price * BLN, priceOracle.stableCoinReferencePrice()); // [ray] } // solhint-disable function-max-lines function _calculateLiquidationInfo( bytes32 _collateralPoolId, uint256 _debtShareToBeLiquidated, uint256 _currentCollateralPrice, uint256 _positionCollateralAmount, uint256 _positionDebtShare ) internal view returns (LiquidationInfo memory info) { LocalVars memory _vars; _vars.debtAccumulatedRate = ICollateralPoolConfig(bookKeeper.collateralPoolConfig()).getDebtAccumulatedRate(_collateralPoolId); // [ray] _vars.closeFactorBps = ICollateralPoolConfig(bookKeeper.collateralPoolConfig()).getCloseFactorBps(_collateralPoolId); _vars.liquidatorIncentiveBps = ICollateralPoolConfig(bookKeeper.collateralPoolConfig()).getLiquidatorIncentiveBps(_collateralPoolId); _vars.debtFloor = ICollateralPoolConfig(bookKeeper.collateralPoolConfig()).getDebtFloor(_collateralPoolId); // [rad] _vars.treasuryFeesBps = ICollateralPoolConfig(bookKeeper.collateralPoolConfig()).getTreasuryFeesBps(_collateralPoolId); uint256 _positionDebtValue = _positionDebtShare * _vars.debtAccumulatedRate; require(_vars.closeFactorBps > 0, "FixedSpreadLiquidationStrategy/close-factor-bps-not-set"); info.maxLiquidatableDebtShare = (_positionDebtShare * _vars.closeFactorBps) / 10000; // [wad] info.actualDebtShareToBeLiquidated = _debtShareToBeLiquidated > info.maxLiquidatableDebtShare ? info.maxLiquidatableDebtShare : _debtShareToBeLiquidated; // [wad] info.actualDebtValueToBeLiquidated = info.actualDebtShareToBeLiquidated * _vars.debtAccumulatedRate; // [rad] uint256 _maxCollateralAmountToBeLiquidated = ((info.actualDebtValueToBeLiquidated * _vars.liquidatorIncentiveBps) / 10000) / _currentCollateralPrice; // [wad] if ( _maxCollateralAmountToBeLiquidated > _positionCollateralAmount || (_positionCollateralAmount - _maxCollateralAmountToBeLiquidated) * _currentCollateralPrice < _positionDebtValue - info.actualDebtValueToBeLiquidated ) { info.collateralAmountToBeLiquidated = _positionCollateralAmount; info.actualDebtValueToBeLiquidated = (_currentCollateralPrice * _positionCollateralAmount * 10000) / _vars.liquidatorIncentiveBps; // [rad] } else { if ( _positionDebtValue > info.actualDebtValueToBeLiquidated && _positionDebtValue - info.actualDebtValueToBeLiquidated < _vars.debtFloor ) { info.actualDebtValueToBeLiquidated = _positionDebtValue; // [rad] info.collateralAmountToBeLiquidated = ((info.actualDebtValueToBeLiquidated * _vars.liquidatorIncentiveBps) / 10000) / _currentCollateralPrice; // [wad] } else { info.collateralAmountToBeLiquidated = _maxCollateralAmountToBeLiquidated; // [wad] } } info.actualDebtShareToBeLiquidated = info.actualDebtValueToBeLiquidated / _vars.debtAccumulatedRate; // [wad] // collateralAmountToBeLiquidated - (collateralAmountToBeLiquidated * 10000 / liquidatorIncentiveBps) // 1 - (1 * 10000 / 10500) = 0.047619048 which is roughly around 0.05 uint256 liquidatorIncentiveCollectedFromPosition = info.collateralAmountToBeLiquidated - (info.collateralAmountToBeLiquidated * 10000 / _vars.liquidatorIncentiveBps); // [wad] // liquidatorIncentiveCollectedFromPosition * (treasuryFeesBps) / 10000 // 0.047619048 * 5000 / 10000 info.treasuryFees = (liquidatorIncentiveCollectedFromPosition * _vars.treasuryFeesBps) / 10000; // [wad] } // solhint-enable function-max-lines } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,75 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122020f645138bbc5d743fbe07f7908a97626039f4089ba9b282a28d8b1a32c3e02b64736f6c63430008110033", "opcodes": "PUSH1 0x56 PUSH1 0x37 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x2A JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 KECCAK256 0xF6 GASLIMIT SGT DUP12 0xBC 0x5D PUSH21 0x3FBE07F7908A97626039F4089BA9B282A28D8B1A32 0xC3 0xE0 0x2B PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ", "sourceMap": "411:8972:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;411:8972:0;;;;;;;;;;;;;;;;;" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122020f645138bbc5d743fbe07f7908a97626039f4089ba9b282a28d8b1a32c3e02b64736f6c63430008110033", "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 KECCAK256 0xF6 GASLIMIT SGT DUP12 0xBC 0x5D PUSH21 0x3FBE07F7908A97626039F4089BA9B282A28D8B1A32 0xC3 0xE0 0x2B PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ", "sourceMap": "411:8972:0:-:0;;;;;;;;" }, "gasEstimates": { "creation": { "codeDepositCost": "17200", "executionCost": "103", "totalCost": "17303" }, "internal": { "_revert(bytes memory,string memory)": "infinite", "functionCall(address,bytes memory)": "infinite", "functionCall(address,bytes memory,string memory)": "infinite", "functionCallWithValue(address,bytes memory,uint256)": "infinite", "functionCallWithValue(address,bytes memory,uint256,string memory)": "infinite", "functionDelegateCall(address,bytes memory)": "infinite", "functionDelegateCall(address,bytes memory,string memory)": "infinite", "functionStaticCall(address,bytes memory)": "infinite", "functionStaticCall(address,bytes memory,string memory)": "infinite", "isContract(address)": "infinite", "sendValue(address payable,uint256)": "infinite", "verifyCallResult(bool,bytes memory,string memory)": "infinite", "verifyCallResultFromTarget(address,bool,bytes memory,string memory)": "infinite" } }, "methodIdentifiers": {} }, "abi": [] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212204124a875d9b5b610d13cb298ac67ae205ff0e4b0902c80d4fe58f438c3b4c5de64736f6c63430008110033", "opcodes": "PUSH1 0x56 PUSH1 0x37 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x2A JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 COINBASE 0x24 0xA8 PUSH22 0xD9B5B610D13CB298AC67AE205FF0E4B0902C80D4FE58 DELEGATECALL CODESIZE 0xC3 0xB4 0xC5 0xDE PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ", "sourceMap": "25148:8095:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;25148:8095:0;;;;;;;;;;;;;;;;;" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212204124a875d9b5b610d13cb298ac67ae205ff0e4b0902c80d4fe58f438c3b4c5de64736f6c63430008110033", "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 COINBASE 0x24 0xA8 PUSH22 0xD9B5B610D13CB298AC67AE205FF0E4B0902C80D4FE58 DELEGATECALL CODESIZE 0xC3 0xB4 0xC5 0xDE PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ", "sourceMap": "25148:8095:0:-:0;;;;;;;;" }, "gasEstimates": { "creation": { "codeDepositCost": "17200", "executionCost": "103", "totalCost": "17303" }, "internal": { "_revert(bytes memory,string memory)": "infinite", "functionCall(address,bytes memory)": "infinite", "functionCall(address,bytes memory,string memory)": "infinite", "functionCallWithValue(address,bytes memory,uint256)": "infinite", "functionCallWithValue(address,bytes memory,uint256,string memory)": "infinite", "functionStaticCall(address,bytes memory)": "infinite", "functionStaticCall(address,bytes memory,string memory)": "infinite", "isContract(address)": "infinite", "sendValue(address payable,uint256)": "infinite", "verifyCallResult(bool,bytes memory,string memory)": "infinite", "verifyCallResultFromTarget(address,bool,bytes memory,string memory)": "infinite" } }, "methodIdentifiers": {} }, "abi": [] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [], "devdoc": { "details": "Collection of functions related to the address type", "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "AddressUpgradeable" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [], "devdoc": { "details": "Collection of functions related to the address type", "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "Address" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,78 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220b2201884e33181fb17a82c9370eeb59625d756d6ad023277c9fd1f5d44d3c8ac64736f6c63430008110033", "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x3F DUP1 PUSH1 0x1D PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xB2 KECCAK256 XOR DUP5 0xE3 BALANCE DUP2 0xFB OR 0xA8 0x2C SWAP4 PUSH17 0xEEB59625D756D6AD023277C9FD1F5D44D3 0xC8 0xAC PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ", "sourceMap": "41943:3922:0:-:0;;;;;;;;;;;;;;;;;;;" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "6080604052600080fdfea2646970667358221220b2201884e33181fb17a82c9370eeb59625d756d6ad023277c9fd1f5d44d3c8ac64736f6c63430008110033", "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xB2 KECCAK256 XOR DUP5 0xE3 BALANCE DUP2 0xFB OR 0xA8 0x2C SWAP4 PUSH17 0xEEB59625D756D6AD023277C9FD1F5D44D3 0xC8 0xAC PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ", "sourceMap": "41943:3922:0:-:0;;;;;" }, "gasEstimates": { "creation": { "codeDepositCost": "12600", "executionCost": "66", "totalCost": "12666" }, "internal": { "add(uint256,int256)": "infinite", "both(bool,bool)": "infinite", "diff(uint256,uint256)": "infinite", "divup(uint256,uint256)": "infinite", "either(bool,bool)": "infinite", "min(uint256,uint256)": "infinite", "mul(uint256,int256)": "infinite", "rdiv(uint256,uint256)": "infinite", "rmul(uint256,uint256)": "infinite", "rmulup(uint256,uint256)": "infinite", "rpow(uint256,uint256,uint256)": "infinite", "sub(uint256,int256)": "infinite", "toRad(uint256)": "infinite", "wdiv(uint256,uint256)": "infinite", "wdivup(uint256,uint256)": "infinite", "wmul(uint256,uint256)": "infinite" } }, "methodIdentifiers": {} }, "abi": [] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "CommonMath" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": {} }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" } ], "devdoc": { "details": "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.", "kind": "dev", "methods": {}, "stateVariables": { "__gap": { "details": "This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps" } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "ContextUpgradeable" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,76 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "balanceOf(address)": "70a08231" } }, "abi": [ { "inputs": [ { "internalType": "address", "name": "user", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "address", "name": "user", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "ERC20Interface" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ { "compiler": { "version": "0.8.18+commit.87f61d96" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "uint256", "name": "_amt", "type": "uint256" } ], "name": "_convertTo18", "outputs": [ { "internalType": "uint256", "name": "_wad", "type": "uint256" } ], "stateMutability": "pure", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/2_convert.sol": "Example" }, "evmVersion": "paris", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": false, "runs": 200 }, "remappings": [] }, "sources": { "contracts/2_convert.sol": { "keccak256": "0x9b3128b4e70cdb8dee91095d524a16b3d9dc62007d713946507bf642deffb770", "license": "GPL-3.0", "urls": [ "bzz-raw://a78223283abd08bdb5f4d03538c659762392bc38c9e9bd54142651f8ba704275", "dweb:/ipfs/QmTUyQfUWmE9K4zTf3JQhr2N652xcp6f3bjxR87RArZcff" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,461 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "indexed": false, "internalType": "uint256", "name": "_positionDebtShare", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_positionCollateralAmount", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "_positionAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_debtShareToBeLiquidated", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_maxDebtShareToBeLiquidated", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "_liquidatorAddress", "type": "address" }, { "indexed": false, "internalType": "address", "name": "_collateralRecipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_actualDebtShareToBeLiquidated", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_actualDebtValueToBeLiquidated", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_collateralAmountToBeLiquidated", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_treasuryFees", "type": "uint256" } ], "name": "LogFixedSpreadLiquidate", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_flashLendingEnabled", "type": "uint256" } ], "name": "LogSetFlashLendingEnabled", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Unpaused", "type": "event" }, { "inputs": [], "name": "bookKeeper", "outputs": [ { "internalType": "contract IBookKeeper", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "_positionDebtShare", "type": "uint256" }, { "internalType": "uint256", "name": "_positionCollateralAmount", "type": "uint256" }, { "internalType": "address", "name": "_positionAddress", "type": "address" }, { "internalType": "uint256", "name": "_debtShareToBeLiquidated", "type": "uint256" }, { "internalType": "uint256", "name": "_maxDebtShareToBeLiquidated", "type": "uint256" }, { "internalType": "address", "name": "_liquidatorAddress", "type": "address" }, { "internalType": "address", "name": "_collateralRecipient", "type": "address" }, { "internalType": "bytes", "name": "_data", "type": "bytes" } ], "name": "execute", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "flashLendingEnabled", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_bookKeeper", "type": "address" }, { "internalType": "address", "name": "_priceOracle", "type": "address" }, { "internalType": "address", "name": "_liquidationEngine", "type": "address" }, { "internalType": "address", "name": "_systemDebtEngine", "type": "address" }, { "internalType": "address", "name": "_stablecoinAdapter", "type": "address" } ], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "liquidationEngine", "outputs": [ { "internalType": "contract ILiquidationEngine", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "priceOracle", "outputs": [ { "internalType": "contract IPriceOracle", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_bookKeeper", "type": "address" } ], "name": "setBookKeeper", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_flashLendingEnabled", "type": "uint256" } ], "name": "setFlashLendingEnabled", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_liquidationEngine", "type": "address" } ], "name": "setLiquidationEngine", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_priceOracle", "type": "address" } ], "name": "setPriceOracle", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "stablecoinAdapter", "outputs": [ { "internalType": "contract IStablecoinAdapter", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "systemDebtEngine", "outputs": [ { "internalType": "contract ISystemDebtEngine", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "details": "The FixedSpreadLiquidationStrategy contract implements the ILiquidationStrategy interface.", "kind": "dev", "methods": { "initialize(address,address,address,address,address)": { "details": "Reverts if any of the input parameters are the zero address or invalid.", "params": { "_bookKeeper": "The address of the BookKeeper contract.", "_liquidationEngine": "The address of the LiquidationEngine contract.", "_priceOracle": "The address of the PriceOracle contract.", "_stablecoinAdapter": "The address of the StablecoinAdapter contract used for depositing FXD to the BookKeeper.", "_systemDebtEngine": "The address of the SystemDebtEngine contract." } }, "pause()": { "details": "access: OWNER_ROLE, GOV_ROLE" }, "paused()": { "details": "Returns true if the contract is paused, and false otherwise." }, "setFlashLendingEnabled(uint256)": { "details": "This function can only be called by the contract owner or governance.Emits a LogSetFlashLendingEnabled event upon a successful update.", "params": { "_flashLendingEnabled": "The value indicating whether flash lending should be enabled (1) or disabled (0)." } }, "unpause()": { "details": "access: OWNER_ROLE, GOV_ROLE" } }, "title": "FixedSpreadLiquidationStrategy", "version": 1 }, "userdoc": { "kind": "user", "methods": { "initialize(address,address,address,address,address)": { "notice": "Initializes the FixedSpreadLiquidationStrategy contract with required dependencies." }, "setFlashLendingEnabled(uint256)": { "notice": "Sets the flash lending feature to enabled or disabled." } }, "notice": "A contract representing a fixed spread liquidation strategy. This strategy is used for liquidating undercollateralized positions in a collateral pool. The strategy calculates the amount of debt and collateral to be liquidated based on current market conditions.", "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "FixedSpreadLiquidationStrategy" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,387 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "ADAPTER_ROLE()": "02a882e6", "BOOK_KEEPER_ROLE()": "6792166f", "COLLATERAL_MANAGER_ROLE()": "2e718ab7", "GOV_ROLE()": "b536818a", "LIQUIDATION_ENGINE_ROLE()": "e8ff193d", "MINTABLE_ROLE()": "08e45bc5", "OWNER_ROLE()": "e58378bb", "POSITION_MANAGER_ROLE()": "6e19aa59", "PRICE_ORACLE_ROLE()": "b998902f", "SHOW_STOPPER_ROLE()": "d7a47a69", "STABILITY_FEE_COLLECTOR_ROLE()": "23868800", "getRoleAdmin(bytes32)": "248a9ca3", "grantRole(bytes32,address)": "2f2ff15d", "hasRole(bytes32,address)": "91d14854", "renounceRole(bytes32,address)": "36568abe", "revokeRole(bytes32,address)": "d547741f" } }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } ], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleRevoked", "type": "event" }, { "inputs": [], "name": "ADAPTER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "BOOK_KEEPER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "COLLATERAL_MANAGER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "GOV_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "LIQUIDATION_ENGINE_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MINTABLE_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "OWNER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "POSITION_MANAGER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "PRICE_ORACLE_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SHOW_STOPPER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "STABILITY_FEE_COLLECTOR_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" } ], "name": "getRoleAdmin", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "hasRole", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,376 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } ], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleRevoked", "type": "event" }, { "inputs": [], "name": "ADAPTER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "BOOK_KEEPER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "COLLATERAL_MANAGER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "GOV_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "LIQUIDATION_ENGINE_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MINTABLE_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "OWNER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "POSITION_MANAGER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "PRICE_ORACLE_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SHOW_STOPPER_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "STABILITY_FEE_COLLECTOR_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" } ], "name": "getRoleAdmin", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "hasRole", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": { "getRoleAdmin(bytes32)": { "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}." }, "grantRole(bytes32,address)": { "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role." }, "hasRole(bytes32,address)": { "details": "Returns `true` if `account` has been granted `role`." }, "renounceRole(bytes32,address)": { "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`." }, "revokeRole(bytes32,address)": { "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IAccessControlConfig" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,233 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "getRoleAdmin(bytes32)": "248a9ca3", "grantRole(bytes32,address)": "2f2ff15d", "hasRole(bytes32,address)": "91d14854", "renounceRole(bytes32,address)": "36568abe", "revokeRole(bytes32,address)": "d547741f" } }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } ], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleRevoked", "type": "event" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" } ], "name": "getRoleAdmin", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "hasRole", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,245 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } ], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleRevoked", "type": "event" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" } ], "name": "getRoleAdmin", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "hasRole", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "details": "External interface of AccessControl declared to support ERC165 detection.", "events": { "RoleAdminChanged(bytes32,bytes32,bytes32)": { "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" }, "RoleGranted(bytes32,address,address)": { "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." }, "RoleRevoked(bytes32,address,address)": { "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)" } }, "kind": "dev", "methods": { "getRoleAdmin(bytes32)": { "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}." }, "grantRole(bytes32,address)": { "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role." }, "hasRole(bytes32,address)": { "details": "Returns `true` if `account` has been granted `role`." }, "renounceRole(bytes32,address)": { "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`." }, "revokeRole(bytes32,address)": { "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IAccessControlUpgradeable" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,517 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "accessControlConfig()": "c8cc243f", "accrueStabilityFee(bytes32,address,int256)": "90d53639", "addCollateral(bytes32,address,int256)": "d295927a", "adjustPosition(bytes32,address,address,address,int256,int256)": "56bd594a", "blacklist(address)": "f9f92be4", "collateralPoolConfig()": "d8682461", "collateralToken(bytes32,address)": "f8be242c", "confiscatePosition(bytes32,address,address,address,int256,int256)": "b1df2594", "mintUnbackedStablecoin(address,address,uint256)": "6a321151", "moveCollateral(bytes32,address,address,uint256)": "b5d99329", "movePosition(bytes32,address,address,int256,int256)": "03ab9076", "moveStablecoin(address,address,uint256)": "8c157854", "poolStablecoinIssued(bytes32)": "d0c26ff1", "positionWhitelist(address,address)": "d9ea9155", "positions(bytes32,address)": "29d88594", "settleSystemBadDebt(uint256)": "815110ec", "stablecoin(address)": "b4ac08bb", "systemBadDebt(address)": "e137ddc5", "totalStablecoinIssued()": "6f3a3bfc", "whitelist(address)": "9b19251a" } }, "abi": [ { "inputs": [], "name": "accessControlConfig", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "stabilityFeeRecipient", "type": "address" }, { "internalType": "int256", "name": "debtAccumulatedRate", "type": "int256" } ], "name": "accrueStabilityFee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "ownerAddress", "type": "address" }, { "internalType": "int256", "name": "amount", "type": "int256" } ], "name": "addCollateral", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "address", "name": "collateralOwner", "type": "address" }, { "internalType": "address", "name": "stablecoinOwner", "type": "address" }, { "internalType": "int256", "name": "collateralValue", "type": "int256" }, { "internalType": "int256", "name": "debtShare", "type": "int256" } ], "name": "adjustPosition", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "toBeBlacklistedAddress", "type": "address" } ], "name": "blacklist", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "collateralPoolConfig", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "ownerAddress", "type": "address" } ], "name": "collateralToken", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "address", "name": "collateralCreditor", "type": "address" }, { "internalType": "address", "name": "stablecoinDebtor", "type": "address" }, { "internalType": "int256", "name": "collateralAmount", "type": "int256" }, { "internalType": "int256", "name": "debtShare", "type": "int256" } ], "name": "confiscatePosition", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "mintUnbackedStablecoin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "moveCollateral", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "int256", "name": "collateralAmount", "type": "int256" }, { "internalType": "int256", "name": "debtShare", "type": "int256" } ], "name": "movePosition", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "moveStablecoin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" } ], "name": "poolStablecoinIssued", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "address", "name": "whitelistedAddress", "type": "address" } ], "name": "positionWhitelist", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "positionAddress", "type": "address" } ], "name": "positions", "outputs": [ { "internalType": "uint256", "name": "lockedCollateral", "type": "uint256" }, { "internalType": "uint256", "name": "debtShare", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "settleSystemBadDebt", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "ownerAddress", "type": "address" } ], "name": "stablecoin", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "ownerAddress", "type": "address" } ], "name": "systemBadDebt", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalStablecoinIssued", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "toBeWhitelistedAddress", "type": "address" } ], "name": "whitelist", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,486 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [], "name": "accessControlConfig", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "stabilityFeeRecipient", "type": "address" }, { "internalType": "int256", "name": "debtAccumulatedRate", "type": "int256" } ], "name": "accrueStabilityFee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "ownerAddress", "type": "address" }, { "internalType": "int256", "name": "amount", "type": "int256" } ], "name": "addCollateral", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "address", "name": "collateralOwner", "type": "address" }, { "internalType": "address", "name": "stablecoinOwner", "type": "address" }, { "internalType": "int256", "name": "collateralValue", "type": "int256" }, { "internalType": "int256", "name": "debtShare", "type": "int256" } ], "name": "adjustPosition", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "toBeBlacklistedAddress", "type": "address" } ], "name": "blacklist", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "collateralPoolConfig", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "ownerAddress", "type": "address" } ], "name": "collateralToken", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "address", "name": "collateralCreditor", "type": "address" }, { "internalType": "address", "name": "stablecoinDebtor", "type": "address" }, { "internalType": "int256", "name": "collateralAmount", "type": "int256" }, { "internalType": "int256", "name": "debtShare", "type": "int256" } ], "name": "confiscatePosition", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "mintUnbackedStablecoin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "moveCollateral", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "int256", "name": "collateralAmount", "type": "int256" }, { "internalType": "int256", "name": "debtShare", "type": "int256" } ], "name": "movePosition", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "moveStablecoin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" } ], "name": "poolStablecoinIssued", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "address", "name": "whitelistedAddress", "type": "address" } ], "name": "positionWhitelist", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "positionAddress", "type": "address" } ], "name": "positions", "outputs": [ { "internalType": "uint256", "name": "lockedCollateral", "type": "uint256" }, { "internalType": "uint256", "name": "debtShare", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "settleSystemBadDebt", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "ownerAddress", "type": "address" } ], "name": "stablecoin", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "ownerAddress", "type": "address" } ], "name": "systemBadDebt", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalStablecoinIssued", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "toBeWhitelistedAddress", "type": "address" } ], "name": "whitelist", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IBookKeeper" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,595 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "collateralPools(bytes32)": "d97a3649", "getAdapter(bytes32)": "8272e138", "getCloseFactorBps(bytes32)": "e73bbc79", "getCollateralPoolInfo(bytes32)": "1204769e", "getDebtAccumulatedRate(bytes32)": "a09b0fe0", "getDebtCeiling(bytes32)": "ad41d85d", "getDebtFloor(bytes32)": "9c1985d5", "getLastAccumulationTime(bytes32)": "bbd112a5", "getLiquidationRatio(bytes32)": "44d0c937", "getLiquidatorIncentiveBps(bytes32)": "0ec057e5", "getPositionDebtCeiling(bytes32)": "40aa66ab", "getPriceFeed(bytes32)": "8c0adf62", "getPriceWithSafetyMargin(bytes32)": "8c492d07", "getStabilityFeeRate(bytes32)": "1fea158d", "getStrategy(bytes32)": "28c84bbd", "getTotalDebtShare(bytes32)": "7a8bd02e", "getTreasuryFeesBps(bytes32)": "73a4f962", "setDebtAccumulatedRate(bytes32,uint256)": "e47f3c6f", "setPositionDebtCeiling(bytes32,uint256)": "2fa79780", "setPriceWithSafetyMargin(bytes32,uint256)": "be7c9f32", "setTotalDebtShare(bytes32,uint256)": "b3b1cfa2", "updateLastAccumulationTime(bytes32)": "e73eb92e" } }, "abi": [ { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "collateralPools", "outputs": [ { "components": [ { "internalType": "uint256", "name": "totalDebtShare", "type": "uint256" }, { "internalType": "uint256", "name": "debtAccumulatedRate", "type": "uint256" }, { "internalType": "uint256", "name": "priceWithSafetyMargin", "type": "uint256" }, { "internalType": "uint256", "name": "debtCeiling", "type": "uint256" }, { "internalType": "uint256", "name": "debtFloor", "type": "uint256" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint256", "name": "liquidationRatio", "type": "uint256" }, { "internalType": "uint256", "name": "stabilityFeeRate", "type": "uint256" }, { "internalType": "uint256", "name": "lastAccumulationTime", "type": "uint256" }, { "internalType": "address", "name": "adapter", "type": "address" }, { "internalType": "uint256", "name": "closeFactorBps", "type": "uint256" }, { "internalType": "uint256", "name": "liquidatorIncentiveBps", "type": "uint256" }, { "internalType": "uint256", "name": "treasuryFeesBps", "type": "uint256" }, { "internalType": "address", "name": "strategy", "type": "address" }, { "internalType": "uint256", "name": "positionDebtCeiling", "type": "uint256" } ], "internalType": "struct ICollateralPoolConfig.CollateralPool", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getAdapter", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getCloseFactorBps", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getCollateralPoolInfo", "outputs": [ { "components": [ { "internalType": "uint256", "name": "debtAccumulatedRate", "type": "uint256" }, { "internalType": "uint256", "name": "totalDebtShare", "type": "uint256" }, { "internalType": "uint256", "name": "debtCeiling", "type": "uint256" }, { "internalType": "uint256", "name": "priceWithSafetyMargin", "type": "uint256" }, { "internalType": "uint256", "name": "debtFloor", "type": "uint256" }, { "internalType": "uint256", "name": "positionDebtCeiling", "type": "uint256" } ], "internalType": "struct ICollateralPoolConfig.CollateralPoolInfo", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getDebtAccumulatedRate", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getDebtCeiling", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getDebtFloor", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getLastAccumulationTime", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getLiquidationRatio", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getLiquidatorIncentiveBps", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getPositionDebtCeiling", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getPriceFeed", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getPriceWithSafetyMargin", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getStabilityFeeRate", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getStrategy", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getTotalDebtShare", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getTreasuryFeesBps", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "_debtAccumulatedRate", "type": "uint256" } ], "name": "setDebtAccumulatedRate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "_positionDebtCeiling", "type": "uint256" } ], "name": "setPositionDebtCeiling", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "priceWithSafetyMargin", "type": "uint256" } ], "name": "setPriceWithSafetyMargin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "_totalDebtShare", "type": "uint256" } ], "name": "setTotalDebtShare", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "updateLastAccumulationTime", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,562 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "collateralPools", "outputs": [ { "components": [ { "internalType": "uint256", "name": "totalDebtShare", "type": "uint256" }, { "internalType": "uint256", "name": "debtAccumulatedRate", "type": "uint256" }, { "internalType": "uint256", "name": "priceWithSafetyMargin", "type": "uint256" }, { "internalType": "uint256", "name": "debtCeiling", "type": "uint256" }, { "internalType": "uint256", "name": "debtFloor", "type": "uint256" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint256", "name": "liquidationRatio", "type": "uint256" }, { "internalType": "uint256", "name": "stabilityFeeRate", "type": "uint256" }, { "internalType": "uint256", "name": "lastAccumulationTime", "type": "uint256" }, { "internalType": "address", "name": "adapter", "type": "address" }, { "internalType": "uint256", "name": "closeFactorBps", "type": "uint256" }, { "internalType": "uint256", "name": "liquidatorIncentiveBps", "type": "uint256" }, { "internalType": "uint256", "name": "treasuryFeesBps", "type": "uint256" }, { "internalType": "address", "name": "strategy", "type": "address" }, { "internalType": "uint256", "name": "positionDebtCeiling", "type": "uint256" } ], "internalType": "struct ICollateralPoolConfig.CollateralPool", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getAdapter", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getCloseFactorBps", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getCollateralPoolInfo", "outputs": [ { "components": [ { "internalType": "uint256", "name": "debtAccumulatedRate", "type": "uint256" }, { "internalType": "uint256", "name": "totalDebtShare", "type": "uint256" }, { "internalType": "uint256", "name": "debtCeiling", "type": "uint256" }, { "internalType": "uint256", "name": "priceWithSafetyMargin", "type": "uint256" }, { "internalType": "uint256", "name": "debtFloor", "type": "uint256" }, { "internalType": "uint256", "name": "positionDebtCeiling", "type": "uint256" } ], "internalType": "struct ICollateralPoolConfig.CollateralPoolInfo", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getDebtAccumulatedRate", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getDebtCeiling", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getDebtFloor", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getLastAccumulationTime", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getLiquidationRatio", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getLiquidatorIncentiveBps", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getPositionDebtCeiling", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getPriceFeed", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getPriceWithSafetyMargin", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getStabilityFeeRate", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getStrategy", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getTotalDebtShare", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "getTreasuryFeesBps", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "_debtAccumulatedRate", "type": "uint256" } ], "name": "setDebtAccumulatedRate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "_positionDebtCeiling", "type": "uint256" } ], "name": "setPositionDebtCeiling", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "priceWithSafetyMargin", "type": "uint256" } ], "name": "setPriceWithSafetyMargin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "_totalDebtShare", "type": "uint256" } ], "name": "setTotalDebtShare", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" } ], "name": "updateLastAccumulationTime", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "ICollateralPoolConfig" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,76 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "supportsInterface(bytes4)": "01ffc9a7" } }, "abi": [ { "inputs": [ { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "kind": "dev", "methods": { "supportsInterface(bytes4)": { "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IERC165" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,245 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "allowance(address,address)": "dd62ed3e", "approve(address,uint256)": "095ea7b3", "balanceOf(address)": "70a08231", "totalSupply()": "18160ddd", "transfer(address,uint256)": "a9059cbb", "transferFrom(address,address,uint256)": "23b872dd" } }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,256 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "details": "Interface of the ERC20 standard as defined in the EIP.", "events": { "Approval(address,address,uint256)": { "details": "Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance." }, "Transfer(address,address,uint256)": { "details": "Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero." } }, "kind": "dev", "methods": { "allowance(address,address)": { "details": "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." }, "approve(address,uint256)": { "details": "Sets `amount` 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." }, "balanceOf(address)": { "details": "Returns the amount of tokens owned by `account`." }, "totalSupply()": { "details": "Returns the amount of tokens in existence." }, "transfer(address,uint256)": { "details": "Moves `amount` tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event." }, "transferFrom(address,address,uint256)": { "details": "Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IERC20" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,85 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "flashLendingCall(address,uint256,uint256,bytes)": "af7bd142" } }, "abi": [ { "inputs": [ { "internalType": "address", "name": "caller", "type": "address" }, { "internalType": "uint256", "name": "debtValueToRepay", "type": "uint256" }, { "internalType": "uint256", "name": "collateralAmountToLiquidate", "type": "uint256" }, { "internalType": "bytes", "name": "", "type": "bytes" } ], "name": "flashLendingCall", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "address", "name": "caller", "type": "address" }, { "internalType": "uint256", "name": "debtValueToRepay", "type": "uint256" }, { "internalType": "uint256", "name": "collateralAmountToLiquidate", "type": "uint256" }, { "internalType": "bytes", "name": "", "type": "bytes" } ], "name": "flashLendingCall", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IFlashLendingCallee" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,160 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "collateralPoolId()": "dca07dc5", "collateralToken()": "b2016bd4", "decimals()": "313ce567", "deposit(address,uint256,bytes)": "49bdc2b8", "emergencyWithdraw(address)": "6ff1c9bc", "withdraw(address,uint256,bytes)": "31f09265" } }, "abi": [ { "inputs": [], "name": "collateralPoolId", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "collateralToken", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "deposit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_to", "type": "address" } ], "name": "emergencyWithdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,143 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [], "name": "collateralPoolId", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "collateralToken", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "deposit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_to", "type": "address" } ], "name": "emergencyWithdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IGenericTokenAdapter" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,192 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "batchLiquidate(bytes32[],address[],uint256[],uint256[],address[],bytes[])": "69a5038a", "liquidate(bytes32,address,uint256,uint256,address,bytes)": "1ebce593", "liquidateForBatch(bytes32,address,uint256,uint256,address,bytes,address)": "1cc0353c", "live()": "957aa58c" } }, "abi": [ { "inputs": [ { "internalType": "bytes32[]", "name": "_collateralPoolIds", "type": "bytes32[]" }, { "internalType": "address[]", "name": "_positionAddresses", "type": "address[]" }, { "internalType": "uint256[]", "name": "_debtShareToBeLiquidateds", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "_maxDebtShareToBeLiquidateds", "type": "uint256[]" }, { "internalType": "address[]", "name": "_collateralRecipients", "type": "address[]" }, { "internalType": "bytes[]", "name": "datas", "type": "bytes[]" } ], "name": "batchLiquidate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "_positionAddress", "type": "address" }, { "internalType": "uint256", "name": "_debtShareToBeLiquidated", "type": "uint256" }, { "internalType": "uint256", "name": "_maxDebtShareToBeLiquidated", "type": "uint256" }, { "internalType": "address", "name": "_collateralRecipient", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "liquidate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "_positionAddress", "type": "address" }, { "internalType": "uint256", "name": "_debtShareToBeLiquidated", "type": "uint256" }, { "internalType": "uint256", "name": "_maxDebtShareToBeLiquidated", "type": "uint256" }, { "internalType": "address", "name": "_collateralRecipient", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "address", "name": "sender", "type": "address" } ], "name": "liquidateForBatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "live", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,177 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "bytes32[]", "name": "_collateralPoolIds", "type": "bytes32[]" }, { "internalType": "address[]", "name": "_positionAddresses", "type": "address[]" }, { "internalType": "uint256[]", "name": "_debtShareToBeLiquidateds", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "_maxDebtShareToBeLiquidateds", "type": "uint256[]" }, { "internalType": "address[]", "name": "_collateralRecipients", "type": "address[]" }, { "internalType": "bytes[]", "name": "datas", "type": "bytes[]" } ], "name": "batchLiquidate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "_positionAddress", "type": "address" }, { "internalType": "uint256", "name": "_debtShareToBeLiquidated", "type": "uint256" }, { "internalType": "uint256", "name": "_maxDebtShareToBeLiquidated", "type": "uint256" }, { "internalType": "address", "name": "_collateralRecipient", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "liquidate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "_collateralPoolId", "type": "bytes32" }, { "internalType": "address", "name": "_positionAddress", "type": "address" }, { "internalType": "uint256", "name": "_debtShareToBeLiquidated", "type": "uint256" }, { "internalType": "uint256", "name": "_maxDebtShareToBeLiquidated", "type": "uint256" }, { "internalType": "address", "name": "_collateralRecipient", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "address", "name": "sender", "type": "address" } ], "name": "liquidateForBatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "live", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "ILiquidationEngine" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,110 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "execute(bytes32,uint256,uint256,address,uint256,uint256,address,address,bytes)": "16d8d291" } }, "abi": [ { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "positionDebtShare", "type": "uint256" }, { "internalType": "uint256", "name": "positionCollateralAmount", "type": "uint256" }, { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "debtShareToBeLiquidated", "type": "uint256" }, { "internalType": "uint256", "name": "maxDebtShareToBeLiquidated", "type": "uint256" }, { "internalType": "address", "name": "_liquidatorAddress", "type": "address" }, { "internalType": "address", "name": "collateralRecipient", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "execute", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,98 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "bytes32", "name": "collateralPoolId", "type": "bytes32" }, { "internalType": "uint256", "name": "positionDebtShare", "type": "uint256" }, { "internalType": "uint256", "name": "positionCollateralAmount", "type": "uint256" }, { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "debtShareToBeLiquidated", "type": "uint256" }, { "internalType": "uint256", "name": "maxDebtShareToBeLiquidated", "type": "uint256" }, { "internalType": "address", "name": "_liquidatorAddress", "type": "address" }, { "internalType": "address", "name": "collateralRecipient", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "execute", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "ILiquidationStrategy" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,150 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "isPriceFresh()": "4779db56", "isPriceOk()": "0184a92a", "peekPrice()": "140d2720", "poolId()": "3e0dc34e", "readPrice()": "7e91400f" } }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_caller", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_second", "type": "uint256" } ], "name": "LogSetPriceLife", "type": "event" }, { "inputs": [], "name": "isPriceFresh", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isPriceOk", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "peekPrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "poolId", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "readPrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,134 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_caller", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_second", "type": "uint256" } ], "name": "LogSetPriceLife", "type": "event" }, { "inputs": [], "name": "isPriceFresh", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isPriceOk", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "peekPrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "poolId", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "readPrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IPriceFeed" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "stableCoinReferencePrice()": "9d1eea78" } }, "abi": [ { "inputs": [], "name": "stableCoinReferencePrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [], "name": "stableCoinReferencePrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IPriceOracle" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,360 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "allowance(address,address)": "dd62ed3e", "approve(address,uint256)": "095ea7b3", "balanceOf(address)": "70a08231", "burn(address,uint256)": "9dc29fac", "decreaseAllowance(address,uint256)": "a457c2d7", "increaseAllowance(address,uint256)": "39509351", "mint(address,uint256)": "40c10f19", "rename(string)": "66605ba4", "totalSupply()": "18160ddd", "transfer(address,uint256)": "a9059cbb", "transferFrom(address,address,uint256)": "23b872dd" } }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "name", "type": "string" } ], "name": "Rename", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "burn", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "decreaseAllowance", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "increaseAllowance", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "", "type": "string" } ], "name": "rename", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,156 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "bookKeeper()": "e3b3932a", "deposit(address,uint256,bytes)": "49bdc2b8", "depositRAD(address,uint256,bytes)": "653623ab", "stablecoin()": "e9cbd822", "withdraw(address,uint256,bytes)": "31f09265" } }, "abi": [ { "inputs": [], "name": "bookKeeper", "outputs": [ { "internalType": "contract IBookKeeper", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "deposit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "rad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "depositRAD", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "stablecoin", "outputs": [ { "internalType": "contract IStablecoin", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,140 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [], "name": "bookKeeper", "outputs": [ { "internalType": "contract IBookKeeper", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "deposit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "rad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "depositRAD", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "stablecoin", "outputs": [ { "internalType": "contract IStablecoin", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "positionAddress", "type": "address" }, { "internalType": "uint256", "name": "wad", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IStablecoinAdapter" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,357 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "name", "type": "string" } ], "name": "Rename", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "burn", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "decreaseAllowance", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "increaseAllowance", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "", "type": "string" } ], "name": "rename", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "kind": "dev", "methods": { "allowance(address,address)": { "details": "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." }, "approve(address,uint256)": { "details": "Sets `amount` 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." }, "balanceOf(address)": { "details": "Returns the amount of tokens owned by `account`." }, "totalSupply()": { "details": "Returns the amount of tokens in existence." }, "transfer(address,uint256)": { "details": "Moves `amount` tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event." }, "transferFrom(address,address,uint256)": { "details": "Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "IStablecoin" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,84 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "settleSystemBadDebt(uint256)": "815110ec", "surplusBuffer()": "2a608d5b" } }, "abi": [ { "inputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "settleSystemBadDebt", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "surplusBuffer", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "settleSystemBadDebt", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "surplusBuffer", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "ISystemDebtEngine" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": {} }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,74 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" } ], "devdoc": { "custom:oz-upgrades-unsafe-allow": "constructor constructor() { _disableInitializers(); } ``` ====", "details": "This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. The initialization functions use a version number. Once a version number is used, it is consumed and cannot be reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in case an upgrade adds a module that needs to be initialized. For example: [.hljs-theme-light.nopadding] ``` contract MyToken is ERC20Upgradeable { function initialize() initializer public { __ERC20_init(\"MyToken\", \"MTK\"); } } contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { function initializeV2() reinitializer(2) public { __ERC20Permit_init(\"MyToken\"); } } ``` TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. [CAUTION] ==== Avoid leaving a contract uninitialized. An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: [.hljs-theme-light.nopadding] ```", "events": { "Initialized(uint8)": { "details": "Triggered when the contract has been initialized or reinitialized." } }, "kind": "dev", "methods": {}, "stateVariables": { "_initialized": { "custom:oz-retyped-from": "bool", "details": "Indicates that the contract has been initialized." }, "_initializing": { "details": "Indicates that the contract is in the process of being initialized." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "Initializable" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,109 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "paused()": "5c975abb" } }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Unpaused", "type": "event" }, { "inputs": [], "name": "paused", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,115 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Unpaused", "type": "event" }, { "inputs": [], "name": "paused", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "details": "Contract module which allows children to implement an emergency stop mechanism that can be triggered by an authorized account. This module is used through inheritance. It will make available the modifiers `whenNotPaused` and `whenPaused`, which can be applied to the functions of your contract. Note that they will not be pausable by simply including this module, only once the modifiers are put in place.", "events": { "Paused(address)": { "details": "Emitted when the pause is triggered by `account`." }, "Unpaused(address)": { "details": "Emitted when the pause is lifted by `account`." } }, "kind": "dev", "methods": { "paused()": { "details": "Returns true if the contract is paused, and false otherwise." } }, "stateVariables": { "__gap": { "details": "This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps" } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "PausableUpgradeable" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": {} }, "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" } ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" } ], "name": "Initialized", "type": "event" } ], "devdoc": { "details": "Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].", "kind": "dev", "methods": {}, "stateVariables": { "__gap": { "details": "This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps" } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "ReentrancyGuardUpgradeable" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ { "deploy": { "VM:-": { "linkReferences": {}, "autoDeployLib": true }, "main:1": { "linkReferences": {}, "autoDeployLib": true }, "ropsten:3": { "linkReferences": {}, "autoDeployLib": true }, "rinkeby:4": { "linkReferences": {}, "autoDeployLib": true }, "kovan:42": { "linkReferences": {}, "autoDeployLib": true }, "goerli:5": { "linkReferences": {}, "autoDeployLib": true }, "Custom": { "linkReferences": {}, "autoDeployLib": true } }, "data": { "bytecode": { "functionDebugData": {}, "generatedSources": [], "linkReferences": {}, "object": "60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220baa4660530bbc2006508b3e9b948401d638f8350f519cb83837daca0c5ff76c764736f6c63430008110033", "opcodes": "PUSH1 0x56 PUSH1 0x37 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x2A JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBA LOG4 PUSH7 0x530BBC2006508 0xB3 0xE9 0xB9 BASEFEE BLOCKHASH SAR PUSH4 0x8F8350F5 NOT 0xCB DUP4 DUP4 PUSH30 0xACA0C5FF76C764736F6C6343000811003300000000000000000000000000 ", "sourceMap": "46299:1801:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;46299:1801:0;;;;;;;;;;;;;;;;;" }, "deployedBytecode": { "functionDebugData": {}, "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220baa4660530bbc2006508b3e9b948401d638f8350f519cb83837daca0c5ff76c764736f6c63430008110033", "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBA LOG4 PUSH7 0x530BBC2006508 0xB3 0xE9 0xB9 BASEFEE BLOCKHASH SAR PUSH4 0x8F8350F5 NOT 0xCB DUP4 DUP4 PUSH30 0xACA0C5FF76C764736F6C6343000811003300000000000000000000000000 ", "sourceMap": "46299:1801:0:-:0;;;;;;;;" }, "gasEstimates": { "creation": { "codeDepositCost": "17200", "executionCost": "103", "totalCost": "17303" }, "internal": { "balanceOf(address,address)": "infinite", "myBalance(address)": "infinite", "safeApprove(address,address,uint256)": "infinite", "safeTransfer(address,address,uint256)": "infinite", "safeTransferETH(address,uint256)": "infinite", "safeTransferFrom(address,address,address,uint256)": "infinite" } }, "methodIdentifiers": {} }, "abi": [] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ { "compiler": { "version": "0.8.17+commit.8df45f5f" }, "language": "Solidity", "output": { "abi": [], "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": "SafeToken" }, "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "contracts/3_FixedSpreadLiquidationStrategy1.sol": { "keccak256": "0x6037df8c4daa4049717c67d13cd8f28722c4cd0893a627837c740fce4c126bf8", "urls": [ "bzz-raw://78bd9e6c5b981ec3cb0a9228ed583928210bd39411f506ca5b33e39029b18ee9", "dweb:/ipfs/QmQxJ537UDKFgD5xcV96JqfFUzTfHYfo8nDvr3bgR8Yufb" ] } }, "version": 1 } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // This script can be used to deploy the "Storage" contract using ethers.js library. // Please make sure to compile "./contracts/1_Storage.sol" file before running this script. // And use Right click -> "Run" from context menu of the file to run the script. Shortcut: Ctrl+Shift+S import { deploy } from './ethers-lib' (async () => { try { const result = await deploy('Storage', []) console.log(`address: ${result.address}`) } catch (e) { console.log(e.message) } })() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // This script can be used to deploy the "Storage" contract using Web3 library. // Please make sure to compile "./contracts/1_Storage.sol" file before running this script. // And use Right click -> "Run" from context menu of the file to run the script. Shortcut: Ctrl+Shift+S import { deploy } from './web3-lib' (async () => { try { const result = await deploy('Storage', []) console.log(`address: ${result.address}`) } catch (e) { console.log(e.message) } })() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ import { ethers } from 'ethers' /** * Deploy the given contract * @param {string} contractName name of the contract to deploy * @param {Array<any>} args list of constructor' parameters * @param {Number} accountIndex account index from the exposed account * @return {Contract} deployed contract */ export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => { console.log(`deploying ${contractName}`) // Note that the script needs the ABI which is generated from the compilation artifact. // Make sure contract is compiled and artifacts are generated const artifactsPath = `browser/contracts/artifacts/${contractName}.json` // Change this for different path const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) // 'web3Provider' is a remix global variable object const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex) const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer) const contract = await factory.deploy(...args) // The contract is NOT deployed yet; we must wait until it is mined await contract.deployed() return contract } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ import Web3 from 'web3' import { Contract, ContractSendMethod, Options } from 'web3-eth-contract' /** * Deploy the given contract * @param {string} contractName name of the contract to deploy * @param {Array<any>} args list of constructor' parameters * @param {string} from account used to send the transaction * @param {number} gas gas limit * @return {Options} deployed contract */ export const deploy = async (contractName: string, args: Array<any>, from?: string, gas?: number): Promise<Options> => { const web3 = new Web3(web3Provider) console.log(`deploying ${contractName}`) // Note that the script needs the ABI which is generated from the compilation artifact. // Make sure contract is compiled and artifacts are generated const artifactsPath = `browser/contracts/artifacts/${contractName}.json` const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) const accounts = await web3.eth.getAccounts() const contract: Contract = new web3.eth.Contract(metadata.abi) const contractSend: ContractSendMethod = contract.deploy({ data: metadata.data.bytecode.object, arguments: args }) const newContractInstance = await contractSend.send({ from: from || accounts[0], gas: gas || 1500000 }) return newContractInstance.options } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; import "remix_tests.sol"; // this import is automatically injected by Remix. import "hardhat/console.sol"; import "../contracts/3_Ballot.sol"; contract BallotTest { bytes32[] proposalNames; Ballot ballotToTest; function beforeAll () public { proposalNames.push(bytes32("candidate1")); ballotToTest = new Ballot(proposalNames); } function checkWinningProposal () public { console.log("Running checkWinningProposal"); ballotToTest.vote(0); Assert.equal(ballotToTest.winningProposal(), uint(0), "proposal at index 0 should be the winning proposal"); Assert.equal(ballotToTest.winnerName(), bytes32("candidate1"), "candidate1 should be the winner name"); } function checkWinninProposalWithReturnValue () public view returns (bool) { return ballotToTest.winningProposal() == 0; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ // Right click on the script name and hit "Run" to execute const { expect } = require("chai"); const { ethers } = require("hardhat"); describe("Storage", function () { it("test initial value", async function () { const Storage = await ethers.getContractFactory("Storage"); const storage = await Storage.deploy(); await storage.deployed(); console.log('storage deployed at:'+ storage.address) expect((await storage.retrieve()).toNumber()).to.equal(0); }); it("test updating and retrieving updated value", async function () { const Storage = await ethers.getContractFactory("Storage"); const storage = await Storage.deploy(); await storage.deployed(); const storage2 = await ethers.getContractAt("Storage", storage.address); const setValue = await storage2.store(56); await setValue.wait(); expect((await storage2.retrieve()).toNumber()).to.equal(56); }); });