{"size": 1933, "ext": "js", "max_stars_repo_path": "migrations/4_deploy_crowdsale.js", "max_stars_repo_name": "rocket-pool/rocketpool-crowdsale", "max_stars_repo_stars_event_min_datetime": "2018-02-28T10:46:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T19:02:45.000Z", "max_issues_repo_path": "migrations/4_deploy_crowdsale.js", "max_issues_repo_name": "rocket-pool/rocketpool-crowdsale", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "migrations/4_deploy_crowdsale.js", "max_forks_repo_name": "rocket-pool/rocketpool-crowdsale", "max_forks_repo_forks_event_min_datetime": "2018-06-05T22:59:41.000Z", "max_forks_repo_forks_event_max_datetime": "2018-06-05T22:59:41.000Z"}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 47.1463414634, "max_line_length": 133, "alphanum_fraction": 0.6332126229}
// Config
var config = require("../truffle.js");

// Contracts
var rocketPoolToken = artifacts.require("./RocketPoolToken.sol");
var rocketPoolCrowdsale = artifacts.require("./sales/RocketPoolCrowdsale.sol");


// Deploy now
module.exports = function(deployer, network) {
        // Settings
        var salesContractsSettings = config.networks[network].salesContracts;
        // If we are on local, the depositAddress is the coinbase
        var crowdsaleDepositAddress = network == 'development' ? web3.eth.coinbase : salesContractsSettings.crowdsale.depositAddress;
        // Deploy crowdsales contract next
        return deployer.deploy(rocketPoolCrowdsale, rocketPoolToken.address).then(function () {
            // Set everything the main token contract needs now
            return rocketPoolToken.deployed().then(function (rocketPoolTokenInstance) {
                // Register our sale agent contracts with the main token contract now
                console.log("\n");
                // Set the crowdsale contract
                rocketPoolTokenInstance.setSaleAgentContract(
                    rocketPoolCrowdsale.address,
                    'crowdsale',
                    salesContractsSettings.crowdsale.targetEthMin,
                    salesContractsSettings.crowdsale.targetEthMax,
                    salesContractsSettings.crowdsale.tokensLimit,
                    salesContractsSettings.crowdsale.minDeposit,
                    salesContractsSettings.crowdsale.maxDeposit,
                    salesContractsSettings.crowdsale.fundingStartBlock,
                    salesContractsSettings.crowdsale.fundingEndBlock,
                    crowdsaleDepositAddress
                );
                console.log('\x1b[33m%s\x1b[0m:', 'Added New Sales Agent Contract - Crowdsale 1');
                console.log(rocketPoolCrowdsale.address);
                console.log("\n");
            });  
        });
};

