Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors #152

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions contracts/BaseOrchestrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import "@openzeppelin/contracts/introspection/ERC165Checker.sol";
import "./IVaultHandler.sol";
import "./oracles/ChainlinkOracle.sol";
import "./Proprietor.sol";
import "./TCAP.sol";
import "./IndexToken.sol";

/**
* @title TCAP Orchestrator
* @title Cryptex Orchestrator
* @author Cryptex.finance
* @notice Orchestrator contract in charge of managing the settings of the vaults, rewards and TCAP token. It acts as the owner of these contracts.
* @notice Orchestrator contract in charge of managing the settings of the vaults, rewards and Index token. It acts as the owner of these contracts.
*/
abstract contract BaseOrchestrator is Proprietor {
/// @dev Enum which saves the available functions to emergency call.
Expand All @@ -27,7 +27,7 @@ abstract contract BaseOrchestrator is Proprietor {

/** @dev Interface constants*/
bytes4 private constant _INTERFACE_ID_IVAULT = 0x9e75ab0c;
bytes4 private constant _INTERFACE_ID_TCAP = 0xbd115939;
bytes4 private constant _INTERFACE_ID_INDEX = 0xbd115939;
bytes4 private constant _INTERFACE_ID_CHAINLINK_ORACLE = 0x85be402b;

/// @dev tracks which vault was emergency called
Expand Down Expand Up @@ -79,13 +79,13 @@ abstract contract BaseOrchestrator is Proprietor {
}

/**
* @notice Throws if TCAP Token is not valid
* @param _tcap address
* @notice Throws if Index Token is not valid
* @param _indexToken address
*/
modifier validTCAP(TCAP _tcap) {
modifier validIndex(IndexToken _indexToken) {
require(
ERC165Checker.supportsInterface(address(_tcap), _INTERFACE_ID_TCAP),
"BaseOrchestrator::validTCAP: not a valid TCAP ERC20"
ERC165Checker.supportsInterface(address(_indexToken), _INTERFACE_ID_INDEX),
"BaseOrchestrator::validIndex: not a valid Index Token"
);
_;
}
Expand Down Expand Up @@ -262,67 +262,67 @@ abstract contract BaseOrchestrator is Proprietor {
}

/**
* @notice Enables or disables the TCAP Cap
* @param _tcap address
* @notice Enables or disables the Index Token Cap
* @param _indexToken address
* @param _enable bool
* @dev Only owner can call it
* @dev Validates if _tcap is valid
* @dev Validates if _indexToken is valid
*/
function enableTCAPCap(TCAP _tcap, bool _enable)
function enableIndexCap(IndexToken _indexToken, bool _enable)
external
onlyOwner
validTCAP(_tcap)
validIndex(_indexToken)
{
_tcap.enableCap(_enable);
_indexToken.enableCap(_enable);
}

/**
* @notice Sets the TCAP maximum minting value
* @param _tcap address
* @notice Sets the Index Token maximum minting value
* @param _indexToken address
* @param _cap uint value
* @dev Only owner can call it
* @dev Validates if _tcap is valid
* @dev Validates if _indexToken is valid
*/
function setTCAPCap(TCAP _tcap, uint256 _cap)
function setIndexCap(IndexToken _indexToken, uint256 _cap)
external
onlyOwner
validTCAP(_tcap)
validIndex(_indexToken)
{
_tcap.setCap(_cap);
_indexToken.setCap(_cap);
}

/**
* @notice Adds Vault to TCAP ERC20
* @param _tcap address
* @notice Adds Vault to Index Token
* @param _indexToken address
* @param _vault address
* @dev Only owner can call it
* @dev Validates if _tcap is valid
* @dev Validates if _indexToken is valid
* @dev Validates if _vault is valid
*/
function addTCAPVault(TCAP _tcap, IVaultHandler _vault)
function addIndexVault(IndexToken _indexToken, IVaultHandler _vault)
external
onlyOwner
validTCAP(_tcap)
validIndex(_indexToken)
validVault(_vault)
{
_tcap.addVaultHandler(address(_vault));
_indexToken.addVaultHandler(address(_vault));
}

/**
* @notice Removes Vault to TCAP ERC20
* @param _tcap address
* @notice Removes Vault to Index Token
* @param _indexToken address
* @param _vault address
* @dev Only owner can call it
* @dev Validates if _tcap is valid
* @dev Validates if _indexToken is valid
* @dev Validates if _vault is valid
*/
function removeTCAPVault(TCAP _tcap, IVaultHandler _vault)
function removeIndexVault(IndexToken _indexToken, IVaultHandler _vault)
external
onlyOwner
validTCAP(_tcap)
validIndex(_indexToken)
validVault(_vault)
{
_tcap.removeVaultHandler(address(_vault));
_indexToken.removeVaultHandler(address(_vault));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/BaseTreasury.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.7.5;
import "./Proprietor.sol";

/**
* @title TCAP Treasury
* @title "Cryptex Treasury
* @author Cryptex.finance
* @notice This contract will hold the assets generated on L2 networks.
*/
Expand Down
22 changes: 11 additions & 11 deletions contracts/ERC20VaultHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import "./IVaultHandler.sol";
import "./Orchestrator.sol";

/**
* @title ERC-20 TCAP Vault
* @title ERC-20 Index Token Vault
* @author Cryptex.finance
* @notice Contract in charge of handling the TCAP Vault and stake using a Collateral ERC20
* @notice Contract in charge of handling the Index Token Vault and stake using a Collateral ERC20
*/
contract ERC20VaultHandler is IVaultHandler {
/**
Expand All @@ -18,13 +18,13 @@ contract ERC20VaultHandler is IVaultHandler {
* @param _burnFee uint256
* @param _mintFee uint256
* @param _liquidationPenalty uint256
* @param _tcapOracle address
* @param _tcapAddress address
* @param _indexOracle address
* @param _indexAddress address
* @param _collateralAddress address
* @param _collateralOracle address
* @param _ethOracle address
* @param _treasury address
* @param _minimumTCAP uint256
* @param _minimumMint uint256
*/
constructor(
Orchestrator _orchestrator,
Expand All @@ -33,13 +33,13 @@ contract ERC20VaultHandler is IVaultHandler {
uint256 _burnFee,
uint256 _mintFee,
uint256 _liquidationPenalty,
address _tcapOracle,
TCAP _tcapAddress,
address _indexOracle,
IndexToken _indexAddress,
address _collateralAddress,
address _collateralOracle,
address _ethOracle,
address _treasury,
uint256 _minimumTCAP
uint256 _minimumMint
)
IVaultHandler(
_orchestrator,
Expand All @@ -48,13 +48,13 @@ contract ERC20VaultHandler is IVaultHandler {
_burnFee,
_mintFee,
_liquidationPenalty,
_tcapOracle,
_tcapAddress,
_indexOracle,
_indexAddress,
_collateralAddress,
_collateralOracle,
_ethOracle,
_treasury,
_minimumTCAP
_minimumMint
)
{}
}
22 changes: 11 additions & 11 deletions contracts/ETHVaultHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import "./IWETH.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

/**
* @title ETH TCAP Vault
* @title ETH Index Token Vault
* @author Cryptex.finance
* @notice Contract in charge of handling the TCAP Vault and stake using a ETH and WETH
* @notice Contract in charge of handling the Index Token Vault and stake using a ETH and WETH
*/
contract ETHVaultHandler is IVaultHandler {
/// @notice Open Zeppelin libraries
Expand All @@ -23,13 +23,13 @@ contract ETHVaultHandler is IVaultHandler {
* @param _burnFee uint256
* @param _mintFee uint256
* @param _liquidationPenalty uint256
* @param _tcapOracle address
* @param _tcapAddress address
* @param _indexOracle address
* @param _indexAddress address
* @param _collateralAddress address
* @param _collateralOracle address
* @param _ethOracle address
* @param _treasury address
* @param _minimumTCAP uint256
* @param _minimumMint uint256
*/
constructor(
Orchestrator _orchestrator,
Expand All @@ -38,13 +38,13 @@ contract ETHVaultHandler is IVaultHandler {
uint256 _burnFee,
uint256 _mintFee,
uint256 _liquidationPenalty,
address _tcapOracle,
TCAP _tcapAddress,
address _indexOracle,
IndexToken _indexAddress,
address _collateralAddress,
address _collateralOracle,
address _ethOracle,
address _treasury,
uint256 _minimumTCAP
uint256 _minimumMint
)
IVaultHandler(
_orchestrator,
Expand All @@ -53,13 +53,13 @@ contract ETHVaultHandler is IVaultHandler {
_burnFee,
_mintFee,
_liquidationPenalty,
_tcapOracle,
_tcapAddress,
_indexOracle,
_indexAddress,
_collateralAddress,
_collateralOracle,
_ethOracle,
_treasury,
_minimumTCAP
_minimumMint
)
{}

Expand Down
Loading