{"size": 787, "ext": "js", "max_stars_repo_path": "src/plugins/abi-class/FundManager.js", "max_stars_repo_name": "skkwon80/piction-poc", "max_stars_repo_stars_event_min_datetime": "2018-07-05T03:41:58.000Z", "max_stars_repo_stars_event_max_datetime": "2020-01-23T05:45:15.000Z", "max_issues_repo_path": "src/plugins/abi-class/FundManager.js", "max_issues_repo_name": "skkwon80/piction-poc", "max_issues_repo_issues_event_min_datetime": "2018-07-10T07:43:40.000Z", "max_issues_repo_issues_event_max_datetime": "2018-10-29T08:02:56.000Z", "max_forks_repo_path": "src/plugins/abi-class/FundManager.js", "max_forks_repo_name": "skkwon80/piction-poc", "max_forks_repo_forks_event_min_datetime": "2020-01-23T05:45:17.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-23T05:45:17.000Z"}
{"max_stars_count": 4, "max_issues_count": 11, "max_forks_count": 1, "avg_line_length": 34.2173913043, "max_line_length": 131, "alphanum_fraction": 0.7420584498}
import BigNumber from 'bignumber.js'

class FundManager {
  constructor(abi, address, from, gas) {
    this._contract = new web3.eth.Contract(abi, address);
    this._contract.options.from = from;
    this._contract.options.gas = gas;
  }

  addFund(contentAddress, writerAddress, startTime, endTime, poolSize, interval, distributionRate, detail) {
    console.log(contentAddress, writerAddress, startTime, endTime, poolSize, interval, distributionRate, detail)
    return this._contract.methods.addFund(
      contentAddress, writerAddress, startTime, endTime, poolSize, interval, BigNumber(distributionRate * Math.pow(10, 18)), detail
    ).send();
  }

  getFunds(contentAddress) {
    return this._contract.methods.getFunds(contentAddress).call();
  }
}

export default FundManager;
