<commit_before>pragma solidity ^0.4.24;

import 'openzeppelin-solidity/contracts/token/ERC20/StandardBurnableToken.sol';
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';

/**
  @dev Ambix contract is used for morph Token set to another
  Token's by rule (recipe). In distillation process given
  Token's are burned and result generated by emission.
  
  The recipe presented as equation in form:
  (N1 * A1 & N'1 * A'1 & N''1 * A''1 ...)
  | (N2 * A2 & N'2 * A'2 & N''2 * A''2 ...) ...
  | (Nn * An & N'n * A'n & N''n * A''n ...)
  = M1 * B1 & M2 * B2 ... & Mm * Bm 
    where A, B - input and output tokens
          N, M - token value coeficients
          n, m - input / output dimetion size 
          | - is alternative operator (logical OR)
          & - is associative operator (logical AND)
  This says that `Ambix` should receive (approve) left
  part of equation and send (transfer) right part.
*/
contract Ambix is Ownable {
    address[][] public A;
    uint256[][] public N;
    address[] public B;
    uint256[] public M;

    /**
     * @dev Append token recipe source alternative
     * @param _a Token recipe source token addresses
     * @param _n Token recipe source token counts
     **/
    function appendSource(
        address[] _a,
        uint256[] _n
    ) external onlyOwner {
        require(_a.length == _n.length);
        for (uint256 i = 0; i < _a.length; ++i)
            require(_a[i] != 0);

        A.push(_a);
        N.push(_n);
    }

    /**
     * @dev Set sink of token recipe
     * @param _b Token recipe sink token list
     * @param _m Token recipe sink token counts
     */
    function setSink(
        address[] _b,
        uint256[] _m
    ) external onlyOwner{
        require(_b.length == _m.length);
        for (uint256 i = 0; i < _b.length; ++i)
            require(_b[i] != 0);

        B = _b;
        M = _m;
    }

    /**
     * @dev Run distillation process
     * @param _ix Source alternative index
     */
    function run(uint256 _ix) public {<commit_msg>Ambix appendSource dynamic conversion setup safety check<commit_after>pragma solidity ^0.4.24;

import 'openzeppelin-solidity/contracts/token/ERC20/StandardBurnableToken.sol';
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';

/**
  @dev Ambix contract is used for morph Token set to another
  Token's by rule (recipe). In distillation process given
  Token's are burned and result generated by emission.
  
  The recipe presented as equation in form:
  (N1 * A1 & N'1 * A'1 & N''1 * A''1 ...)
  | (N2 * A2 & N'2 * A'2 & N''2 * A''2 ...) ...
  | (Nn * An & N'n * A'n & N''n * A''n ...)
  = M1 * B1 & M2 * B2 ... & Mm * Bm 
    where A, B - input and output tokens
          N, M - token value coeficients
          n, m - input / output dimetion size 
          | - is alternative operator (logical OR)
          & - is associative operator (logical AND)
  This says that `Ambix` should receive (approve) left
  part of equation and send (transfer) right part.
*/
contract Ambix is Ownable {
    address[][] public A;
    uint256[][] public N;
    address[] public B;
    uint256[] public M;

    /**
     * @dev Append token recipe source alternative
     * @param _a Token recipe source token addresses
     * @param _n Token recipe source token counts
     **/
    function appendSource(
        address[] _a,
        uint256[] _n
    ) external onlyOwner {
        uint256 i;

        require(_a.length == _n.length && _a.length > 0);

        for (i = 0; i < _a.length; ++i)
            require(_a[i] != 0);

        if (_n.length == 1 && _n[0] == 0) {
            require(B.length == 1);
        } else {
            for (i = 0; i < _n.length; ++i)
                require(_n[i] > 0);
        }

        A.push(_a);
        N.push(_n);
    }

    /**
     * @dev Set sink of token recipe
     * @param _b Token recipe sink token list
     * @param _m Token recipe sink token counts
     */
    function setSink(
        address[] _b,
        uint256[] _m
    ) external onlyOwner{
        require(_b.length == _m.length);

        for (uint256 i = 0; i < _b.length; ++i)
            require(_b[i] != 0);

        B = _b;
        M = _m;
    }

    /**
     * @dev Run distillation process
     * @param _ix Source alternative index
     */
    function run(uint256 _ix) public {
{'fraction_non_alphanumeric': 0.12436548223350254, 'fraction_numerical': 0.023304107060452238, 'mean_word_length': 2.0549682875264272, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3077892', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1387, 'n_words': 469}