From 8e6dd3ddb1646f565bdee197ad4d500f8eb914ce Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:57 -0500 Subject: [PATCH 01/51] update contracts/Errors.sol: refactored SafeMath expressions --- contracts/Errors.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/Errors.sol b/contracts/Errors.sol index cb09a4e..01d41b7 100644 --- a/contracts/Errors.sol +++ b/contracts/Errors.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract Modifier { string internal constant ONLY_OWNER = "O"; From 7461f981867d8b68f9b4b95854c941b3b359afa3 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:57 -0500 Subject: [PATCH 02/51] update contracts/reqCoinProxy.sol: refactored SafeMath expressions --- contracts/reqCoinProxy.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/reqCoinProxy.sol b/contracts/reqCoinProxy.sol index 33ad581..c276606 100644 --- a/contracts/reqCoinProxy.sol +++ b/contracts/reqCoinProxy.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "./interfaces/marketManagerInterface.sol"; import "./interfaces/interestModelInterface.sol"; From 8b0129788b9527f0647e9c1110b4a1a73ba66f03 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:57 -0500 Subject: [PATCH 03/51] update contracts/reqTokenProxy.sol: refactored SafeMath expressions --- contracts/reqTokenProxy.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/reqTokenProxy.sol b/contracts/reqTokenProxy.sol index 1e2dda5..accef0e 100644 --- a/contracts/reqTokenProxy.sol +++ b/contracts/reqTokenProxy.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "./interfaces/marketManagerInterface.sol"; import "./interfaces/interestModelInterface.sol"; From 9495c1d026f64da6d95f7aef3de3f179e4e53f3f Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 04/51] update contracts/SafeMath.sol: refactored SafeMath expressions --- contracts/SafeMath.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/SafeMath.sol b/contracts/SafeMath.sol index 44bafaf..6edb369 100644 --- a/contracts/SafeMath.sol +++ b/contracts/SafeMath.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity ^0.6.12; +pragma solidity ^0.8.0; // from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol // Subject to the MIT license. From 2360d7d552af226dfee78b968e49b79fa30fc96c Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 05/51] update contracts/marketHandler/tokenSI.sol: refactored SafeMath expressions --- contracts/marketHandler/tokenSI.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketHandler/tokenSI.sol b/contracts/marketHandler/tokenSI.sol index a8e17f6..5944dc3 100644 --- a/contracts/marketHandler/tokenSI.sol +++ b/contracts/marketHandler/tokenSI.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/SIInterface.sol"; import "../interfaces/marketHandlerDataStorageInterface.sol"; From dce68dd398f2cff1e5d02caea6a31def73befe8f Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 06/51] update contracts/marketHandler/coinHandler.sol: refactored SafeMath expressions --- contracts/marketHandler/coinHandler.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketHandler/coinHandler.sol b/contracts/marketHandler/coinHandler.sol index d022446..af25cc8 100755 --- a/contracts/marketHandler/coinHandler.sol +++ b/contracts/marketHandler/coinHandler.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/marketHandlerInterface.sol"; import "../interfaces/marketHandlerDataStorageInterface.sol"; From 299cdd417c98807b6b373d6e8d38ce83c795148b Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 07/51] update contracts/marketHandler/coinSI.sol: refactored SafeMath expressions --- contracts/marketHandler/coinSI.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketHandler/coinSI.sol b/contracts/marketHandler/coinSI.sol index 14c1354..f58c6c9 100644 --- a/contracts/marketHandler/coinSI.sol +++ b/contracts/marketHandler/coinSI.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/SIInterface.sol"; import "../interfaces/marketHandlerDataStorageInterface.sol"; From bd99befce5b87f96434e1ae813a7e0445e8dac3f Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 08/51] update contracts/marketHandler/tokenHandler.sol: refactored SafeMath expressions --- contracts/marketHandler/tokenHandler.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketHandler/tokenHandler.sol b/contracts/marketHandler/tokenHandler.sol index 67cbd84..c21e1aa 100755 --- a/contracts/marketHandler/tokenHandler.sol +++ b/contracts/marketHandler/tokenHandler.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/marketHandlerInterface.sol"; import "../interfaces/marketHandlerDataStorageInterface.sol"; From 60bf7e7e71858d254289345897ed1ed05954874a Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 09/51] update contracts/marketHandler/marketHandlerDataStorage/marketSIHandlerDataStorage.sol: refactored SafeMath expressions --- .../marketHandlerDataStorage/marketSIHandlerDataStorage.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketHandler/marketHandlerDataStorage/marketSIHandlerDataStorage.sol b/contracts/marketHandler/marketHandlerDataStorage/marketSIHandlerDataStorage.sol index 07c0077..fe7ec7d 100644 --- a/contracts/marketHandler/marketHandlerDataStorage/marketSIHandlerDataStorage.sol +++ b/contracts/marketHandler/marketHandlerDataStorage/marketSIHandlerDataStorage.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../../interfaces/marketSIHandlerDataStorageInterface.sol"; import "../../Errors.sol"; From 9a584a589ce9e80a8fa667e67896473086223252 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 10/51] update contracts/marketHandler/marketHandlerDataStorage/handlerDataStorage.sol: refactored SafeMath expressions --- .../marketHandlerDataStorage/handlerDataStorage.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketHandler/marketHandlerDataStorage/handlerDataStorage.sol b/contracts/marketHandler/marketHandlerDataStorage/handlerDataStorage.sol index d3279d8..b0de696 100755 --- a/contracts/marketHandler/marketHandlerDataStorage/handlerDataStorage.sol +++ b/contracts/marketHandler/marketHandlerDataStorage/handlerDataStorage.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../../interfaces/marketHandlerDataStorageInterface.sol"; import "../../Errors.sol"; From cfa1b08e779f1a452551257984a37c803ee38e87 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 11/51] update contracts/truffleKit/tokens.sol: refactored SafeMath expressions --- contracts/truffleKit/tokens.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/tokens.sol b/contracts/truffleKit/tokens.sol index 54b335b..9beffee 100644 --- a/contracts/truffleKit/tokens.sol +++ b/contracts/truffleKit/tokens.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../tokenStandard/openzeppelinERC20.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; // BiFi project contract Bifi is openzeppelinERC20 { From 191fb3cf00217ebff07bfc1a70f430eb136b7a45 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 12/51] update contracts/truffleKit/LiquidationManager.sol: refactored SafeMath expressions --- contracts/truffleKit/LiquidationManager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/LiquidationManager.sol b/contracts/truffleKit/LiquidationManager.sol index 2fa08c3..e16682e 100644 --- a/contracts/truffleKit/LiquidationManager.sol +++ b/contracts/truffleKit/LiquidationManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../marketManager/liquidationManager.sol"; From 5437db4337696e0f65d712c60a058f833be36785 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 13/51] update contracts/truffleKit/InterestModel.sol: refactored SafeMath expressions --- contracts/truffleKit/InterestModel.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/InterestModel.sol b/contracts/truffleKit/InterestModel.sol index 7164cf7..245895d 100644 --- a/contracts/truffleKit/InterestModel.sol +++ b/contracts/truffleKit/InterestModel.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../interestModel/interestModel.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract InterestModel is interestModel { constructor( From 9f9ddcb906df335a42c2a0eaeffa55dd17d48a22 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 14/51] update contracts/truffleKit/marketManagerSide/ManagerDataStorages.sol: refactored SafeMath expressions --- contracts/truffleKit/marketManagerSide/ManagerDataStorages.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/marketManagerSide/ManagerDataStorages.sol b/contracts/truffleKit/marketManagerSide/ManagerDataStorages.sol index dc392bf..1fe2585 100644 --- a/contracts/truffleKit/marketManagerSide/ManagerDataStorages.sol +++ b/contracts/truffleKit/marketManagerSide/ManagerDataStorages.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../../marketManager/managerDataStorage/managerDataStorage.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract ManagerDataStorage is managerDataStorage { constructor() From e781f0c946cab0fba71b36d917e2eefde23492f8 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 15/51] update contracts/truffleKit/marketManagerSide/Manager.sol: refactored SafeMath expressions --- contracts/truffleKit/marketManagerSide/Manager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/marketManagerSide/Manager.sol b/contracts/truffleKit/marketManagerSide/Manager.sol index 593a92f..fccde3b 100644 --- a/contracts/truffleKit/marketManagerSide/Manager.sol +++ b/contracts/truffleKit/marketManagerSide/Manager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../../marketManager/tokenManager.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract Manager is etherManager { constructor (address managerDataStorageAddr, address oracleProxyAddr, address breaker, address erc20Addr) From 4797efa9794a7e976f78308c1fe94c758a32c639 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 16/51] update contracts/truffleKit/OracleSide/chainlinkOracles.sol: refactored SafeMath expressions --- contracts/truffleKit/OracleSide/chainlinkOracles.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/OracleSide/chainlinkOracles.sol b/contracts/truffleKit/OracleSide/chainlinkOracles.sol index 3cfb128..e27ce26 100644 --- a/contracts/truffleKit/OracleSide/chainlinkOracles.sol +++ b/contracts/truffleKit/OracleSide/chainlinkOracles.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../../oracle/oracle.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract EtherOracle is observerOracle { constructor(int256 _price) From 0e0809a3e16417ff86ef3fe107c16b4dd00861f0 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:58 -0500 Subject: [PATCH 17/51] update contracts/truffleKit/OracleSide/OracleProxy.sol: refactored SafeMath expressions --- contracts/truffleKit/OracleSide/OracleProxy.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/OracleSide/OracleProxy.sol b/contracts/truffleKit/OracleSide/OracleProxy.sol index df60a7e..a655748 100644 --- a/contracts/truffleKit/OracleSide/OracleProxy.sol +++ b/contracts/truffleKit/OracleSide/OracleProxy.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../../oracle/oracleProxy.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract OracleProxy is oracleProxy { constructor (address coinOracle, address usdtOracle, address daiOracle, address linkOracle, address usdcOracle) From 1856296a138c2304e6def69f60814298f434c6de Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 18/51] update contracts/truffleKit/marketHandlerSide/marketHandlerLogics.sol: refactored SafeMath expressions --- contracts/truffleKit/marketHandlerSide/marketHandlerLogics.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/marketHandlerSide/marketHandlerLogics.sol b/contracts/truffleKit/marketHandlerSide/marketHandlerLogics.sol index 2dcea22..20a4342 100644 --- a/contracts/truffleKit/marketHandlerSide/marketHandlerLogics.sol +++ b/contracts/truffleKit/marketHandlerSide/marketHandlerLogics.sol @@ -2,7 +2,7 @@ import "../../marketHandler/coinHandler.sol"; import "../../marketHandler/tokenHandler.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract CoinHandlerLogic is coinHandler { constructor() From a410607f695f07a7f72fcb738810928184ca0dc8 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 19/51] update contracts/truffleKit/marketHandlerSide/marketHandlerProxys.sol: refactored SafeMath expressions --- contracts/truffleKit/marketHandlerSide/marketHandlerProxys.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/marketHandlerSide/marketHandlerProxys.sol b/contracts/truffleKit/marketHandlerSide/marketHandlerProxys.sol index eaa03e4..eba309c 100644 --- a/contracts/truffleKit/marketHandlerSide/marketHandlerProxys.sol +++ b/contracts/truffleKit/marketHandlerSide/marketHandlerProxys.sol @@ -2,7 +2,7 @@ import "../../reqCoinProxy.sol"; import "../../reqTokenProxy.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract CoinHandlerProxy is coinProxy { constructor() From ba40905916704ea5ba5e5ea393d136aaefe501ee Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 20/51] update contracts/truffleKit/marketHandlerSide/marketHandlerDataStorages.sol: refactored SafeMath expressions --- .../truffleKit/marketHandlerSide/marketHandlerDataStorages.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/marketHandlerSide/marketHandlerDataStorages.sol b/contracts/truffleKit/marketHandlerSide/marketHandlerDataStorages.sol index bdcc8ab..f159075 100644 --- a/contracts/truffleKit/marketHandlerSide/marketHandlerDataStorages.sol +++ b/contracts/truffleKit/marketHandlerSide/marketHandlerDataStorages.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../../marketHandler/marketHandlerDataStorage/handlerDataStorage.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract CoinHandlerDataStorage is marketHandlerDataStorage { constructor (uint256 _borrowLimit, uint256 _marginCallLimit, uint256 _minimumInterestRate, uint256 _liquiditySensitivity) From c6291a2d7a3376ea5afe26b375a8102328f8cc16 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 21/51] update contracts/truffleKit/siHandlerSide/siDataStorages.sol: refactored SafeMath expressions --- contracts/truffleKit/siHandlerSide/siDataStorages.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/siHandlerSide/siDataStorages.sol b/contracts/truffleKit/siHandlerSide/siDataStorages.sol index d158b5c..3f9e93e 100644 --- a/contracts/truffleKit/siHandlerSide/siDataStorages.sol +++ b/contracts/truffleKit/siHandlerSide/siDataStorages.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../../marketHandler/marketHandlerDataStorage/marketSIHandlerDataStorage.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract CoinSIDataStorage is marketSIHandlerDataStorage { constructor(address _SIHandlerAddr) From 6a5c510471fafebc2647e9a304c4310159946aaa Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 22/51] update contracts/truffleKit/siHandlerSide/siHandlerLogics.sol: refactored SafeMath expressions --- contracts/truffleKit/siHandlerSide/siHandlerLogics.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/truffleKit/siHandlerSide/siHandlerLogics.sol b/contracts/truffleKit/siHandlerSide/siHandlerLogics.sol index b4590ff..f142eec 100644 --- a/contracts/truffleKit/siHandlerSide/siHandlerLogics.sol +++ b/contracts/truffleKit/siHandlerSide/siHandlerLogics.sol @@ -2,7 +2,7 @@ import "../../marketHandler/tokenSI.sol"; import "../../marketHandler/coinSI.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract CoinSI is coinSI { constructor() From 50f6151070a3ce5d3a03f3c4f69cf8afce81aaa6 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 23/51] update contracts/oracle/bscChainlinkOracle.sol: refactored SafeMath expressions --- contracts/oracle/bscChainlinkOracle.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/oracle/bscChainlinkOracle.sol b/contracts/oracle/bscChainlinkOracle.sol index d2655e3..dd79f54 100644 --- a/contracts/oracle/bscChainlinkOracle.sol +++ b/contracts/oracle/bscChainlinkOracle.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/oracleInterface.sol"; import "../interfaces/oracleProxyInterface.sol"; From b62c928ee7ea54fa222b49b36441a6880ce9987e Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 24/51] update contracts/oracle/oracle.sol: refactored SafeMath expressions --- contracts/oracle/oracle.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/oracle/oracle.sol b/contracts/oracle/oracle.sol index 07d3b8f..39e915a 100755 --- a/contracts/oracle/oracle.sol +++ b/contracts/oracle/oracle.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../Errors.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's mockup Contract From 89f1180f2323596db594404d23cbd13ffbb42083 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 25/51] update contracts/oracle/oracleProxy.sol: refactored SafeMath expressions --- contracts/oracle/oracleProxy.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/oracle/oracleProxy.sol b/contracts/oracle/oracleProxy.sol index 184a44d..d1c6504 100755 --- a/contracts/oracle/oracleProxy.sol +++ b/contracts/oracle/oracleProxy.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/oracleInterface.sol"; import "../interfaces/oracleProxyInterface.sol"; From bef4bb79903401ca8f328b3d5c8abc5818142b95 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 26/51] update contracts/observer/observer.sol: refactored SafeMath expressions --- contracts/observer/observer.sol | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contracts/observer/observer.sol b/contracts/observer/observer.sol index f2cf341..5fda936 100644 --- a/contracts/observer/observer.sol +++ b/contracts/observer/observer.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/oracleInterface.sol"; -import "../SafeMath.sol"; /** * @title Bifi's observer contract @@ -11,7 +10,6 @@ import "../SafeMath.sol"; * @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) */ contract Observer { - using SafeMath for uint256; address payable public owner; mapping(address => bool) operators; @@ -66,7 +64,7 @@ contract Observer { .unifiedMul( chain.alphaRate ) .add( SafeMath.unifiedPoint - .sub( chain.alphaRate ) + - chain.alphaRate .unifiedMul( chain.chainBorrow ) ) .unifiedMul( uint256( oracleInterface(chain.priceOracleAddr).latestAnswer() ) ) From ed0ef3d74edb31f7e36da636f3d3699e6c996c47 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 27/51] update contracts/tokenStandard/token.sol: refactored SafeMath expressions --- contracts/tokenStandard/token.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/tokenStandard/token.sol b/contracts/tokenStandard/token.sol index 763f1fa..60950db 100755 --- a/contracts/tokenStandard/token.sol +++ b/contracts/tokenStandard/token.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; contract ERC20 { mapping(address => uint256) balances; From d8bb6ef9ae54bb26ad76ee3a549f286179a26ea3 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 28/51] update contracts/tokenStandard/openzeppelinERC20.sol: refactored SafeMath expressions --- contracts/tokenStandard/openzeppelinERC20.sol | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/contracts/tokenStandard/openzeppelinERC20.sol b/contracts/tokenStandard/openzeppelinERC20.sol index c253afb..d79de2e 100644 --- a/contracts/tokenStandard/openzeppelinERC20.sol +++ b/contracts/tokenStandard/openzeppelinERC20.sol @@ -8,9 +8,8 @@ * 3. ERC20 constructor */ import "./standardIERC20.sol"; -import "../SafeMath.sol"; -pragma solidity 0.6.12; +pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { @@ -24,7 +23,6 @@ abstract contract Context { } contract openzeppelinERC20 is Context, standardIERC20 { - using SafeMath for uint256; mapping (address => uint256) private _balances; @@ -81,17 +79,17 @@ contract openzeppelinERC20 is Context, standardIERC20 { function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); - _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount)); + _approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { - _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); + _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { - _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue)); + _approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue); return true; } @@ -101,8 +99,8 @@ contract openzeppelinERC20 is Context, standardIERC20 { _beforeTokenTransfer(sender, recipient, amount); - _balances[sender] = _balances[sender].sub(amount); - _balances[recipient] = _balances[recipient].add(amount); + _balances[sender] = _balances[sender] - amount; + _balances[recipient] = _balances[recipient] + amount; emit Transfer(sender, recipient, amount); } @@ -111,8 +109,8 @@ contract openzeppelinERC20 is Context, standardIERC20 { _beforeTokenTransfer(address(0), account, amount); - _totalSupply = _totalSupply.add(amount); - _balances[account] = _balances[account].add(amount); + _totalSupply = _totalSupply + amount; + _balances[account] = _balances[account] + amount; emit Transfer(address(0), account, amount); } @@ -121,8 +119,8 @@ contract openzeppelinERC20 is Context, standardIERC20 { _beforeTokenTransfer(account, address(0), amount); - _balances[account] = _balances[account].sub(amount); - _totalSupply = _totalSupply.sub(amount); + _balances[account] = _balances[account] - amount; + _totalSupply = _totalSupply - amount; emit Transfer(account, address(0), amount); } From d4ea7490a1c6944d6a8a175869b5a6cf6e40d9d6 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 29/51] update contracts/tokenStandard/standardIERC20.sol: refactored SafeMath expressions --- contracts/tokenStandard/standardIERC20.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/tokenStandard/standardIERC20.sol b/contracts/tokenStandard/standardIERC20.sol index 54dc036..0c81db3 100644 --- a/contracts/tokenStandard/standardIERC20.sol +++ b/contracts/tokenStandard/standardIERC20.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol -pragma solidity 0.6.12; +pragma solidity ^0.8.0; interface standardIERC20 { function totalSupply() external view returns (uint256); From e1b75267d9e77551b849fa986aa2baee1d7845a0 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 30/51] update contracts/marketManager/tokenManager.sol: refactored SafeMath expressions --- contracts/marketManager/tokenManager.sol | 54 ++++++++++++------------ 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/contracts/marketManager/tokenManager.sol b/contracts/marketManager/tokenManager.sol index 5b216ef..a74dc6c 100755 --- a/contracts/marketManager/tokenManager.sol +++ b/contracts/marketManager/tokenManager.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/marketManagerInterface.sol"; @@ -11,7 +11,6 @@ import "../interfaces/liquidationManagerInterface.sol"; import "../interfaces/proxyContractInterface.sol"; import "../interfaces/tokenInterface.sol"; import "../Errors.sol"; -import "../SafeMath.sol"; import "../interfaces/observerInterface.sol"; @@ -24,7 +23,6 @@ import "../interfaces/SIInterface.sol"; * @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) */ contract etherManager is marketManagerInterface, ManagerErrors { - using SafeMath for uint256; address public owner; mapping(address => bool) operators; @@ -397,16 +395,16 @@ contract etherManager is marketManagerInterface, ManagerErrors { if (userAssetsInfo.depositAmount > 0) { userAssetsInfo.depositAsset = userAssetsInfo.depositAmount.unifiedMul(userAssetsInfo.price); - userAssetsInfo.depositAssetBorrowLimitSum = userAssetsInfo.depositAssetBorrowLimitSum.add(userAssetsInfo.depositAsset.unifiedMul(userAssetsInfo.borrowLimit)); - userAssetsInfo.marginCallLimitSum = userAssetsInfo.marginCallLimitSum.add(userAssetsInfo.depositAsset.unifiedMul(userAssetsInfo.marginCallLimit)); - userAssetsInfo.depositAssetSum = userAssetsInfo.depositAssetSum.add(userAssetsInfo.depositAsset); + userAssetsInfo.depositAssetBorrowLimitSum = userAssetsInfo.depositAssetBorrowLimitSum + userAssetsInfo.depositAsset.unifiedMul(userAssetsInfo.borrowLimit); + userAssetsInfo.marginCallLimitSum = userAssetsInfo.marginCallLimitSum + userAssetsInfo.depositAsset.unifiedMul(userAssetsInfo.marginCallLimit); + userAssetsInfo.depositAssetSum = userAssetsInfo.depositAssetSum + userAssetsInfo.depositAsset; } /* Compute the borrow parameters */ if (userAssetsInfo.borrowAmount > 0) { userAssetsInfo.borrowAsset = userAssetsInfo.borrowAmount.unifiedMul(userAssetsInfo.price); - userAssetsInfo.borrowAssetSum = userAssetsInfo.borrowAssetSum.add(userAssetsInfo.borrowAsset); + userAssetsInfo.borrowAssetSum = userAssetsInfo.borrowAssetSum + userAssetsInfo.borrowAsset; } } @@ -418,10 +416,10 @@ contract etherManager is marketManagerInterface, ManagerErrors { if (userAssetsInfo.depositAssetBorrowLimitSum > userAssetsInfo.borrowAssetSum) { /* Set the amount that the user can borrow from the borrow limit and previous borrows. */ - userAssetsInfo.userBorrowableAsset = userAssetsInfo.depositAssetBorrowLimitSum.sub(userAssetsInfo.borrowAssetSum); + userAssetsInfo.userBorrowableAsset = userAssetsInfo.depositAssetBorrowLimitSum - userAssetsInfo.borrowAssetSum; /* Set the allowed amount that the user can withdraw based on the user borrow */ - userAssetsInfo.withdrawableAsset = userAssetsInfo.depositAssetBorrowLimitSum.sub(userAssetsInfo.borrowAssetSum).unifiedDiv(userAssetsInfo.callerBorrowLimit); + userAssetsInfo.withdrawableAsset = userAssetsInfo.depositAssetBorrowLimitSum - userAssetsInfo.borrowAssetSum.unifiedDiv(userAssetsInfo.callerBorrowLimit); } /* Return the calculated parameters */ @@ -456,7 +454,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { } /* transfer reward tokens */ - return _rewardTransfer(msg.sender, delta.mul(dataStorageInstance.getInterestUpdateRewardPerblock())); + return _rewardTransfer(msg.sender, delta * dataStorageInstance.getInterestUpdateRewardPerblock()); } /** @@ -485,7 +483,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { uint256 claimAmountSum; for (handlerID; handlerID < tokenHandlerLength; handlerID++) { - claimAmountSum = claimAmountSum.add(_claimHandlerRewardAmount(handlerID, userAddr)); + claimAmountSum = claimAmountSum + _claimHandlerRewardAmount(handlerID, userAddr); } require(_rewardTransfer(userAddr, claimAmountSum)); return claimAmountSum; @@ -546,7 +544,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { if(address(_rewardERC20) != address(0x0)) { uint256 beforeBalance = _rewardERC20.balanceOf(userAddr); _rewardERC20.transfer(userAddr, _amount); - require(_amount == _rewardERC20.balanceOf(userAddr).sub(beforeBalance), REWARD_TRANSFER); + require(_amount == _rewardERC20.balanceOf(userAddr) - beforeBalance, REWARD_TRANSFER); return true; } } @@ -579,25 +577,25 @@ contract etherManager is marketManagerInterface, ManagerErrors { /* Remaining periods for reward distribution */ uint256 remainingPeriod = globalRewardPerBlock.unifiedDiv(globalRewardDecrement); - if (remainingPeriod >= delta.mul(SafeMath.unifiedPoint)) + if (remainingPeriod >= delta * SafeMath.unifiedPoint) { - remainingPeriod = remainingPeriod.sub(delta.mul(SafeMath.unifiedPoint)); + remainingPeriod = remainingPeriod - delta * SafeMath.unifiedPoint; } else { return _epilogueOfDetermineRewardParams(_dataStorage, userAddr, delta, 0, globalRewardDecrement, 0); } - if (globalRewardTotalAmount >= globalRewardPerBlock.mul(delta)) + if (globalRewardTotalAmount >= globalRewardPerBlock * delta) { - globalRewardTotalAmount = globalRewardTotalAmount - globalRewardPerBlock.mul(delta); + globalRewardTotalAmount = globalRewardTotalAmount - globalRewardPerBlock * delta; } else { return _epilogueOfDetermineRewardParams(_dataStorage, userAddr, delta, 0, globalRewardDecrement, 0); } - globalRewardPerBlock = globalRewardTotalAmount.mul(2).unifiedDiv(remainingPeriod.add(SafeMath.unifiedPoint)); + globalRewardPerBlock = globalRewardTotalAmount * 2.unifiedDiv(remainingPeriod + SafeMath.unifiedPoint); /* To incentivze the update operation, the operator get paid with the reward token */ return _epilogueOfDetermineRewardParams(_dataStorage, userAddr, delta, globalRewardPerBlock, globalRewardDecrement, globalRewardTotalAmount); @@ -626,7 +624,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { _dataStorage.setGlobalRewardDecrement(_globalRewardDecrement); _dataStorage.setGlobalRewardTotalAmount(_globalRewardTotalAmount); - uint256 rewardAmount = _delta.mul(_dataStorage.getRewardParamUpdateRewardPerBlock()); + uint256 rewardAmount = _delta * _dataStorage.getRewardParamUpdateRewardPerBlock(); /* To incentivze the update operation, the operator get paid with the reward token */ _rewardTransfer(userAddr, rewardAmount); @@ -649,13 +647,13 @@ contract etherManager is marketManagerInterface, ManagerErrors { for (handlerID; handlerID < handlerLength; handlerID++) { handlerAlphaRateBaseAsset[handlerID] = _getAlphaBaseAsset(handlerID); - alphaRateBaseGlobalAssetSum = alphaRateBaseGlobalAssetSum.add(handlerAlphaRateBaseAsset[handlerID]); + alphaRateBaseGlobalAssetSum = alphaRateBaseGlobalAssetSum + handlerAlphaRateBaseAsset[handlerID]; } chainAlphaRateBaseAsset = observer.getAlphaBaseAsset(); handlerID = 0; for (;handlerID < chainAlphaRateBaseAsset.length; handlerID++) { - alphaRateBaseGlobalAssetSum = alphaRateBaseGlobalAssetSum.add(chainAlphaRateBaseAsset[handlerID]); + alphaRateBaseGlobalAssetSum = alphaRateBaseGlobalAssetSum + chainAlphaRateBaseAsset[handlerID]; } handlerID = 0; @@ -747,7 +745,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { */ function _calcAlphaBaseAmount(uint256 _alpha, uint256 _depositAmount, uint256 _borrowAmount) internal pure returns (uint256) { - return _depositAmount.unifiedMul(_alpha).add(_borrowAmount.unifiedMul(SafeMath.unifiedPoint.sub(_alpha))); + return _depositAmount.unifiedMul(_alpha) + _borrowAmount.unifiedMul(SafeMath.unifiedPoint - _alpha); } /** @@ -875,7 +873,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { if (depositCredit > borrowCredit) { - return depositCredit.sub(borrowCredit).unifiedDiv(_getTokenHandlerPrice(handlerID)); + return depositCredit - borrowCredit.unifiedDiv(_getTokenHandlerPrice(handlerID)); } else { @@ -929,8 +927,8 @@ contract etherManager is marketManagerInterface, ManagerErrors { uint256 marginCallLimit = _getTokenHandlerMarginCallLimit(handlerID); uint256 userBorrowLimitAsset = depositHandlerAsset.unifiedMul(borrowLimit); uint256 userMarginCallLimitAsset = depositHandlerAsset.unifiedMul(marginCallLimit); - userTotalBorrowLimitAsset = userTotalBorrowLimitAsset.add(userBorrowLimitAsset); - userTotalMarginCallLimitAsset = userTotalMarginCallLimitAsset.add(userMarginCallLimitAsset); + userTotalBorrowLimitAsset = userTotalBorrowLimitAsset + userBorrowLimitAsset; + userTotalMarginCallLimitAsset = userTotalMarginCallLimitAsset + userMarginCallLimitAsset; } else { @@ -962,7 +960,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { { (depositHandlerAsset, borrowHandlerAsset) = _getUserIntraHandlerAssetWithInterest(userAddr, handlerID); - userTotalBorrowAsset = userTotalBorrowAsset.add(borrowHandlerAsset); + userTotalBorrowAsset = userTotalBorrowAsset + borrowHandlerAsset; depositAssetBorrowLimitSum = depositAssetBorrowLimitSum .add( depositHandlerAsset @@ -974,7 +972,7 @@ contract etherManager is marketManagerInterface, ManagerErrors { if (depositAssetBorrowLimitSum > userTotalBorrowAsset) { return depositAssetBorrowLimitSum - .sub(userTotalBorrowAsset) + - userTotalBorrowAsset .unifiedDiv( _getTokenHandlerBorrowLimit(callerID) ) .unifiedDiv( _getTokenHandlerPrice(callerID) ); } @@ -1153,8 +1151,8 @@ contract etherManager is marketManagerInterface, ManagerErrors { (depositHandlerAsset, borrowHandlerAsset) = _getUserIntraHandlerAssetWithInterest(userAddr, handlerID); uint256 borrowLimit = _getTokenHandlerBorrowLimit(handlerID); uint256 depositHandlerCredit = depositHandlerAsset.unifiedMul(borrowLimit); - depositTotalCredit = depositTotalCredit.add(depositHandlerCredit); - borrowTotalCredit = borrowTotalCredit.add(borrowHandlerAsset); + depositTotalCredit = depositTotalCredit + depositHandlerCredit; + borrowTotalCredit = borrowTotalCredit + borrowHandlerAsset; } else { From 689b976526dc2807668ac6b845696098e4846ea2 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 31/51] update contracts/marketManager/liquidationManager.sol: refactored SafeMath expressions --- contracts/marketManager/liquidationManager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketManager/liquidationManager.sol b/contracts/marketManager/liquidationManager.sol index b737953..8c83aad 100755 --- a/contracts/marketManager/liquidationManager.sol +++ b/contracts/marketManager/liquidationManager.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/marketManagerInterface.sol"; import "../interfaces/managerDataStorageInterface.sol"; From 8494feb3d4dd84d9be95cb3cb289c649d6669f24 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 32/51] update contracts/marketManager/managerDataStorage/managerDataStorage.sol: refactored SafeMath expressions --- .../marketManager/managerDataStorage/managerDataStorage.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/marketManager/managerDataStorage/managerDataStorage.sol b/contracts/marketManager/managerDataStorage/managerDataStorage.sol index ddddb7c..9dc0a5e 100755 --- a/contracts/marketManager/managerDataStorage/managerDataStorage.sol +++ b/contracts/marketManager/managerDataStorage/managerDataStorage.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../../interfaces/managerDataStorageInterface.sol"; import "../../Errors.sol"; From 45e71889105d844e08ba2f125e5e87cf1851b818 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 33/51] update contracts/front/callProxy.sol: refactored SafeMath expressions --- contracts/front/callProxy.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/front/callProxy.sol b/contracts/front/callProxy.sol index 6e57483..61ba5ec 100755 --- a/contracts/front/callProxy.sol +++ b/contracts/front/callProxy.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "../interfaces/marketManagerInterface.sol"; From dc78cf0c5a5fc9f8b28c5df3ce9cd6d41f167ba8 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:22:59 -0500 Subject: [PATCH 34/51] update contracts/interestModel/interestModel.sol: refactored SafeMath expressions --- contracts/interestModel/interestModel.sol | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/contracts/interestModel/interestModel.sol b/contracts/interestModel/interestModel.sol index 74d652d..cb79a45 100755 --- a/contracts/interestModel/interestModel.sol +++ b/contracts/interestModel/interestModel.sol @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; import "../interfaces/interestModelInterface.sol"; import "../interfaces/marketHandlerDataStorageInterface.sol"; -import "../SafeMath.sol"; import "../Errors.sol"; /** @@ -13,7 +12,6 @@ import "../Errors.sol"; * @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) */ contract interestModel is interestModelInterface, InterestErrors { - using SafeMath for uint256; address owner; mapping(address => bool) public operators; @@ -182,7 +180,7 @@ contract interestModel is interestModelInterface, InterestErrors { function _viewInterestAmount(address handlerDataStorageAddr, address payable userAddr) internal view returns (bool, uint256, uint256, bool, uint256, uint256) { marketHandlerDataStorageInterface handlerDataStorage = marketHandlerDataStorageInterface(handlerDataStorageAddr); - uint256 blockDelta = block.number.sub(handlerDataStorage.getLastUpdatedBlock()); + uint256 blockDelta = block.number - handlerDataStorage.getLastUpdatedBlock(); /* check action in block */ uint256 globalDepositEXR; uint256 globalBorrowEXR; @@ -248,18 +246,18 @@ contract interestModel is interestModelInterface, InterestErrors { uint256 _jmpPoint = jumpPoint; /* BIR = minimumRate + (UtilRate * liquiditySensitivity) */ if(utilRate < _jmpPoint) { - BIR = utilRate.unifiedMul(basicSensitivity).add(minRate); + BIR = utilRate.unifiedMul(basicSensitivity) + minRate; } else { /* Formula : BIR = minRate + jumpPoint * basicSensitivity + (utilRate - jumpPoint) * jumpSensitivity uint256 _baseBIR = _jmpPoint.unifiedMul(basicSensitivity); - uint256 _jumpBIR = utilRate.sub(_jmpPoint).unifiedMul(jumpSensitivity); - BIR = minRate.add(_baseBIR).add(_jumpBIR); + uint256 _jumpBIR = utilRate - _jmpPoint.unifiedMul(jumpSensitivity); + BIR = minRate + _baseBIR + _jumpBIR; */ BIR = minRate - .add( _jmpPoint.unifiedMul(basicSensitivity) ) - .add( utilRate.sub(_jmpPoint).unifiedMul(jumpSensitivity) ); + + _jmpPoint.unifiedMul(basicSensitivity ) + + utilRate - _jmpPoint.unifiedMul(jumpSensitivity ); } /* SIR = UtilRate * BIR */ @@ -278,7 +276,7 @@ contract interestModel is interestModelInterface, InterestErrors { uint256 SIR; uint256 BIR; (SIR, BIR) = _getSIRandBIR(depositTotalAmount, borrowTotalAmount); - return ( SIR.div(blocksPerYear), BIR.div(blocksPerYear) ); + return ( SIR / blocksPerYear, BIR / blocksPerYear ); } /** @@ -290,7 +288,7 @@ contract interestModel is interestModelInterface, InterestErrors { */ function _getNewGlobalEXR(uint256 actionEXR, uint256 interestRate, uint256 delta) internal pure returns (uint256) { - return interestRate.mul(delta).add(unifiedPoint).unifiedMul(actionEXR); + return interestRate * delta + unifiedPoint.unifiedMul(actionEXR); } /** @@ -325,10 +323,10 @@ contract interestModel is interestModelInterface, InterestErrors { uint256 EXR = newGlobalEXR.unifiedDiv(lastUserEXR); if (EXR >= unifiedPoint) { - return ( false, EXR.sub(unifiedPoint) ); + return ( false, EXR - unifiedPoint ); } - return ( true, unifiedPoint.sub(EXR) ); + return ( true, unifiedPoint - EXR ); } //TODO: Need comment function getMinRate() external view returns (uint256) { From dcb11f03374f54254d4cf7272bef707a08cb027b Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 35/51] update contracts/interfaces/marketHandlerInterface.sol: refactored SafeMath expressions --- contracts/interfaces/marketHandlerInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/marketHandlerInterface.sol b/contracts/interfaces/marketHandlerInterface.sol index e3220ab..0efe5cc 100755 --- a/contracts/interfaces/marketHandlerInterface.sol +++ b/contracts/interfaces/marketHandlerInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's market handler interface From 069598d96f4a5d500cec60a67a00c4af586316c0 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 36/51] update contracts/interfaces/marketHandlerDataStorageInterface.sol: refactored SafeMath expressions --- contracts/interfaces/marketHandlerDataStorageInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/marketHandlerDataStorageInterface.sol b/contracts/interfaces/marketHandlerDataStorageInterface.sol index def3e01..3a931a3 100755 --- a/contracts/interfaces/marketHandlerDataStorageInterface.sol +++ b/contracts/interfaces/marketHandlerDataStorageInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's market handler data storage interface From 5d4b715415cecc09a5447e55ee0f2c7e22244273 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 37/51] update contracts/interfaces/liquidationManagerInterface.sol: refactored SafeMath expressions --- contracts/interfaces/liquidationManagerInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/liquidationManagerInterface.sol b/contracts/interfaces/liquidationManagerInterface.sol index dd7fa45..824f139 100755 --- a/contracts/interfaces/liquidationManagerInterface.sol +++ b/contracts/interfaces/liquidationManagerInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's liquidation manager interface From 03925138bd0ac6a6a0428bd0e4ee2c14734cd59d Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 38/51] update contracts/interfaces/SIInterface.sol: refactored SafeMath expressions --- contracts/interfaces/SIInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/SIInterface.sol b/contracts/interfaces/SIInterface.sol index ada08ba..4aa2ea4 100644 --- a/contracts/interfaces/SIInterface.sol +++ b/contracts/interfaces/SIInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's si interface From 9b6ca1436a93c34ca14be93983be8e6af55fb876 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 39/51] update contracts/interfaces/observerInterface.sol: refactored SafeMath expressions --- contracts/interfaces/observerInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/observerInterface.sol b/contracts/interfaces/observerInterface.sol index 897011e..0d58030 100644 --- a/contracts/interfaces/observerInterface.sol +++ b/contracts/interfaces/observerInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's observer interface From 4e7b9fe61066939d306d4a3c9a681fce12a14c4f Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 40/51] update contracts/interfaces/oracleInterface.sol: refactored SafeMath expressions --- contracts/interfaces/oracleInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/oracleInterface.sol b/contracts/interfaces/oracleInterface.sol index 8a2ac75..cab8481 100755 --- a/contracts/interfaces/oracleInterface.sol +++ b/contracts/interfaces/oracleInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; /** From 5aa4c0e60cdb98c1487dc9deac5a3efdbe2ae1fb Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 41/51] update contracts/interfaces/oracleProxyInterface.sol: refactored SafeMath expressions --- contracts/interfaces/oracleProxyInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/oracleProxyInterface.sol b/contracts/interfaces/oracleProxyInterface.sol index 69ab307..993461a 100755 --- a/contracts/interfaces/oracleProxyInterface.sol +++ b/contracts/interfaces/oracleProxyInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's oracle proxy interface From 90a3061d7b7d56ed9741d8714e72c7d5d789de82 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 42/51] update contracts/interfaces/marketSIHandlerDataStorageInterface.sol: refactored SafeMath expressions --- contracts/interfaces/marketSIHandlerDataStorageInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/marketSIHandlerDataStorageInterface.sol b/contracts/interfaces/marketSIHandlerDataStorageInterface.sol index f55ae01..ef43e04 100644 --- a/contracts/interfaces/marketSIHandlerDataStorageInterface.sol +++ b/contracts/interfaces/marketSIHandlerDataStorageInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's market si handler data storage interface From 3db694b56731ff97863bab961675d478c0665043 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 43/51] update contracts/interfaces/proxyContractInterface.sol: refactored SafeMath expressions --- contracts/interfaces/proxyContractInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/proxyContractInterface.sol b/contracts/interfaces/proxyContractInterface.sol index 2739458..1a49c81 100644 --- a/contracts/interfaces/proxyContractInterface.sol +++ b/contracts/interfaces/proxyContractInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's proxy interface From 5aaab384f0b3b4a3e476aeaffb904e74d9d90e49 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 44/51] update contracts/interfaces/marketManagerInterface.sol: refactored SafeMath expressions --- contracts/interfaces/marketManagerInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/marketManagerInterface.sol b/contracts/interfaces/marketManagerInterface.sol index 896b168..abfaabc 100755 --- a/contracts/interfaces/marketManagerInterface.sol +++ b/contracts/interfaces/marketManagerInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's market manager interface From 713c40336b20997ccc3293503239c4cc6263ffa4 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 45/51] update contracts/interfaces/managerDataStorageInterface.sol: refactored SafeMath expressions --- contracts/interfaces/managerDataStorageInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/managerDataStorageInterface.sol b/contracts/interfaces/managerDataStorageInterface.sol index cb0733a..bb1b806 100755 --- a/contracts/interfaces/managerDataStorageInterface.sol +++ b/contracts/interfaces/managerDataStorageInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's manager data storage interface From 21eff0d96c9d55823f030157261764cad00205c0 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 46/51] update contracts/interfaces/interestModelInterface.sol: refactored SafeMath expressions --- contracts/interfaces/interestModelInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/interestModelInterface.sol b/contracts/interfaces/interestModelInterface.sol index fb00e2f..f0c4448 100755 --- a/contracts/interfaces/interestModelInterface.sol +++ b/contracts/interfaces/interestModelInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's interest model interface From 0a374c50e22ae3487028a44c1f36a42023eccaf6 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 47/51] update contracts/interfaces/tokenInterface.sol: refactored SafeMath expressions --- contracts/interfaces/tokenInterface.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/tokenInterface.sol b/contracts/interfaces/tokenInterface.sol index 4eb1b41..1999fef 100755 --- a/contracts/interfaces/tokenInterface.sol +++ b/contracts/interfaces/tokenInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol -pragma solidity 0.6.12; +pragma solidity ^0.8.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); From 8854155d033d69991ab40db578378c758fbae308 Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 48/51] update contracts/interfacesForManager/managerDataStorageInterfaceForManager.sol: refactored SafeMath expressions --- .../managerDataStorageInterfaceForManager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfacesForManager/managerDataStorageInterfaceForManager.sol b/contracts/interfacesForManager/managerDataStorageInterfaceForManager.sol index 3fb4a00..cd6099f 100644 --- a/contracts/interfacesForManager/managerDataStorageInterfaceForManager.sol +++ b/contracts/interfacesForManager/managerDataStorageInterfaceForManager.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's manager data storage interface From 63003e2e37b4f408c0334e26bc000eccb9c7eceb Mon Sep 17 00:00:00 2001 From: juliustranquilli Date: Fri, 13 Dec 2024 15:23:00 -0500 Subject: [PATCH 49/51] update contracts/interfacesForManager/oracleProxyInterfaceForManager.sol: refactored SafeMath expressions --- .../interfacesForManager/oracleProxyInterfaceForManager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfacesForManager/oracleProxyInterfaceForManager.sol b/contracts/interfacesForManager/oracleProxyInterfaceForManager.sol index 832dc2e..62bb659 100644 --- a/contracts/interfacesForManager/oracleProxyInterfaceForManager.sol +++ b/contracts/interfacesForManager/oracleProxyInterfaceForManager.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.6.12; +pragma solidity ^0.8.0; /** * @title BiFi's oracle proxy interface From d07507220f5c2bc88e9c4ddac06019cb6747aa9a Mon Sep 17 00:00:00 2001 From: floor-licker Date: Fri, 13 Dec 2024 15:28:39 -0500 Subject: [PATCH 50/51] Remove blank spaces in interestModel.sol --- contracts/interestModel/interestModel.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/interestModel/interestModel.sol b/contracts/interestModel/interestModel.sol index cb79a45..3d459d6 100755 --- a/contracts/interestModel/interestModel.sol +++ b/contracts/interestModel/interestModel.sol @@ -256,8 +256,8 @@ contract interestModel is interestModelInterface, InterestErrors { BIR = minRate + _baseBIR + _jumpBIR; */ BIR = minRate - + _jmpPoint.unifiedMul(basicSensitivity ) - + utilRate - _jmpPoint.unifiedMul(jumpSensitivity ); + + _jmpPoint.unifiedMul(basicSensitivity) + + utilRate - _jmpPoint.unifiedMul(jumpSensitivity); } /* SIR = UtilRate * BIR */ From 7fa674f205f7f981140b7765d4d634f2675b5b4b Mon Sep 17 00:00:00 2001 From: floor-licker Date: Fri, 13 Dec 2024 15:30:30 -0500 Subject: [PATCH 51/51] Remove blank spaces in interestModel.sol --- contracts/interestModel/interestModel.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/interestModel/interestModel.sol b/contracts/interestModel/interestModel.sol index 3d459d6..eb68c2e 100755 --- a/contracts/interestModel/interestModel.sol +++ b/contracts/interestModel/interestModel.sol @@ -323,10 +323,10 @@ contract interestModel is interestModelInterface, InterestErrors { uint256 EXR = newGlobalEXR.unifiedDiv(lastUserEXR); if (EXR >= unifiedPoint) { - return ( false, EXR - unifiedPoint ); + return (false, EXR - unifiedPoint); } - return ( true, unifiedPoint - EXR ); + return (true, unifiedPoint - EXR); } //TODO: Need comment function getMinRate() external view returns (uint256) {