diff --git a/contracts/stableCoin/microservices/IERC20.sol b/contracts/stableCoin/microservices/IERC20.sol index ac0d35e..28bb3b9 100644 --- a/contracts/stableCoin/microservices/IERC20.sol +++ b/contracts/stableCoin/microservices/IERC20.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; interface IERC20 { function mint(uint256 amount) external; diff --git a/contracts/stableCoin/microservices/IMVDFunctionalitiesManager.sol b/contracts/stableCoin/microservices/IMVDFunctionalitiesManager.sol index 72d2e2d..64d9e03 100644 --- a/contracts/stableCoin/microservices/IMVDFunctionalitiesManager.sol +++ b/contracts/stableCoin/microservices/IMVDFunctionalitiesManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; interface IMVDFunctionalitiesManager { function isAuthorizedFunctionality(address functionality) external view returns (bool); diff --git a/contracts/stableCoin/microservices/IMVDProxy.sol b/contracts/stableCoin/microservices/IMVDProxy.sol index a3021d5..fbfd67c 100644 --- a/contracts/stableCoin/microservices/IMVDProxy.sol +++ b/contracts/stableCoin/microservices/IMVDProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; interface IMVDProxy { function getToken() external view returns (address); diff --git a/contracts/stableCoin/microservices/IStateHolder.sol b/contracts/stableCoin/microservices/IStateHolder.sol index a61540d..a53be3d 100644 --- a/contracts/stableCoin/microservices/IStateHolder.sol +++ b/contracts/stableCoin/microservices/IStateHolder.sol @@ -1,4 +1,6 @@ -pragma solidity ^0.6.0; +// SPDX-License-Identifier: MIT + +pragma solidity ^0.7.0; interface IStateHolder { function clear(string calldata varName) diff --git a/contracts/stableCoin/microservices/MintNewVotingTokensForStableCoinFunctionality.sol b/contracts/stableCoin/microservices/MintNewVotingTokensForStableCoinFunctionality.sol index ff4b023..3574a15 100644 --- a/contracts/stableCoin/microservices/MintNewVotingTokensForStableCoinFunctionality.sol +++ b/contracts/stableCoin/microservices/MintNewVotingTokensForStableCoinFunctionality.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; import "./IERC20.sol"; import "./IMVDFunctionalitiesManager.sol"; diff --git a/contracts/stableCoin/standalone/Address.sol b/contracts/stableCoin/standalone/Address.sol index 6b28275..4af9fb8 100644 --- a/contracts/stableCoin/standalone/Address.sol +++ b/contracts/stableCoin/standalone/Address.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; /** * @dev Collection of functions related to the address type diff --git a/contracts/stableCoin/standalone/Context.sol b/contracts/stableCoin/standalone/Context.sol index 97c73c4..a193e82 100644 --- a/contracts/stableCoin/standalone/Context.sol +++ b/contracts/stableCoin/standalone/Context.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; /** * @dev Provides information about the current execution context, including the diff --git a/contracts/stableCoin/standalone/ERC20.sol b/contracts/stableCoin/standalone/ERC20.sol index 126be42..cddefcf 100644 --- a/contracts/stableCoin/standalone/ERC20.sol +++ b/contracts/stableCoin/standalone/ERC20.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; import "./Context.sol"; import "./IERC20.sol"; diff --git a/contracts/stableCoin/standalone/IDoubleProxy.sol b/contracts/stableCoin/standalone/IDoubleProxy.sol index 5b6c101..0ddd2d2 100644 --- a/contracts/stableCoin/standalone/IDoubleProxy.sol +++ b/contracts/stableCoin/standalone/IDoubleProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; // DOCUMENT interface IDoubleProxy { diff --git a/contracts/stableCoin/standalone/IERC20.sol b/contracts/stableCoin/standalone/IERC20.sol index 82708eb..841d27a 100644 --- a/contracts/stableCoin/standalone/IERC20.sol +++ b/contracts/stableCoin/standalone/IERC20.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. diff --git a/contracts/stableCoin/standalone/IMVDFunctionalitiesManager.sol b/contracts/stableCoin/standalone/IMVDFunctionalitiesManager.sol index a99e8f2..c68f7c5 100644 --- a/contracts/stableCoin/standalone/IMVDFunctionalitiesManager.sol +++ b/contracts/stableCoin/standalone/IMVDFunctionalitiesManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; // DOCUMENT interface IMVDFunctionalitiesManager { diff --git a/contracts/stableCoin/standalone/IMVDProxy.sol b/contracts/stableCoin/standalone/IMVDProxy.sol index b4c6d23..83657ea 100644 --- a/contracts/stableCoin/standalone/IMVDProxy.sol +++ b/contracts/stableCoin/standalone/IMVDProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; // DOCUMENT interface IMVDProxy { diff --git a/contracts/stableCoin/standalone/IStableCoin.sol b/contracts/stableCoin/standalone/IStableCoin.sol index 6aef2f0..ba8745f 100644 --- a/contracts/stableCoin/standalone/IStableCoin.sol +++ b/contracts/stableCoin/standalone/IStableCoin.sol @@ -1,10 +1,15 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; /** - * @title Interface for the "uSD" AKA "uniswap State Dollar", Unifi stablecoin. - * @dev Define the interface for the usD + * @title Interface for the $uSD aka unified Stable Dollar. + * @dev Define the interface for the $usD + * + * The core idea behind Unified Stable Coin is to implement a stable coin collateralized by pools of whitelisted + * stable coins on UniSwap. By hedging across several pools and implementing simple yet effective + * rebalancing schemes, $uSD is able reduce an holder exposure to a stable-coin failure. + * */ interface IStableCoin { /** @@ -14,7 +19,7 @@ interface IStableCoin { * @param symbol ticker for the StableCoin ERC20 token * @param doubleProxy address for the DoubleProxy * @param allowedPairs array of Uniswap Pairs to be set as whitelisted source tokens - * @param rebalanceRewardMultiplier multiplier used to compute how many unifi tokens to mint during uSD rebalance + * @param rebalanceRewardMultiplier multiplier used to compute how many unifi tokens to mint during $uSD rebalance * @param timeWindows time windows inside which some time-delimited operations can be performed * @param mintables max amount of mintables inside a timeWindow */ @@ -81,17 +86,17 @@ interface IStableCoin { /** * @dev Compute the reward of the rebalanceByDebt() operation. * - * @param burnt amount of of uSD burnt + * @param burnt amount of of $uSD burnt */ function calculateRebalanceByDebtReward(uint256 burnt) external view returns (uint256 reward); /** - * @dev Convert from one of the allowed whitelisted tokens to uSD + * @dev Convert from one of the allowed whitelisted tokens to $uSD * * @param tokenAddress Address of the token to convert * @param amount Amount of Unifi token to be converted * - * @return Amount of uSD tokens + * @return Amount of $uSD tokens */ function fromTokenToStable(address tokenAddress, uint256 amount) external @@ -100,7 +105,7 @@ interface IStableCoin { /** * Mint logic of the StableCoin. - * @dev Mint the uSD token + * @dev Mint the $uSD token * * @param pairIndex Index of the pair inside the allowedPairs array * @param amountA The amount of tokenA to add as liquidity if the B/A price is <= @@ -112,7 +117,7 @@ interface IStableCoin { * @param amountBMin Bounds the extent to which the A/B price can go up before the transaction reverts. * Must be <= amountBDesired * - * @return Amount of freshly minted uSD token + * @return Amount of freshly minted $uSD token */ function mint( uint256 pairIndex, @@ -124,7 +129,7 @@ interface IStableCoin { /** * Mint logic of the StableCoin. - * @dev Mint the uSD token + * @dev Mint the $uSD token * * @param pairIndex Index of the pair inside the allowedPairs array * @param amountAMin The minimum amount of tokenA that must be received for the transaction not to revert @@ -142,8 +147,8 @@ interface IStableCoin { ) external returns (uint256 amountA, uint256 amountB); /** - * @dev Rebalance by Credit is triggered when the total amount of source tokens' value is greater - * than uSD circulating supply. Rebalancing is done by withdrawing the excess from the pool. + * @dev Rebalance by Credit is triggered when the total amount of source tokens' is greater + * than $uSD circulating supply. Rebalancing is done by withdrawing the excess from the pool. * * @notice Positive imbalances can be caused by the accrual of liquidity provider fee. Withdrawn tokens * are stored inside the Unifi DFO as a source of long-term value @@ -156,11 +161,12 @@ interface IStableCoin { ) external returns (uint256 redeemed); /** - * @dev Rebalance by Credit is triggered when the total amount of source tokens' value is greater - * than uSD circulating supply. Rebalancing is done by withdrawing the excess from the pool. + * @dev Rebalance by Debt is triggered when the total amount of source tokens' is lesser + * than $uSD circulating supply. Rebalancing is done by minting new equity ($unifi) at premium + * in exchange for burning $uSD. * - * @notice Positive imbalances can be caused by the accrual of liquidity provider fee. Withdrawn tokens - * are stored inside the Unifi DFO as a source of long-term value + * @notice Negative imbalances can be caused by the failure of a Stable Coin in one of the whitelisted + * source pairs. */ function rebalanceByDebt(uint256 amount) external returns (uint256); } diff --git a/contracts/stableCoin/standalone/IStateHolder.sol b/contracts/stableCoin/standalone/IStateHolder.sol index 9a23fb8..c3b0e3f 100644 --- a/contracts/stableCoin/standalone/IStateHolder.sol +++ b/contracts/stableCoin/standalone/IStateHolder.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; // DOCUMENT interface IStateHolder { diff --git a/contracts/stableCoin/standalone/IUniswapV2Pair.sol b/contracts/stableCoin/standalone/IUniswapV2Pair.sol index 7658298..2a1c7b3 100644 --- a/contracts/stableCoin/standalone/IUniswapV2Pair.sol +++ b/contracts/stableCoin/standalone/IUniswapV2Pair.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; // DOCUMENT /** diff --git a/contracts/stableCoin/standalone/IUniswapV2Router.sol b/contracts/stableCoin/standalone/IUniswapV2Router.sol index eb3849b..ae81a16 100644 --- a/contracts/stableCoin/standalone/IUniswapV2Router.sol +++ b/contracts/stableCoin/standalone/IUniswapV2Router.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; /** * @title Uniswap V2 Router diff --git a/contracts/stableCoin/standalone/SafeMath.sol b/contracts/stableCoin/standalone/SafeMath.sol index b2e90e8..541864b 100644 --- a/contracts/stableCoin/standalone/SafeMath.sol +++ b/contracts/stableCoin/standalone/SafeMath.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow diff --git a/contracts/stableCoin/standalone/StableCoin.sol b/contracts/stableCoin/standalone/StableCoin.sol index bff3f4c..6d5a952 100644 --- a/contracts/stableCoin/standalone/StableCoin.sol +++ b/contracts/stableCoin/standalone/StableCoin.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; import "./ERC20.sol"; import "./IStableCoin.sol"; @@ -13,7 +13,7 @@ import "./IUniswapV2Router.sol"; /** * @title StableCoin - * @dev Contract for the "uSD" Stable Coin. + * @dev Contract for the $uSD Stable Coin. * It's an ERC20 token extended with the IStableCoin interface and DFO protocol magic. */ contract StableCoin is ERC20, IStableCoin { diff --git a/docs/to_lowercase.sh b/docs/to_lowercase.sh old mode 100644 new mode 100755 index 80ec06f..b7beca3 --- a/docs/to_lowercase.sh +++ b/docs/to_lowercase.sh @@ -1,3 +1,3 @@ #! /bin/bash -sed -i -E 's/(\(#.*)/\L\1\E/g' md-build/stableCoin/**/*.md +sed -i -E 's/((#.*)/L1E/g' md-build/stableCoin/**/*.md diff --git a/package.json b/package.json index 20de3cc..aa8b0b3 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "docs:build": "yarn docs:docgen && yarn docs:mkdocs:build", "docs:clean": "rm -r docs/{md-build,build}", "docs:serve": "yarn docs:docgen && yarn docs:mkdocs:serve", - "docs:docgen": "cd docs && solidity-docgen -i ../contracts -o md-build -t solidity-docgen-templates && cp ../*.md md-build", + "docs:docgen": "cd docs && solidity-docgen -i ../contracts -o md-build -t solidity-docgen-templates && cp ../*.md md-build && ./to_lowercase.sh", "docs:mkdocs:build": "cd docs && mkdocs build", "docs:mkdocs:serve": "yarn docs:docgen && cd docs && mkdocs serve" }