"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

function _react() {
  const data = _interopRequireDefault(require("react"));

  _react = function _react() {
    return data;
  };

  return data;
}

function _utils() {
  const data = _interopRequireDefault(require("@ddn/utils"));

  _utils = function _utils() {
    return data;
  };

  return data;
}

var _constants = _interopRequireDefault(require("../../constants"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

var _default = {
  daoOrg: function () {
    var _daoOrg = _asyncToGenerator(function* (asset) {
      let feeBase = 1;
      const org_id = asset.org_id;
      const olen = org_id.length;
      const feeLenMap = {
        10: 50,
        9: 100,
        8: 200,
        7: 400,
        6: 800,
        5: 1600
      };

      if (olen > 10) {
        feeBase = 10;
      } else if (olen <= 4) {
        feeBase = 99999999; // not allow
      } else {
        feeBase = feeLenMap[`${olen}`];
      }

      if (asset.state === 1) {
        feeBase = parseInt(feeBase / 10, 10); // change info
      }

      const result = _utils().default.bignum.multiply(feeBase, _constants.default.fixedPoint).toString();

      console.log('daoOrg fee=', result);
      return result;
    });

    function daoOrg(_x) {
      return _daoOrg.apply(this, arguments);
    }

    return daoOrg;
  }(),
  daoConfirmation: function () {
    var _daoConfirmation = _asyncToGenerator(function* (asset) {
      let feeBase = '1';

      if (asset.state === 0) {
        feeBase = '0'; // 拒绝稿件时手续费为0
      }

      const result = _utils().default.bignum.multiply(feeBase, _constants.default.fixedPoint).toString();

      return result;
    });

    function daoConfirmation(_x2) {
      return _daoConfirmation.apply(this, arguments);
    }

    return daoConfirmation;
  }(),
  daoContribution: function () {
    var _daoContribution = _asyncToGenerator(function* (asset) {
      let feeBase = '1';

      if (asset.state === 0) {
        feeBase = '0'; // 拒绝稿件时手续费为0
      }

      const result = _utils().default.bignum.multiply(feeBase, _constants.default.fixedPoint).toString();

      return result;
    });

    function daoContribution(_x3) {
      return _daoContribution.apply(this, arguments);
    }

    return daoContribution;
  }()
};
exports.default = _default;