Skip to content

Commit

Permalink
Merge development branch to master branch (#537)
Browse files Browse the repository at this point in the history
## Key updates list
  
* SOV-2704-three-years-team-vestings (#508)

* SOV-2552 staking foundry fuzzy testing (#513)

* SOV-585 transfer the contract guardianship (#514)

* feature: add script to transfer amm ownership to governance (#450)

* SOV-3436-Proton-release

Move sovrynSwapsImpl to internal protocol module and public functions to a protocol module SwapsImplSovrynSwapModule. 
Includes SOV-3497 Refactor SovrynSwapsImpl.  
Deployment via bitocracy - SIP-0073.

* SOV-3613 Electron release

* SOV-3613: adding LoanOpenings and SwapsImplSovrynSwapLib deployment objects for integrated QA tests

* SOV-3613: adding VestingFactory and VestingLogic deployment objects for integretaed QA tests

* SOV-3161 Increase borrowing debt fix

* SOV-625 remove governance withdraw tokens
remove governanceWithdrawTokens from vestingLogic   
using vesting start date to start withdrawal  
introduce partial withdraw tokens in vesting contract

---------

Co-authored-by: ororopickpocket <[email protected]>
Co-authored-by: Santo Sinar Pandean <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Ororo Pickpocket <[email protected]>
Co-authored-by: cwsnt <[email protected]>
  • Loading branch information
6 people authored Feb 10, 2024
1 parent 38bee07 commit c8e36ed
Show file tree
Hide file tree
Showing 868 changed files with 339,303 additions and 24,214 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ coverage
types
reports
tmp
temp
deployment/deployments
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2020,
},
rules: {},
rules: {
"compiler-version": ["off"],
},
};
7 changes: 7 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ignore/
!.solhint.json
!.solhintignore
!.eslintignore
!.chainId
!.gitmodules
ignore
*.txt
*.log
Expand All @@ -34,11 +36,14 @@ cache
node_modules
artifacts/
cache/
cache_forge/
contracts_bzx/
tmp/
tmp
/temp/
temp/
temp
/out/
foundry/out/
abi
types/
typechain/
Expand All @@ -47,3 +52,5 @@ typechain/
*/deployments/*forked*
venv/
!/external/artifacts/
cache_hardhat/
foundry/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = foundry/lib/forge-std
url = https://github.com/foundry-rs/forge-std
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ types/
venv/
deployment/deployments
tmp/
temp/
out/
foundry/
cache_forge/
safe/
5 changes: 4 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": ["*.js", "*.test.js", "*.json"],
"options": {
"trailingComma": "es5",
"printWidth": 99,
"tabWidth": 4,
"useTabs": false,
Expand All @@ -11,8 +13,9 @@
}
},
{
"files": "*.sol",
"files": ["*.sol"],
"options": {
"parser": "solidity-parse",
"printWidth": 99,
"tabWidth": 4,
"useTabs": false,
Expand Down
2 changes: 2 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ module.exports = {
"node_modules",
"interfaces",
"events",
"tmp",
"temp",
],
};
7 changes: 5 additions & 2 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"extends": "solhint:recommended",
"rules": {
"prettier/prettier": "error",
"max-line-length": ["warn", 140],
"compiler-version": ["warn"]
"compiler-version": "warn",
"no-global-import": "warn",
"no-console": "warn",
"private-vars-leading-underscore": "warn"
}
}
6 changes: 5 additions & 1 deletion .solhintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ contracts/testhelpers
contracts/openzeppelin
contracts/mixins/EnumerableAddressSet.sol
contracts/interfaces
contracts/events
contracts/events
foundry
tests-foundry
tmp
temp
210 changes: 210 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,216 @@ Out of the box, Hardhat's [mainnet forking mode](https://hardhat.org/hardhat-net
not work with RSK. This package uses `patch-package` to patch the installed version of Hardhat to enable support for
forking from RSK. For more details, see [HARDHAT_FORKING.md](HARDHAT_FORKING.md).
## Slither (pre-requisite)
Slither is enabled as the static analyzer. Currently we introduce the static anlysis to the staking modules `npm run analyze:staking-modules`. <br/>
Before run this command, make sure that we have:
- [Slither](https://github.com/crytic/slither) installed
- The solc version 0.5.17 installed.
We can use [`solc-select`](https://github.com/crytic/solc-select) for managing the solc version.
[comment]: #solidoc (Start)
## Contracts
* [Address](docs/Address.md)
* [Administered](docs/Administered.md)
* [AdminRole](docs/AdminRole.md)
* [AdvancedToken](docs/AdvancedToken.md)
* [AdvancedTokenStorage](docs/AdvancedTokenStorage.md)
* [Affiliates](docs/Affiliates.md)
* [AffiliatesEvents](docs/AffiliatesEvents.md)
* [ApprovalReceiver](docs/ApprovalReceiver.md)
* [BProPriceFeed](docs/BProPriceFeed.md)
* [CheckpointsShared](docs/CheckpointsShared.md)
* [Constants](docs/Constants.md)
* [Context](docs/Context.md)
* [DevelopmentFund](docs/DevelopmentFund.md)
* [DummyContract](docs/DummyContract.md)
* [EnumerableAddressSet](docs/EnumerableAddressSet.md)
* [EnumerableBytes32Set](docs/EnumerableBytes32Set.md)
* [EnumerableBytes4Set](docs/EnumerableBytes4Set.md)
* [ERC20](docs/ERC20.md)
* [ERC20Detailed](docs/ERC20Detailed.md)
* [ErrorDecoder](docs/ErrorDecoder.md)
* [Escrow](docs/Escrow.md)
* [EscrowReward](docs/EscrowReward.md)
* [FeedsLike](docs/FeedsLike.md)
* [FeesEvents](docs/FeesEvents.md)
* [FeeSharingCollector](docs/FeeSharingCollector.md)
* [FeeSharingCollectorProxy](docs/FeeSharingCollectorProxy.md)
* [FeeSharingCollectorStorage](docs/FeeSharingCollectorStorage.md)
* [FeesHelper](docs/FeesHelper.md)
* [FourYearVesting](docs/FourYearVesting.md)
* [FourYearVestingFactory](docs/FourYearVestingFactory.md)
* [FourYearVestingLogic](docs/FourYearVestingLogic.md)
* [FourYearVestingStorage](docs/FourYearVestingStorage.md)
* [GenericTokenSender](docs/GenericTokenSender.md)
* [GovernorAlpha](docs/GovernorAlpha.md)
* [GovernorVault](docs/GovernorVault.md)
* [IApproveAndCall](docs/IApproveAndCall.md)
* [IChai](docs/IChai.md)
* [IContractRegistry](docs/IContractRegistry.md)
* [IConverterAMM](docs/IConverterAMM.md)
* [IERC1820Registry](docs/IERC1820Registry.md)
* [IERC20_](docs/IERC20_.md)
* [IERC20](docs/IERC20.md)
* [IERC777](docs/IERC777.md)
* [IERC777Recipient](docs/IERC777Recipient.md)
* [IERC777Sender](docs/IERC777Sender.md)
* [IFeeSharingCollector](docs/IFeeSharingCollector.md)
* [IFourYearVesting](docs/IFourYearVesting.md)
* [IFourYearVestingFactory](docs/IFourYearVestingFactory.md)
* [IFunctionsList](docs/IFunctionsList.md)
* [ILiquidityMining](docs/ILiquidityMining.md)
* [ILiquidityPoolV1Converter](docs/ILiquidityPoolV1Converter.md)
* [ILoanPool](docs/ILoanPool.md)
* [ILoanToken](docs/ILoanToken.md)
* [ILoanTokenLogicBeacon](docs/ILoanTokenLogicBeacon.md)
* [ILoanTokenLogicModules](docs/ILoanTokenLogicModules.md)
* [ILoanTokenLogicProxy](docs/ILoanTokenLogicProxy.md)
* [ILoanTokenModules](docs/ILoanTokenModules.md)
* [ILoanTokenWRBTC](docs/ILoanTokenWRBTC.md)
* [ILockedSOV](docs/ILockedSOV.md)
* [IMoCState](docs/IMoCState.md)
* [IModulesProxyRegistry](docs/IModulesProxyRegistry.md)
* [Initializable](docs/Initializable.md)
* [InterestUser](docs/InterestUser.md)
* [IPot](docs/IPot.md)
* [IPriceFeeds](docs/IPriceFeeds.md)
* [IPriceFeedsExt](docs/IPriceFeedsExt.md)
* [IProtocol](docs/IProtocol.md)
* [IRSKOracle](docs/IRSKOracle.md)
* [ISovryn](docs/ISovryn.md)
* [ISovrynSwapNetwork](docs/ISovrynSwapNetwork.md)
* [IStaking](docs/IStaking.md)
* [ISwapsImpl](docs/ISwapsImpl.md)
* [ITeamVesting](docs/ITeamVesting.md)
* [ITimelock](docs/ITimelock.md)
* [IV1PoolOracle](docs/IV1PoolOracle.md)
* [IVesting](docs/IVesting.md)
* [IVestingFactory](docs/IVestingFactory.md)
* [IVestingRegistry](docs/IVestingRegistry.md)
* [IWrbtc](docs/IWrbtc.md)
* [IWrbtcERC20](docs/IWrbtcERC20.md)
* [LenderInterestStruct](docs/LenderInterestStruct.md)
* [LiquidationHelper](docs/LiquidationHelper.md)
* [LiquidityMining](docs/LiquidityMining.md)
* [LiquidityMiningConfigToken](docs/LiquidityMiningConfigToken.md)
* [LiquidityMiningProxy](docs/LiquidityMiningProxy.md)
* [LiquidityMiningStorage](docs/LiquidityMiningStorage.md)
* [LoanClosingsEvents](docs/LoanClosingsEvents.md)
* [LoanClosingsLiquidation](docs/LoanClosingsLiquidation.md)
* [LoanClosingsRollover](docs/LoanClosingsRollover.md)
* [LoanClosingsShared](docs/LoanClosingsShared.md)
* [LoanClosingsWith](docs/LoanClosingsWith.md)
* [LoanClosingsWithoutInvariantCheck](docs/LoanClosingsWithoutInvariantCheck.md)
* [LoanInterestStruct](docs/LoanInterestStruct.md)
* [LoanMaintenance](docs/LoanMaintenance.md)
* [LoanMaintenanceEvents](docs/LoanMaintenanceEvents.md)
* [LoanOpenings](docs/LoanOpenings.md)
* [LoanOpeningsEvents](docs/LoanOpeningsEvents.md)
* [LoanParamsStruct](docs/LoanParamsStruct.md)
* [LoanSettings](docs/LoanSettings.md)
* [LoanSettingsEvents](docs/LoanSettingsEvents.md)
* [LoanStruct](docs/LoanStruct.md)
* [LoanToken](docs/LoanToken.md)
* [LoanTokenBase](docs/LoanTokenBase.md)
* [LoanTokenLogicBeacon](docs/LoanTokenLogicBeacon.md)
* [LoanTokenLogicLM](docs/LoanTokenLogicLM.md)
* [LoanTokenLogicProxy](docs/LoanTokenLogicProxy.md)
* [LoanTokenLogicStandard](docs/LoanTokenLogicStandard.md)
* [LoanTokenLogicStorage](docs/LoanTokenLogicStorage.md)
* [LoanTokenLogicWrbtc](docs/LoanTokenLogicWrbtc.md)
* [LoanTokenSettingsLowerAdmin](docs/LoanTokenSettingsLowerAdmin.md)
* [LockedSOV](docs/LockedSOV.md)
* [MarginTradeStructHelpers](docs/MarginTradeStructHelpers.md)
* [Medianizer](docs/Medianizer.md)
* [ModuleCommonFunctionalities](docs/ModuleCommonFunctionalities.md)
* [ModulesCommonEvents](docs/ModulesCommonEvents.md)
* [ModulesProxy](docs/ModulesProxy.md)
* [ModulesProxyRegistry](docs/ModulesProxyRegistry.md)
* [MultiSigKeyHolders](docs/MultiSigKeyHolders.md)
* [MultiSigWallet](docs/MultiSigWallet.md)
* [Mutex](docs/Mutex.md)
* [Objects](docs/Objects.md)
* [OrderStruct](docs/OrderStruct.md)
* [OrigingVestingCreator](docs/OrigingVestingCreator.md)
* [OriginInvestorsClaim](docs/OriginInvestorsClaim.md)
* [Ownable](docs/Ownable.md)
* [Pausable](docs/Pausable.md)
* [PausableOz](docs/PausableOz.md)
* [PreviousLoanToken](docs/PreviousLoanToken.md)
* [PreviousLoanTokenSettingsLowerAdmin](docs/PreviousLoanTokenSettingsLowerAdmin.md)
* [PriceFeedRSKOracle](docs/PriceFeedRSKOracle.md)
* [PriceFeeds](docs/PriceFeeds.md)
* [PriceFeedsLocal](docs/PriceFeedsLocal.md)
* [PriceFeedsMoC](docs/PriceFeedsMoC.md)
* [PriceFeedV1PoolOracle](docs/PriceFeedV1PoolOracle.md)
* [ProtocolAffiliatesInterface](docs/ProtocolAffiliatesInterface.md)
* [ProtocolLike](docs/ProtocolLike.md)
* [ProtocolSettings](docs/ProtocolSettings.md)
* [ProtocolSettingsEvents](docs/ProtocolSettingsEvents.md)
* [ProtocolSettingsLike](docs/ProtocolSettingsLike.md)
* [ProtocolSwapExternalInterface](docs/ProtocolSwapExternalInterface.md)
* [ProtocolTokenUser](docs/ProtocolTokenUser.md)
* [Proxy](docs/Proxy.md)
* [ProxyOwnable](docs/ProxyOwnable.md)
* [ReentrancyGuard](docs/ReentrancyGuard.md)
* [RewardHelper](docs/RewardHelper.md)
* [RSKAddrValidator](docs/RSKAddrValidator.md)
* [SafeERC20](docs/SafeERC20.md)
* [SafeMath](docs/SafeMath.md)
* [SafeMath96](docs/SafeMath96.md)
* [setGet](docs/setGet.md)
* [SharedReentrancyGuard](docs/SharedReentrancyGuard.md)
* [SignedSafeMath](docs/SignedSafeMath.md)
* [SOV](docs/SOV.md)
* [sovrynProtocol](docs/sovrynProtocol.md)
* [StakingAdminModule](docs/StakingAdminModule.md)
* [StakingGovernanceModule](docs/StakingGovernanceModule.md)
* [StakingInterface](docs/StakingInterface.md)
* [StakingProxy](docs/StakingProxy.md)
* [StakingRewards](docs/StakingRewards.md)
* [StakingRewardsProxy](docs/StakingRewardsProxy.md)
* [StakingRewardsStorage](docs/StakingRewardsStorage.md)
* [StakingShared](docs/StakingShared.md)
* [StakingStakeModule](docs/StakingStakeModule.md)
* [StakingStorageModule](docs/StakingStorageModule.md)
* [StakingStorageShared](docs/StakingStorageShared.md)
* [StakingVestingModule](docs/StakingVestingModule.md)
* [StakingWithdrawModule](docs/StakingWithdrawModule.md)
* [State](docs/State.md)
* [SwapsEvents](docs/SwapsEvents.md)
* [SwapsExternal](docs/SwapsExternal.md)
* [SwapsImplLocal](docs/SwapsImplLocal.md)
* [SwapsImplSovrynSwap](docs/SwapsImplSovrynSwap.md)
* [SwapsUser](docs/SwapsUser.md)
* [TeamVesting](docs/TeamVesting.md)
* [Timelock](docs/Timelock.md)
* [TimelockHarness](docs/TimelockHarness.md)
* [TimelockInterface](docs/TimelockInterface.md)
* [TokenSender](docs/TokenSender.md)
* [UpgradableProxy](docs/UpgradableProxy.md)
* [USDTPriceFeed](docs/USDTPriceFeed.md)
* [Utils](docs/Utils.md)
* [VaultController](docs/VaultController.md)
* [Vesting](docs/Vesting.md)
* [VestingCreator](docs/VestingCreator.md)
* [VestingFactory](docs/VestingFactory.md)
* [VestingLogic](docs/VestingLogic.md)
* [VestingRegistry](docs/VestingRegistry.md)
* [VestingRegistry2](docs/VestingRegistry2.md)
* [VestingRegistry3](docs/VestingRegistry3.md)
* [VestingRegistryLogic](docs/VestingRegistryLogic.md)
* [VestingRegistryProxy](docs/VestingRegistryProxy.md)
* [VestingRegistryStorage](docs/VestingRegistryStorage.md)
* [VestingStorage](docs/VestingStorage.md)
* [WeightedStakingModule](docs/WeightedStakingModule.md)
* [WRBTC](docs/WRBTC.md)
[comment]: #solidoc (End)
## Contributing
<a href="https://github.com/DistributedCollective/Sovryn-smart-contracts/graphs/contributors">
Expand Down
14 changes: 7 additions & 7 deletions contracts/connectors/loantoken/LoanToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ contract LoanToken is AdvancedTokenStorage {
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
switch result
case 0 {
revert(ptr, size)
}
default {
return(ptr, size)
}
case 0 {
revert(ptr, size)
}
default {
return(ptr, size)
}
}
}

Expand Down Expand Up @@ -140,6 +140,6 @@ contract LoanToken is AdvancedTokenStorage {
symbol = _symbol;
decimals = IERC20(loanTokenAddress).decimals();

initialPrice = 10**18; /// starting price of 1
initialPrice = 10 ** 18; /// starting price of 1
}
}
6 changes: 3 additions & 3 deletions contracts/connectors/loantoken/LoanTokenBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import "../../reentrancy/SharedReentrancyGuard.sol";
* use the BZRX tokens, which are only used to pay fees on the network currently.
* */
contract LoanTokenBase is ReentrancyGuard, SharedReentrancyGuard, Ownable, Pausable {
uint256 internal constant WEI_PRECISION = 10**18;
uint256 internal constant WEI_PERCENT_PRECISION = 10**20;
uint256 internal constant WEI_PRECISION = 10 ** 18;
uint256 internal constant WEI_PERCENT_PRECISION = 10 ** 20;

int256 internal constant sWEI_PRECISION = 10**18;
int256 internal constant sWEI_PRECISION = 10 ** 18;

/// @notice Standard ERC-20 properties
string public name;
Expand Down
Loading

0 comments on commit c8e36ed

Please sign in to comment.