Contract 0x58254B405E85359Fc7Eb3b8856bA82A4dD7C82E2

 
Txn Hash
Method
Block
From
To
Value
0x9e10407c3f099d3951d07b35da825c930b273ce22fa8d48c1d987e5f827833e7Transfer Ownersh...126475402021-06-16 19:58:00425 days 5 hrs agoIchi.Farm: Deployer IN  ICHI: Incremental Mint Master0 Ether0.‍0006044821
0x0a9e4f57371ab99efb70e6b5c4eac9cb3f39d8cfa27f8e8e5a55ff42a3640bca0x60c06040125056652021-05-25 20:34:06447 days 4 hrs agoIchi.Farm: Deployer IN  Create: Incremental0 Ether0.‍079348440
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Incremental

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 19 : Incremental.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "../MintMasterCommon.sol";
import "../../interface/IOneTokenV1.sol";
import "../../interface/IOracle.sol";

/**
 * @notice Multi-tenant implementation with parameters managed by separate governing authorities.
 */

contract Incremental is MintMasterCommon {
    
    uint256 constant DEFAULT_RATIO = 10 ** 18; // 100%
    uint256 constant DEFAULT_STEP_SIZE = 0;
    uint256 constant DEFAULT_MAX_ORDER_VOLUME = INFINITE;

    struct Parameters {
        bool set;
        uint256 minRatio;
        uint256 maxRatio;
        uint256 stepSize;
        uint256 lastRatio;  
        uint256 maxOrderVolume;    
    }

    uint256 lastUpdatedBlock;

    mapping(address => Parameters) public parameters;

    event OneTokenOracleChanged(address sender, address oneToken, address oracle);
    event SetParams(address sender, address oneToken, uint256 minRatio, uint256 maxRatio, uint256 stepSize, uint256 initialRatio, uint256 maxOrderVolume);
    event UpdateMintingRatio(address sender, address oneToken, uint256 newRatio, uint256 maxOrderVolume);
    event StepSizeSet(address sender, address oneToken, uint256 stepSize);
    event MinRatioSet(address sender, address oneToken, uint256 minRatio);
    event MaxRatioSet(address sender, address oneToken, uint256 maxRatio);
    event RatioSet(address sender, address oneToken, uint256 ratio);
   
    constructor(address oneTokenFactory_, string memory description_) 
        MintMasterCommon(oneTokenFactory_, description_) {}

    /**
     @notice initializes the common interface with parameters managed by msg.sender, usually a oneToken.
     @dev A single instance can be shared by n oneToken implementations. Initialize from each instance. Re-initialization is acceptabe.
     @param oneTokenOracle gets the exchange rate of the oneToken
     */
    function init(address oneTokenOracle) external onlyKnownToken override {
        _setParams(msg.sender, DEFAULT_RATIO, DEFAULT_RATIO, DEFAULT_STEP_SIZE, DEFAULT_RATIO, DEFAULT_MAX_ORDER_VOLUME);
        _initMintMaster(msg.sender, oneTokenOracle);
        lastUpdatedBlock = block.number;
        emit MintMasterInitialized(msg.sender, msg.sender, oneTokenOracle);
    }

    /**
     @notice changes the oracle used to assess the oneTokens' value in relation to the peg
     @dev may use the peggedOracle (efficient but not informative) or an active oracle 
     @param oneToken oneToken vault (also ERC20 token)
     @param oracle oracle contract must be registered in the factory
     */
    function changeOracle(address oneToken, address oracle) external onlyTokenOwner(oneToken) {
        require(IOneTokenFactory(oneTokenFactory).isOracle(oneToken, oracle), "Incremental: oracle is not approved for oneToken");
        _initMintMaster(oneToken, oracle);      
        emit OneTokenOracleChanged(msg.sender, oneToken, oracle);
    }

    /**
     @notice updates parameters for a given oneToken that uses this module
     @dev inspects the oneToken implementation to establish authority
     @param oneToken token context for parameters
     @param minRatio minimum minting ratio that will be set
     @param maxRatio maximum minting ratio that will be set
     @param stepSize adjustment size iteration
     @param initialRatio unadjusted starting minting ratio
     */
    function setParams(
        address oneToken, 
        uint256 minRatio, 
        uint256 maxRatio, 
        uint256 stepSize, 
        uint256 initialRatio,
        uint256 maxOrderVolume
    ) 
        external
        onlyTokenOwner(oneToken)
    {
        _setParams(oneToken, minRatio, maxRatio, stepSize, initialRatio, maxOrderVolume);
    }

    function _setParams(
        address oneToken, 
        uint256 minRatio, 
        uint256 maxRatio, 
        uint256 stepSize, 
        uint256 initialRatio,
        uint256 maxOrderVolume
    ) 
        private
    {
        Parameters storage p = parameters[oneToken];
        require(minRatio <= maxRatio, "Incremental: minRatio must be <= maxRatio");
        require(maxRatio <= PRECISION, "Incremental: maxRatio must be <= 10 ** 18");
        // Can be zero to prevent movement
        // require(stepSize > 0, "Incremental: stepSize must be > 0");
        require(stepSize < maxRatio - minRatio || stepSize == 0, "Incremental: stepSize must be < (max - min) or zero.");
        require(initialRatio >= minRatio, "Incremental: initial ratio must be >= min ratio.");
        require(initialRatio <= maxRatio, "Incremental: initial ratio must be <= max ratio.");
        p.minRatio = minRatio;
        p.maxRatio = maxRatio;
        p.stepSize = stepSize;
        p.lastRatio = initialRatio;
        p.maxOrderVolume = maxOrderVolume;
        p.set = true;
        emit SetParams(msg.sender, oneToken, minRatio, maxRatio, stepSize, initialRatio, maxOrderVolume);
    }
 
    /**
     @notice returns an adjusted minting ratio
     @dev oneToken contracts call this to get their own minting ratio
     // collateralToken argument in the interface supports future-use cases
     @param ratio the minting ratio
     @param maxOrderVolume recommended maximum order size, specified by governance. Defaults to unlimited
     */
    function getMintingRatio(address /* collateralToken */) external view override returns(uint256 ratio, uint256 maxOrderVolume) {
        return getMintingRatio2(msg.sender, NULL_ADDRESS);
    }

    /**
     @notice returns an adjusted minting ratio. OneTokens use this function and it relies on initialization to select the oracle
     @dev anyone calls this to inspect any oneToken minting ratio based on the oracle chosen at initialization
     @param oneToken oneToken implementation to inspect
     // collateralToken argument in the interface supports future-use cases
     @param ratio the minting ratio
     @param maxOrderVolume recommended maximum order size, specified by governance. Defaults to unlimited     
     */    

    function getMintingRatio2(address oneToken, address /* collateralToken */) public view override returns(uint256 ratio, uint256 maxOrderVolume) {
        address oracle = oneTokenOracles[oneToken];
        return getMintingRatio4(oneToken, oracle, NULL_ADDRESS, NULL_ADDRESS);
    }

    /**
     @notice returns an adjusted minting ratio
     @dev anyone calls this to inspect any oneToken minting ratio based on arbitry oracles
     @param oneToken oneToken implementation to inspect
     @param oneTokenOracle explicit oracle selection
     // collateralToken argument in the interface supports future-use cases
     @param ratio the minting ratio
     @param maxOrderVolume recommended maximum order size, specified by governance. Defaults to unlimited     
     */   
    function getMintingRatio4(address oneToken, address oneTokenOracle, address /* collateralToken */, address /* collateralOracle */) public override view returns(uint256 ratio, uint256 maxOrderVolume) {
        Parameters storage p = parameters[oneToken];
        require(p.set, "Incremental: mintmaster is not initialized");
        
        // Both OneToken and oracle response are in precision 18. No conversion is necessary.
        (uint256 quote, /* uint256 volatility */ ) = IOracle(oneTokenOracle).read(oneToken, PRECISION);
        ratio = p.lastRatio;        
        if(quote == PRECISION) return(ratio, p.maxOrderVolume);
        uint256 stepSize = p.stepSize;
        maxOrderVolume = p.maxOrderVolume;
        if(quote < PRECISION && ratio < p.maxRatio) {
            ratio += stepSize;
            if (ratio > p.maxRatio) {
                ratio = p.maxRatio;
            }
        }
        if(quote > PRECISION && ratio > p.minRatio) {
            ratio -= stepSize;
            if (ratio < p.minRatio) {
                ratio = p.minRatio;
            }
        }
    }

    /**
     @notice records and returns an adjusted minting ratio for a oneToken implemtation
     @dev oneToken implementations calls this periodically, e.g. in the minting process
     // collateralToken argument in the interface supports future-use cases
     @param ratio the minting ratio
     @param maxOrderVolume recommended maximum order size, specified by governance. Defaults to unlimited
     */
    function updateMintingRatio(address /* collateralToken */) external override returns(uint256 ratio, uint256 maxOrderVolume) {
        if (lastUpdatedBlock >= block.number) {
            (ratio, maxOrderVolume) = getMintingRatio2(msg.sender, NULL_ADDRESS);
        } else {
            lastUpdatedBlock = block.number;
            return _updateMintingRatio(msg.sender, NULL_ADDRESS);
        }
    }

    /**
     @notice records and returns an adjusted minting ratio for a oneToken implemtation
     @dev internal use only
     @param oneToken the oneToken implementation to evaluate
     // collateralToken argument in the interface supports future-use cases
     @param ratio the minting ratio
     @param maxOrderVolume recommended maximum order size, specified by governance. Defaults to unlimited
     */    
    function _updateMintingRatio(address oneToken, address /* collateralToken */) private returns(uint256 ratio, uint256 maxOrderVolume) {
        Parameters storage p = parameters[oneToken];
        require(p.set, "Incremental: mintmaster is not initialized");
        address o = oneTokenOracles[oneToken];
        IOracle(o).update(oneToken);
        (ratio, maxOrderVolume) = getMintingRatio2(oneToken, NULL_ADDRESS);
        p.lastRatio = ratio;
        emit UpdateMintingRatio(msg.sender, oneToken, ratio, maxOrderVolume);
    }

    /**
     * Governance functions
     */

    /**
     @notice adjusts the rate of minting ratio change
     @dev only the governance that owns the token implentation can adjust the mintMaster's parameters
     @param oneToken the implementation to work with
     @param stepSize the step size must be smaller than the difference of min and max
     */
    function setStepSize(address oneToken, uint256 stepSize) external onlyTokenOwner(oneToken) {
        Parameters storage p = parameters[oneToken];
        require(stepSize < p.maxRatio - p.minRatio || stepSize == 0, "Incremental: stepSize must be < (max - min) or zero.");
        p.stepSize = stepSize;
        emit StepSizeSet(msg.sender, oneToken, stepSize);
    }

    /**
     @notice sets the minimum minting ratio
     @dev only the governance that owns the token implentation can adjust the mintMaster's parameters
     if the new minimum is higher than current minting ratio, the current ratio will be adjusted to minRatio
     @param oneToken the implementation to work with
     @param minRatio the new lower bound for the minting ratio
     */    
    function setMinRatio(address oneToken, uint256 minRatio) external onlyTokenOwner(oneToken) {
        Parameters storage p = parameters[oneToken];
        require(minRatio <= p.maxRatio, "Incremental: minRatio must be <= maxRatio");
        require(p.stepSize < p.maxRatio - minRatio || p.stepSize == 0, "Incremental: stepSize must be < (max - min) or zero.");
        p.minRatio = minRatio;
        if(minRatio > p.lastRatio) setRatio(oneToken, minRatio);
        emit MinRatioSet(msg.sender, oneToken, minRatio);
    }

    /**
     @notice sets the maximum minting ratio
     @dev only the governance that owns the token implentation can adjust the mintMaster's parameters
     if the new maximum is lower is than current minting ratio, the current ratio will be set to maxRatio
     @param oneToken the implementation to work with
     @param maxRatio the new upper bound for the minting ratio
     */ 
    function setMaxRatio(address oneToken, uint256 maxRatio) external onlyTokenOwner(oneToken) {
        Parameters storage p = parameters[oneToken];
        require(maxRatio >= p.minRatio, "Incremental: maxRatio must be >= minRatio");
        require(maxRatio <= PRECISION, "Incremental: maxRatio must <= 100%");
        require(p.stepSize < maxRatio - p.minRatio || p.stepSize == 0, "Incremental: stepSize must be < (max - min) or zero.");
        p.maxRatio = maxRatio;
        if(maxRatio < p.lastRatio) setRatio(oneToken, maxRatio);
        emit MaxRatioSet(msg.sender, oneToken, maxRatio);
    }

    /**
     @notice sets the current minting ratio
     @dev only the governance that owns the token implentation can adjust the mintMaster's parameters
     @param oneToken the implementation to work with
     @param ratio must be in the min-max range
     */
    function setRatio(address oneToken, uint256 ratio) public onlyTokenOwner(oneToken) {
        Parameters storage p = parameters[oneToken];
        require(ratio > 0, "Incremental: ratio must be > 0");
        require(ratio <= PRECISION, "Incremental: ratio must be <= 100%");
        require(ratio >= p.minRatio, "Incremental: ratio must be >= minRatio");
        require(ratio <= p.maxRatio, "Incremental: ratio must be <= maxRatio");
        p.lastRatio = ratio;
        emit RatioSet(msg.sender, oneToken, ratio);
    }

}

File 2 of 19 : MintMasterCommon.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "../common/ICHIModuleCommon.sol";
import "../interface/IMintMaster.sol";
import "../interface/IOneTokenV1Base.sol";
import "../interface/IOneTokenFactory.sol";

abstract contract MintMasterCommon is IMintMaster, ICHIModuleCommon{

    bytes32 constant public override MODULE_TYPE = keccak256(abi.encodePacked("ICHI V1 MintMaster Implementation"));
    mapping(address => address) public override oneTokenOracles;

    event MintMasterDeployed(address sender, address oneTokenFactory, string description);
    event MintMasterInitialized(address sender, address oneToken, address oneTokenOracle);

    /**
     @notice controllers are bound to factories at deployment time
     @param oneTokenFactory_ factory to bind to
     @param description_ human-readable, descriptive only
     */ 
    constructor(address oneTokenFactory_, string memory description_) 
        ICHIModuleCommon(oneTokenFactory_, ModuleType.MintMaster, description_) 
    { 
        emit MintMasterDeployed(msg.sender, oneTokenFactory_, description_);
    }

    /**
     @notice initializes the common interface with parameters managed by msg.sender, usually a oneToken.
     @dev Initialize from each instance. Re-initialization is acceptabe.
     @param oneTokenOracle gets the exchange rate of the oneToken
     */
    function init(address oneTokenOracle) external onlyKnownToken virtual override {
        emit MintMasterInitialized(msg.sender, msg.sender, oneTokenOracle);
    }

    /**
     @notice sets up the common interface
     @dev only called when msg.sender is the oneToken or the oneToken governance
     @param oneToken the oneToken context for the multi-tenant MintMaster implementation
     @param oneTokenOracle proposed oracle for the oneToken that intializes the mintMaster
     */
    function _initMintMaster(address oneToken, address oneTokenOracle) internal {
        require(IOneTokenFactory(IOneTokenV1Base(oneToken).oneTokenFactory()).isModule(oneTokenOracle), "MintMasterCommon: unknown oracle");
        require(IOneTokenFactory(IOneTokenV1Base(oneToken).oneTokenFactory()).isValidModuleType(oneTokenOracle, ModuleType.Oracle), "MintMasterCommon: given oracle is not valid for oneToken (msg.sender)");
        oneTokenOracles[oneToken] = oneTokenOracle;
        emit MintMasterInitialized(msg.sender, oneToken, oneTokenOracle);
    }
}

File 3 of 19 : IOneTokenV1.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma abicoder v2;

import "./IOneTokenV1Base.sol";

interface IOneTokenV1 is IOneTokenV1Base {

    function mintingFee() external view returns(uint);
    function redemptionFee() external view returns(uint);
    function mint(address collateral, uint oneTokens) external;
    function redeem(address collateral, uint amount) external;
    function setMintingFee(uint fee) external;
    function setRedemptionFee(uint fee) external;
    function updateMintingRatio(address collateralToken) external returns(uint ratio, uint maxOrderVolume);
    function getMintingRatio(address collateralToken) external view returns(uint ratio, uint maxOrderVolume);
    function getHoldings(address token) external view returns(uint vaultBalance, uint strategyBalance);
}

File 4 of 19 : IOracle.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "./IModule.sol";

interface IOracle is IModule {

    function init(address baseToken) external;
    function update(address token) external;
    function indexToken() external view returns(address);

    /**
     @param token ERC20 token
     @param amountTokens quantity, token native precision
     @param amountUsd US dollar equivalent, precision 18
     @param volatility metric for future use-cases
     */
    function read(address token, uint amountTokens) external view returns(uint amountUsd, uint volatility);

    /**
     @param token ERC20 token
     @param amountTokens token quantity, token native precision
     @param amountUsd US dollar equivalent, precision 18
     @param volatility metric for future use-cases
     */    
    function amountRequired(address token, uint amountUsd) external view returns(uint amountTokens, uint volatility);

    /**
     @notice converts normalized precision-18 amounts to token native precision amounts, truncates low-order values
     @param token ERC20 token contract
     @param amountNormal quantity, precision 18
     @param amountTokens quantity scaled to token precision
     */    
    function normalizedToTokens(address token, uint amountNormal) external view returns(uint amountTokens);

    /**
     @notice converts token native precision amounts to normalized precision-18 amounts
     @param token ERC20 token contract
     @param amountNormal quantity, precision 18
     @param amountTokens quantity scaled to token precision
     */  
    function tokensToNormalized(address token, uint amountTokens) external view returns(uint amountNormal);
}

File 5 of 19 : ICHIModuleCommon.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "../interface/IModule.sol";
import "../interface/IOneTokenFactory.sol";
import "../interface/IOneTokenV1Base.sol";
import "./ICHICommon.sol";

abstract contract ICHIModuleCommon is IModule, ICHICommon {
    
    ModuleType public immutable override moduleType;
    string public override moduleDescription;
    address public immutable override oneTokenFactory;

    event ModuleDeployed(address sender, ModuleType moduleType, string description);
    event DescriptionUpdated(address sender, string description);
   
    modifier onlyKnownToken {
        require(IOneTokenFactory(oneTokenFactory).isOneToken(msg.sender), "ICHIModuleCommon: msg.sender is not a known oneToken");
        _;
    }
    
    modifier onlyTokenOwner (address oneToken) {
        require(msg.sender == IOneTokenV1Base(oneToken).owner(), "ICHIModuleCommon: msg.sender is not oneToken owner");
        _;
    }

    modifier onlyModuleOrFactory {
        if(!IOneTokenFactory(oneTokenFactory).isModule(msg.sender)) {
            require(msg.sender == oneTokenFactory, "ICHIModuleCommon: msg.sender is not module owner, token factory or registed module");
        }
        _;
    }
    
    /**
     @notice modules are bound to the factory at deployment time
     @param oneTokenFactory_ factory to bind to
     @param moduleType_ type number helps prevent governance errors
     @param description_ human-readable, descriptive only
     */    
    constructor (address oneTokenFactory_, ModuleType moduleType_, string memory description_) {
        require(oneTokenFactory_ != NULL_ADDRESS, "ICHIModuleCommon: oneTokenFactory cannot be empty");
        require(bytes(description_).length > 0, "ICHIModuleCommon: description cannot be empty");
        oneTokenFactory = oneTokenFactory_;
        moduleType = moduleType_;
        moduleDescription = description_;
        emit ModuleDeployed(msg.sender, moduleType_, description_);
    }

    /**
     @notice set a module description
     @param description new module desciption
     */
    function updateDescription(string memory description) external onlyOwner override {
        require(bytes(description).length > 0, "ICHIModuleCommon: description cannot be empty");
        moduleDescription = description;
        emit DescriptionUpdated(msg.sender, description);
    }  
}

File 6 of 19 : IMintMaster.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "./IModule.sol";

interface IMintMaster is IModule {
    
    function oneTokenOracles(address) external view returns(address);
    function init(address oneTokenOracle) external;
    function updateMintingRatio(address collateralToken) external returns(uint256 ratio, uint256 maxOrderVolume);
    function getMintingRatio(address collateral) external view returns(uint256 ratio, uint256 maxOrderVolume);
    function getMintingRatio2(address oneToken, address collateralToken) external view returns(uint256 ratio, uint256 maxOrderVolume);  
    function getMintingRatio4(address oneToken, address oneTokenOracle, address collateralToken, address collateralOracle) external view returns(uint256 ratio, uint256 maxOrderVolume); 
}

File 7 of 19 : IOneTokenV1Base.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "./IICHICommon.sol";
import "./IERC20Extended.sol";

interface IOneTokenV1Base is IICHICommon, IERC20 {
    
    function init(string memory name_, string memory symbol_, address oneTokenOracle_, address controller_,  address mintMaster_, address memberToken_, address collateral_) external;
    function changeController(address controller_) external;
    function changeMintMaster(address mintMaster_, address oneTokenOracle) external;
    function addAsset(address token, address oracle) external;
    function removeAsset(address token) external;
    function setStrategy(address token, address strategy, uint256 allowance) external;
    function executeStrategy(address token) external;
    function removeStrategy(address token) external;
    function closeStrategy(address token) external;
    function increaseStrategyAllowance(address token, uint256 amount) external;
    function decreaseStrategyAllowance(address token, uint256 amount) external;
    function setFactory(address newFactory) external;

    function MODULE_TYPE() external view returns(bytes32);
    function oneTokenFactory() external view returns(address);
    function controller() external view returns(address);
    function mintMaster() external view returns(address);
    function memberToken() external view returns(address);
    function assets(address) external view returns(address, address);
    function balances(address token) external view returns(uint256 inVault, uint256 inStrategy);
    function collateralTokenCount() external view returns(uint256);
    function collateralTokenAtIndex(uint256 index) external view returns(address);
    function isCollateral(address token) external view returns(bool);
    function otherTokenCount() external view  returns(uint256);
    function otherTokenAtIndex(uint256 index) external view returns(address); 
    function isOtherToken(address token) external view returns(bool);
    function assetCount() external view returns(uint256);
    function assetAtIndex(uint256 index) external view returns(address); 
    function isAsset(address token) external view returns(bool);
}

File 8 of 19 : IOneTokenFactory.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma abicoder v2;

import "./InterfaceCommon.sol";

interface IOneTokenFactory is InterfaceCommon {

    function oneTokenProxyAdmins(address) external returns(address);
    function deployOneTokenProxy(
        string memory name,
        string memory symbol,
        address governance, 
        address version,
        address controller,
        address mintMaster,              
        address memberToken, 
        address collateral,
        address oneTokenOracle
    ) 
        external 
        returns(address newOneTokenProxy, address proxyAdmin);

    function admitModule(address module, ModuleType moduleType, string memory name, string memory url) external;
    function updateModule(address module, string memory name, string memory url) external;
    function removeModule(address module) external;

    function admitForeignToken(address foreignToken, bool collateral, address oracle) external;
    function updateForeignToken(address foreignToken, bool collateral) external;
    function removeForeignToken(address foreignToken) external;

    function assignOracle(address foreignToken, address oracle) external;
    function removeOracle(address foreignToken, address oracle) external; 

    /**
     * View functions
     */
    
    function MODULE_TYPE() external view returns(bytes32);

    function oneTokenCount() external view returns(uint256);
    function oneTokenAtIndex(uint256 index) external view returns(address);
    function isOneToken(address oneToken) external view returns(bool);
 
    // modules

    function moduleCount() external view returns(uint256);
    function moduleAtIndex(uint256 index) external view returns(address module);
    function isModule(address module) external view returns(bool);
    function isValidModuleType(address module, ModuleType moduleType) external view returns(bool);

    // foreign tokens

    function foreignTokenCount() external view returns(uint256);
    function foreignTokenAtIndex(uint256 index) external view returns(address);
    function foreignTokenInfo(address foreignToken) external view returns(bool collateral, uint256 oracleCount);
    function foreignTokenOracleCount(address foreignToken) external view returns(uint256);
    function foreignTokenOracleAtIndex(address foreignToken, uint256 index) external view returns(address);
    function isOracle(address foreignToken, address oracle) external view returns(bool);
    function isForeignToken(address foreignToken) external view returns(bool);
    function isCollateral(address foreignToken) external view returns(bool);
}

File 9 of 19 : IModule.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "./IICHICommon.sol";
import "./InterfaceCommon.sol";

interface IModule is IICHICommon { 
       
    function oneTokenFactory() external view returns(address);
    function updateDescription(string memory description) external;
    function moduleDescription() external view returns(string memory);
    function MODULE_TYPE() external view returns(bytes32);
    function moduleType() external view returns(ModuleType);
}

File 10 of 19 : ICHICommon.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "../oz_modified/ICHIOwnable.sol";
import "../oz_modified/ICHIInitializable.sol";
import "../interface/IERC20Extended.sol";
import "../interface/IICHICommon.sol";

contract ICHICommon is IICHICommon, ICHIOwnable, ICHIInitializable {

    uint256 constant PRECISION = 10 ** 18;
    uint256 constant INFINITE = uint256(0-1);
    address constant NULL_ADDRESS = address(0);
    
    // @dev internal fingerprints help prevent deployment-time governance errors

    bytes32 constant COMPONENT_CONTROLLER = keccak256(abi.encodePacked("ICHI V1 Controller"));
    bytes32 constant COMPONENT_VERSION = keccak256(abi.encodePacked("ICHI V1 OneToken Implementation"));
    bytes32 constant COMPONENT_STRATEGY = keccak256(abi.encodePacked("ICHI V1 Strategy Implementation"));
    bytes32 constant COMPONENT_MINTMASTER = keccak256(abi.encodePacked("ICHI V1 MintMaster Implementation"));
    bytes32 constant COMPONENT_ORACLE = keccak256(abi.encodePacked("ICHI V1 Oracle Implementation"));
    bytes32 constant COMPONENT_VOTERROLL = keccak256(abi.encodePacked("ICHI V1 VoterRoll Implementation"));
    bytes32 constant COMPONENT_FACTORY = keccak256(abi.encodePacked("ICHI OneToken Factory"));
}

File 11 of 19 : IICHICommon.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "./IICHIOwnable.sol";
import "./InterfaceCommon.sol";

interface IICHICommon is IICHIOwnable, InterfaceCommon {}

File 12 of 19 : InterfaceCommon.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma abicoder v2;

interface InterfaceCommon {

    enum ModuleType { Version, Controller, Strategy, MintMaster, Oracle }

}

File 13 of 19 : IICHIOwnable.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

interface IICHIOwnable {
    
    function renounceOwnership() external;
    function transferOwnership(address newOwner) external;
    function owner() external view returns (address);
}

File 14 of 19 : IERC20Extended.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "../_openzeppelin/token/ERC20/IERC20.sol";

interface IERC20Extended is IERC20 {
    
    function decimals() external view returns(uint8);
    function symbol() external view returns(string memory);
    function name() external view returns(string memory);
}

File 15 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 16 of 19 : ICHIOwnable.sol
// SPDX-License-Identifier: MIT

/**
 * @dev Constructor visibility has been removed from the original.
 * _transferOwnership() has been added to support proxied deployments.
 * Abstract tag removed from contract block.
 * Added interface inheritance and override modifiers.
 * Changed contract identifier in require error messages.
 */

pragma solidity >=0.6.0 <0.8.0;

import "../_openzeppelin/utils/Context.sol";
import "../interface/IICHIOwnable.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract ICHIOwnable is IICHIOwnable, Context {
    
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Throws if called by any account other than the owner.
     */
     
    modifier onlyOwner() {
        require(owner() == _msgSender(), "ICHIOwnable: caller is not the owner");
        _;
    }    

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     * Ineffective for proxied deployed. Use initOwnable.
     */
    constructor() {
        _transferOwnership(msg.sender);
    }

    /**
     @dev initialize proxied deployment
     */
    function initOwnable() internal {
        require(owner() == address(0), "ICHIOwnable: already initialized");
        _transferOwnership(msg.sender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual override returns (address) {
        return _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual override onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */

    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev be sure to call this in the initialization stage of proxied deployment or owner will not be set
     */

    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "ICHIOwnable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 17 of 19 : ICHIInitializable.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

import "../_openzeppelin/utils/Address.sol";

contract ICHIInitializable {

    bool private _initialized;
    bool private _initializing;

    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "ICHIInitializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    modifier initialized {
        require(_initialized, "ICHIInitializable: contract is not initialized");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !Address.isContract(address(this));
    }
}

File 18 of 19 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 19 of 19 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"oneTokenFactory_","type":"address"},{"internalType":"string","name":"description_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"DescriptionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"maxRatio","type":"uint256"}],"name":"MaxRatioSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"minRatio","type":"uint256"}],"name":"MinRatioSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneTokenFactory","type":"address"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"MintMasterDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"address","name":"oneTokenOracle","type":"address"}],"name":"MintMasterInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"enum InterfaceCommon.ModuleType","name":"moduleType","type":"uint8"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"ModuleDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"OneTokenOracleChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"ratio","type":"uint256"}],"name":"RatioSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"minRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stepSize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"initialRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"name":"SetParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"stepSize","type":"uint256"}],"name":"StepSizeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"oneToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"name":"UpdateMintingRatio","type":"event"},{"inputs":[],"name":"MODULE_TYPE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"}],"name":"changeOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getMintingRatio","outputs":[{"internalType":"uint256","name":"ratio","type":"uint256"},{"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getMintingRatio2","outputs":[{"internalType":"uint256","name":"ratio","type":"uint256"},{"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"address","name":"oneTokenOracle","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getMintingRatio4","outputs":[{"internalType":"uint256","name":"ratio","type":"uint256"},{"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oneTokenOracle","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"moduleDescription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"moduleType","outputs":[{"internalType":"enum InterfaceCommon.ModuleType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oneTokenFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"oneTokenOracles","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"parameters","outputs":[{"internalType":"bool","name":"set","type":"bool"},{"internalType":"uint256","name":"minRatio","type":"uint256"},{"internalType":"uint256","name":"maxRatio","type":"uint256"},{"internalType":"uint256","name":"stepSize","type":"uint256"},{"internalType":"uint256","name":"lastRatio","type":"uint256"},{"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"uint256","name":"maxRatio","type":"uint256"}],"name":"setMaxRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"uint256","name":"minRatio","type":"uint256"}],"name":"setMinRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"uint256","name":"minRatio","type":"uint256"},{"internalType":"uint256","name":"maxRatio","type":"uint256"},{"internalType":"uint256","name":"stepSize","type":"uint256"},{"internalType":"uint256","name":"initialRatio","type":"uint256"},{"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"name":"setParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"uint256","name":"ratio","type":"uint256"}],"name":"setRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oneToken","type":"address"},{"internalType":"uint256","name":"stepSize","type":"uint256"}],"name":"setStepSize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"description","type":"string"}],"name":"updateDescription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"updateMintingRatio","outputs":[{"internalType":"uint256","name":"ratio","type":"uint256"},{"internalType":"uint256","name":"maxOrderVolume","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b506040516200270c3803806200270c833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050508181816003826200010b336200036a60201b60201c565b6001600160a01b038316620001525760405162461bcd60e51b8152600401808060200182810382526031815260200180620026db6031913960400191505060405180910390fd5b6000815111620001945760405162461bcd60e51b815260040180806020018281038252602d81526020018062002684602d913960400191505060405180910390fd5b6001600160601b0319606084901b1660a052816004811115620001b357fe5b6080816004811115620001c257fe5b60f81b9052508051620001dd9060019060208401906200040c565b507f2e09cb9dd254b20150f5e6b358e7aabf9802b241ddf84609686d8e4b0d2b96b833838360405180846001600160a01b031681526020018360048111156200022257fe5b815260200180602001828103825283818151815260200191508051906020019080838360005b838110156200026257818101518382015260200162000248565b50505050905090810190601f168015620002905780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15050507fd74a212fa75a350259eda5b63b3e628a5463e3f5ae4e40692793eaf5b3fa0bdf33838360405180846001600160a01b03168152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156200032357818101518382015260200162000309565b50505050905090810190601f168015620003515780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a150505050620004b8565b6001600160a01b038116620003b15760405162461bcd60e51b815260040180806020018281038252602a815260200180620026b1602a913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200044457600085556200048f565b82601f106200045f57805160ff19168380011785556200048f565b828001600101855582156200048f579182015b828111156200048f57825182559160200191906001019062000472565b506200049d929150620004a1565b5090565b5b808211156200049d5760008155600101620004a2565b60805160f81c60a05160601c612198620004ec60003980610ae55280610f45528061125a5250806110ae52506121986000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c80635775029f116100b85780638da5cb5b1161007c5780638da5cb5b14610413578063a2729c231461041b578063adbacbd214610423578063b5966db81461044f578063e735b48a146104cc578063f2fde38b1461057257610137565b80635775029f1461035e5780636465e69f146103785780636db1aa5c146103a1578063715018a6146103e5578063795a94d7146103ed57610137565b80632b3cf787116100ff5780632b3cf787146102555780633567a1ea146102b05780634009ba81146102dc5780634db771fc146103025780634dc809ce1461033057610137565b806301affd2d1461013c578063057520471461016a578063108822731461019657806319ab453c146101ed5780631d4a742214610213575b600080fd5b6101686004803603604081101561015257600080fd5b506001600160a01b038135169060200135610598565b005b6101686004803603604081101561018057600080fd5b506001600160a01b038135169060200135610702565b6101d4600480360360808110156101ac57600080fd5b506001600160a01b03813581169160208101358216916040820135811691606001351661093a565b6040805192835260208301919091528051918290030190f35b6101686004803603602081101561020357600080fd5b50356001600160a01b0316610ac5565b6102396004803603602081101561022957600080fd5b50356001600160a01b0316610c0b565b604080516001600160a01b039092168252519081900360200190f35b61027b6004803603602081101561026b57600080fd5b50356001600160a01b0316610c26565b6040805196151587526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b610168600480360360408110156102c657600080fd5b506001600160a01b038135169060200135610c5f565b6101d4600480360360208110156102f257600080fd5b50356001600160a01b0316610e26565b6101d46004803603604081101561031857600080fd5b506001600160a01b0381358116916020013516610e60565b6101686004803603604081101561034657600080fd5b506001600160a01b0381358116916020013516610e97565b610366611080565b60408051918252519081900360200190f35b6103806110ac565b6040518082600481111561039057fe5b815260200191505060405180910390f35b610168600480360360c08110156103b757600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a001356110d0565b610168611193565b6101d46004803603602081101561040357600080fd5b50356001600160a01b031661123b565b610239611249565b610239611258565b6101686004803603604081101561043957600080fd5b506001600160a01b03813516906020013561127c565b61045761148a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610491578181015183820152602001610479565b50505050905090810190601f1680156104be5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610168600480360360208110156104e257600080fd5b8101906020810181356401000000008111156104fd57600080fd5b82018360208201111561050f57600080fd5b8035906020019184600183028401116401000000008311171561053157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611517945050505050565b6101686004803603602081101561058857600080fd5b50356001600160a01b0316611676565b81806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105d257600080fd5b505afa1580156105e6573d6000803e3d6000fd5b505050506040513d60208110156105fc57600080fd5b50516001600160a01b031633146106445760405162461bcd60e51b81526004018080602001828103825260328152602001806120586032913960400191505060405180910390fd5b6001600160a01b03831660009081526004602052604090206001810154600282015403831080610672575082155b6106ad5760405162461bcd60e51b8152600401808060200182810382526034815260200180611f776034913960400191505060405180910390fd5b60038101839055604080513381526001600160a01b038616602082015280820185905290517f5842684bd6320434e87a1090b4261aa7368e80f4c5b4d0c526463f0132aa8dd29181900360600190a150505050565b81806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561073c57600080fd5b505afa158015610750573d6000803e3d6000fd5b505050506040513d602081101561076657600080fd5b50516001600160a01b031633146107ae5760405162461bcd60e51b81526004018080602001828103825260328152602001806120586032913960400191505060405180910390fd5b6001600160a01b038316600090815260046020526040902082610818576040805162461bcd60e51b815260206004820152601e60248201527f496e6372656d656e74616c3a20726174696f206d757374206265203e20300000604482015290519081900360640190fd5b670de0b6b3a764000083111561085f5760405162461bcd60e51b8152600401808060200182810382526022815260200180611e986022913960400191505060405180910390fd5b80600101548310156108a25760405162461bcd60e51b8152600401808060200182810382526026815260200180611e726026913960400191505060405180910390fd5b80600201548311156108e55760405162461bcd60e51b8152600401808060200182810382526026815260200180611f2d6026913960400191505060405180910390fd5b60048101839055604080513381526001600160a01b038616602082015280820185905290517fecd82f8bebe53bf6f769fe79f762d30111170467b1bcf0813bc073f9b437e2729181900360600190a150505050565b6001600160a01b0384166000908152600460205260408120805482919060ff166109955760405162461bcd60e51b815260040180806020018281038252602a81526020018061202e602a913960400191505060405180910390fd5b6040805163014c2add60e01b81526001600160a01b038981166004830152670de0b6b3a764000060248301528251600093918a169263014c2add926044808301939192829003018186803b1580156109ec57600080fd5b505afa158015610a00573d6000803e3d6000fd5b505050506040513d6040811015610a1657600080fd5b5051600483015494509050670de0b6b3a7640000811415610a3d5750600501549050610abc565b600382015460058301549350670de0b6b3a764000082108015610a635750826002015485105b15610a8057600283015494810194851115610a8057826002015494505b670de0b6b3a764000082118015610a9a5750826001015485115b15610ab85780850394508260010154851015610ab857826001015494505b5050505b94509492505050565b604080516309de917f60e31b815233600482015290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691634ef48bf8916024808301926020929190829003018186803b158015610b2b57600080fd5b505afa158015610b3f573d6000803e3d6000fd5b505050506040513d6020811015610b5557600080fd5b5051610b925760405162461bcd60e51b81526004018080602001828103825260348152602001806120ba6034913960400191505060405180910390fd5b610bb333670de0b6b3a7640000806000670de0b6b3a76400006000196116e0565b610bbd33826118df565b43600355604080513380825260208201526001600160a01b0383168183015290517f53d9051dcabe76d251a8e32814920d3e539886c2e9ef15d1d62be73683f50ec19181900360600190a150565b6002602052600090815260409020546001600160a01b031681565b600460208190526000918252604090912080546001820154600283015460038401549484015460059094015460ff909316949193909286565b81806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c9957600080fd5b505afa158015610cad573d6000803e3d6000fd5b505050506040513d6020811015610cc357600080fd5b50516001600160a01b03163314610d0b5760405162461bcd60e51b81526004018080602001828103825260328152602001806120586032913960400191505060405180910390fd5b6001600160a01b03831660009081526004602052604090206002810154831115610d665760405162461bcd60e51b81526004018080602001828103825260298152602001806120056029913960400191505060405180910390fd5b8281600201540381600301541080610d8057506003810154155b610dbb5760405162461bcd60e51b8152600401808060200182810382526034815260200180611f776034913960400191505060405180910390fd5b600181018390556004810154831115610dd857610dd88484610702565b604080513381526001600160a01b038616602082015280820185905290517febcfef8f1301f16512a125f068a25c7c75b325542fac4a1372ff2b21c188e8e69181900360600190a150505050565b6000804360035410610e4757610e3d336000610e60565b9092509050610e5b565b43600355610e56336000611ba0565b915091505b915091565b6001600160a01b038083166000908152600260205260408120549091829116610e8b8582848061093a565b92509250509250929050565b81806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed157600080fd5b505afa158015610ee5573d6000803e3d6000fd5b505050506040513d6020811015610efb57600080fd5b50516001600160a01b03163314610f435760405162461bcd60e51b81526004018080602001828103825260328152602001806120586032913960400191505060405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663370c998e84846040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b158015610fc157600080fd5b505afa158015610fd5573d6000803e3d6000fd5b505050506040513d6020811015610feb57600080fd5b50516110285760405162461bcd60e51b815260040180806020018281038252603081526020018061208a6030913960400191505060405180910390fd5b61103283836118df565b604080513381526001600160a01b03808616602083015284168183015290517f2237ec48b17145b1636fc3ed09f2b6fdbdf2423d19f7c13ec3ae8e1e05eb7e799181900360600190a1505050565b604051602001806021611ee3823960210190506040516020818303038152906040528051906020012081565b7f000000000000000000000000000000000000000000000000000000000000000081565b85806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561110a57600080fd5b505afa15801561111e573d6000803e3d6000fd5b505050506040513d602081101561113457600080fd5b50516001600160a01b0316331461117c5760405162461bcd60e51b81526004018080602001828103825260328152602001806120586032913960400191505060405180910390fd5b61118a8787878787876116e0565b50505050505050565b61119b611cdd565b6001600160a01b03166111ac611249565b6001600160a01b0316146111f15760405162461bcd60e51b8152600401808060200182810382526024815260200180611f536024913960400191505060405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600080610e56336000610e60565b6000546001600160a01b031690565b7f000000000000000000000000000000000000000000000000000000000000000081565b81806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b657600080fd5b505afa1580156112ca573d6000803e3d6000fd5b505050506040513d60208110156112e057600080fd5b50516001600160a01b031633146113285760405162461bcd60e51b81526004018080602001828103825260328152602001806120586032913960400191505060405180910390fd5b6001600160a01b038316600090815260046020526040902060018101548310156113835760405162461bcd60e51b8152600401808060200182810382526029815260200180611f046029913960400191505060405180910390fd5b670de0b6b3a76400008311156113ca5760405162461bcd60e51b8152600401808060200182810382526022815260200180611e506022913960400191505060405180910390fd5b80600101548303816003015410806113e457506003810154155b61141f5760405162461bcd60e51b8152600401808060200182810382526034815260200180611f776034913960400191505060405180910390fd5b60028101839055600481015483101561143c5761143c8484610702565b604080513381526001600160a01b038616602082015280820185905290517f3a21d6f69d49c16513443514546e5b7f2539076860d967f9839f779972f87a0c9181900360600190a150505050565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561150f5780601f106114e45761010080835404028352916020019161150f565b820191906000526020600020905b8154815290600101906020018083116114f257829003601f168201915b505050505081565b61151f611cdd565b6001600160a01b0316611530611249565b6001600160a01b0316146115755760405162461bcd60e51b8152600401808060200182810382526024815260200180611f536024913960400191505060405180910390fd5b60008151116115b55760405162461bcd60e51b815260040180806020018281038252602d815260200180611e23602d913960400191505060405180910390fd5b80516115c8906001906020840190611d81565b507f37cc8c6ced0cbc4d440fcfa810a2f09f40b8f0127c3656103edf26b3d93e0ec1338260405180836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611638578181015183820152602001611620565b50505050905090810190601f1680156116655780820380516001836020036101000a031916815260200191505b50935050505060405180910390a150565b61167e611cdd565b6001600160a01b031661168f611249565b6001600160a01b0316146116d45760405162461bcd60e51b8152600401808060200182810382526024815260200180611f536024913960400191505060405180910390fd5b6116dd81611ce1565b50565b6001600160a01b0386166000908152600460205260409020848611156117375760405162461bcd60e51b81526004018080602001828103825260298152602001806120056029913960400191505060405180910390fd5b670de0b6b3a764000085111561177e5760405162461bcd60e51b8152600401808060200182810382526029815260200180611eba6029913960400191505060405180910390fd5b85850384108061178c575083155b6117c75760405162461bcd60e51b8152600401808060200182810382526034815260200180611f776034913960400191505060405180910390fd5b858310156118065760405162461bcd60e51b8152600401808060200182810382526030815260200180611fab6030913960400191505060405180910390fd5b848311156118455760405162461bcd60e51b81526004018080602001828103825260308152602001806120ee6030913960400191505060405180910390fd5b600180820187905560028201869055600382018590556004820184905560058201839055815460ff1916178155604080513381526001600160a01b0389166020820152808201889052606081018790526080810186905260a0810185905260c0810184905290517f95cf5d9063b176bc1e2b41951693eaf2f952d587841a135a5b28d7a2965306349181900360e00190a150505050505050565b816001600160a01b031663a2729c236040518163ffffffff1660e01b815260040160206040518083038186803b15801561191857600080fd5b505afa15801561192c573d6000803e3d6000fd5b505050506040513d602081101561194257600080fd5b5051604080516342f6e38960e01b81526001600160a01b038481166004830152915191909216916342f6e389916024808301926020929190829003018186803b15801561198e57600080fd5b505afa1580156119a2573d6000803e3d6000fd5b505050506040513d60208110156119b857600080fd5b5051611a0b576040805162461bcd60e51b815260206004820181905260248201527f4d696e744d6173746572436f6d6d6f6e3a20756e6b6e6f776e206f7261636c65604482015290519081900360640190fd5b816001600160a01b031663a2729c236040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4457600080fd5b505afa158015611a58573d6000803e3d6000fd5b505050506040513d6020811015611a6e57600080fd5b5051604051637afd8d9560e01b81526001600160a01b0383811660048381019182529190931692637afd8d9592859291906024018281526020019250505060206040518083038186803b158015611ac457600080fd5b505afa158015611ad8573d6000803e3d6000fd5b505050506040513d6020811015611aee57600080fd5b5051611b2b5760405162461bcd60e51b815260040180806020018281038252604581526020018061211e6045913960600191505060405180910390fd5b6001600160a01b0380831660008181526002602090815260409182902080549486166001600160a01b0319909516851790558151338152908101929092528181019290925290517f53d9051dcabe76d251a8e32814920d3e539886c2e9ef15d1d62be73683f50ec19181900360600190a15050565b6001600160a01b0382166000908152600460205260408120805482919060ff16611bfb5760405162461bcd60e51b815260040180806020018281038252602a81526020018061202e602a913960400191505060405180910390fd5b6001600160a01b03808616600081815260026020526040808220548151630e0dc3b960e11b8152600481019490945290519316928392631c1b877292602480830193919282900301818387803b158015611c5457600080fd5b505af1158015611c68573d6000803e3d6000fd5b50505050611c77866000610e60565b60048401829055604080513381526001600160a01b038a1660208201528082018490526060810183905290519296509094507f74df6a310387bb8428a98218eb26ff25eb9446be7e2803f5be13d2152dc9d2cc919081900360800190a150509250929050565b3390565b6001600160a01b038116611d265760405162461bcd60e51b815260040180806020018281038252602a815260200180611fdb602a913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611db75760008555611dfd565b82601f10611dd057805160ff1916838001178555611dfd565b82800160010185558215611dfd579182015b82811115611dfd578251825591602001919060010190611de2565b50611e09929150611e0d565b5090565b5b80821115611e095760008155600101611e0e56fe494348494d6f64756c65436f6d6d6f6e3a206465736372697074696f6e2063616e6e6f7420626520656d707479496e6372656d656e74616c3a206d6178526174696f206d757374203c3d2031303025496e6372656d656e74616c3a20726174696f206d757374206265203e3d206d696e526174696f496e6372656d656e74616c3a20726174696f206d757374206265203c3d2031303025496e6372656d656e74616c3a206d6178526174696f206d757374206265203c3d203130202a2a20313849434849205631204d696e744d617374657220496d706c656d656e746174696f6e496e6372656d656e74616c3a206d6178526174696f206d757374206265203e3d206d696e526174696f496e6372656d656e74616c3a20726174696f206d757374206265203c3d206d6178526174696f494348494f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572496e6372656d656e74616c3a207374657053697a65206d757374206265203c20286d6178202d206d696e29206f72207a65726f2e496e6372656d656e74616c3a20696e697469616c20726174696f206d757374206265203e3d206d696e20726174696f2e494348494f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373496e6372656d656e74616c3a206d696e526174696f206d757374206265203c3d206d6178526174696f496e6372656d656e74616c3a206d696e746d6173746572206973206e6f7420696e697469616c697a6564494348494d6f64756c65436f6d6d6f6e3a206d73672e73656e646572206973206e6f74206f6e65546f6b656e206f776e6572496e6372656d656e74616c3a206f7261636c65206973206e6f7420617070726f76656420666f72206f6e65546f6b656e494348494d6f64756c65436f6d6d6f6e3a206d73672e73656e646572206973206e6f742061206b6e6f776e206f6e65546f6b656e496e6372656d656e74616c3a20696e697469616c20726174696f206d757374206265203c3d206d617820726174696f2e4d696e744d6173746572436f6d6d6f6e3a20676976656e206f7261636c65206973206e6f742076616c696420666f72206f6e65546f6b656e20286d73672e73656e64657229a2646970667358221220a0186d19b1f2314c187519fb632566b72fb7b7a3f2a931830adeaebedc3247db64736f6c63430007060033494348494d6f64756c65436f6d6d6f6e3a206465736372697074696f6e2063616e6e6f7420626520656d707479494348494f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373494348494d6f64756c65436f6d6d6f6e3a206f6e65546f6b656e466163746f72792063616e6e6f7420626520656d707479000000000000000000000000d0092632b9ac5a7856664eec1abb6e3403a6a36a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001c426173696320496e6372656d656e74616c204d696e744d617374657200000000

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000d0092632b9ac5a7856664eec1abb6e3403a6a36a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001c426173696320496e6372656d656e74616c204d696e744d617374657200000000

-----Decoded View---------------
Arg [0] : oneTokenFactory_ (address): 0xd0092632b9ac5a7856664eec1abb6e3403a6a36a
Arg [1] : description_ (string): Basic Incremental MintMaster

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d0092632b9ac5a7856664eec1abb6e3403a6a36a
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 000000000000000000000000000000000000000000000000000000000000001c
Arg [3] : 426173696320496e6372656d656e74616c204d696e744d617374657200000000


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.