Skip to content

Commit

Permalink
Merge pull request #5 from Stacktical/migrate-token-to-dedicated-repo
Browse files Browse the repository at this point in the history
Migrate token to dedicated repo
  • Loading branch information
bussyjd committed Nov 6, 2018
2 parents 5f26d9f + 9c13cb9 commit d53448a
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 182 deletions.
Binary file modified MyContract.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added contracts/Crowdsale/DSLACrowdsale-describe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions contracts/Crowdsale/DSLACrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pragma solidity 0.4.24;

import "../DSLA/DSLA.sol";
import "./PullPayment.sol";
import "./VestedCrowdsale.sol";
import "./Whitelist.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";


/**
Expand All @@ -25,7 +25,7 @@ contract DSLACrowdsale is VestedCrowdsale, Whitelist, Pausable, PullPayment {
// mapping ico rounds
mapping (uint256 => IcoRound) public icoRounds;
// The token being sold
DSLA private _token;
ERC20Burnable private _token;
// Address where funds are collected
address private _wallet;
// Amount of wei raised
Expand Down Expand Up @@ -63,7 +63,7 @@ contract DSLACrowdsale is VestedCrowdsale, Whitelist, Pausable, PullPayment {
* @param wallet Address where collected funds will be forwarded to
* @param token Address of the token being sold
*/
constructor(address wallet, DSLA token) public {
constructor(address wallet, ERC20Burnable token) public {
require(wallet != address(0) && token != address(0));

icoRounds[1] = IcoRound(
Expand Down Expand Up @@ -254,7 +254,7 @@ contract DSLACrowdsale is VestedCrowdsale, Whitelist, Pausable, PullPayment {
* @dev returns the token being sold
* @return the token being sold
*/
function token() public view returns(DSLA) {
function token() public view returns(ERC20Burnable) {
return _token;
}

Expand Down
Binary file removed contracts/Crowdsale/Sale-describe.png
Binary file not shown.
Binary file removed contracts/DSLA/DSLA.png
Binary file not shown.
20 changes: 0 additions & 20 deletions contracts/DSLA/DSLA.sol

This file was deleted.

86 changes: 0 additions & 86 deletions contracts/DSLA/LockupToken.sol

This file was deleted.

Binary file removed contracts/DSLA/Token-describe.png
Binary file not shown.
Binary file added contracts/Mocks/DSLAMock-describe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added contracts/Mocks/DSLAMock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions contracts/Mocks/DSLAMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";

contract DSLAMock is ERC20Burnable {
uint256 public constant INITIAL_SUPPLY = 10000000000000000000000000000;

/**
* @dev Constructor
*/
constructor() public {
_mint(msg.sender, INITIAL_SUPPLY);
}
}
24 changes: 8 additions & 16 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
const DSLA = artifacts.require('./DSLA.sol');
const DSLACrowdsale = artifacts.require('./DSLACrowdsale.sol');

module.exports = function(deployer, network) {
// Dec 31th 2018 8AM GMT
const releaseDate = 1546243200;
let wallet = "0xaf13f12ebe00cd02f486e000927408148e768802";
let dsla;
let crowdsale;
let wallet;
let DSLATokenAddress;

return deployer.deploy(DSLA, releaseDate).then(function(instance){
dsla = instance;
return deployer.deploy(DSLACrowdsale, wallet, dsla.address).then(function(instance){
crowdsale = instance;
return dsla.setCrowdsaleAddress(crowdsale.address).then(async function(){
const adr = await dsla.crowdsaleAddress.call();
console.log("Crowdsale address set to " + adr);
});
});
});
if (network === 'development') {
wallet = "0x1234567890";
DSLATokenAddress = "0x1234567891"
}

return deployer.deploy(DSLACrowdsale, wallet, DSLATokenAddress)
}
12 changes: 2 additions & 10 deletions test/presale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import assertRevert from './helpers/assertRevert';
import latestTime from './helpers/latestTime';
import { increaseTimeTo, duration } from './helpers/increaseTime';

const Token = artifacts.require('./DSLA.sol');
const Token = artifacts.require('./DSLAMock.sol');
const Crowdsale = artifacts.require('./DSLACrowdsale.sol');
const BigNumber = web3.BigNumber;

contract('ROUND 2', function ([owner, project, anotherAccount, user1, user2, wallet]) {
let token;
let crowdsale;
const releaseDate = 1546243200;
const tokensToSell = new BigNumber('5e27');
const rate = 312500;
const individualFloor = web3.toWei('12', 'ether');
Expand All @@ -18,19 +17,12 @@ contract('ROUND 2', function ([owner, project, anotherAccount, user1, user2, wal
const hardCap = web3.toWei('6000', 'ether');

beforeEach('redeploy', async function () {
token = await Token.new(releaseDate, {from : owner});
token = await Token.new({from : owner});
crowdsale = await Crowdsale.new(wallet, token.address, {from : owner});

await token.setCrowdsaleAddress(crowdsale.address, {from : owner});
await token.transfer(crowdsale.address, tokensToSell, {from : owner});
});

describe('Check if the crowdsale address is set', function () {
it('return the same address', async function () {
assert.equal(await token.crowdsaleAddress.call(), crowdsale.address);
});
});

describe('Pre-sale period', function () {
it('rejects a contribution made when pre sale not yet starting', async function () {
const paymentAmount = web3.toWei('12', 'ether');
Expand Down
7 changes: 2 additions & 5 deletions test/presale.vesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assertRevert from './helpers/assertRevert';
import latestTime from './helpers/latestTime';
import { increaseTimeTo, duration } from './helpers/increaseTime';

const Token = artifacts.require('./DSLA.sol');
const Token = artifacts.require('./DSLAMock.sol');
const Crowdsale = artifacts.require('./DSLACrowdsale.sol');
const BigNumber = web3.BigNumber;

Expand All @@ -13,14 +13,11 @@ contract('Vesting', function ([owner, project, anotherAccount, user1, user2, wal
const april30 = 1556611200;
const july31 = 1564560000;


describe('Vesting process for presale period', function () {
beforeEach('redeploy', async function () {
var releaseDate = latestTime() + duration.days(30);
token = await Token.new(releaseDate, {from : owner});
token = await Token.new({from : owner});
crowdsale = await Crowdsale.new(wallet, token.address, {from : owner});

await token.setCrowdsaleAddress(crowdsale.address, {from : owner});
await token.transfer(crowdsale.address, tokensToSell, {from : owner});
});
it('rejects claiming tokens from a conntributor of the presale before april30', async function () {
Expand Down
13 changes: 2 additions & 11 deletions test/privatesale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,27 @@ import assertRevert from './helpers/assertRevert';
import latestTime from './helpers/latestTime';
import { increaseTimeTo, duration } from './helpers/increaseTime';

const Token = artifacts.require('./DSLA.sol');
const Token = artifacts.require('./DSLAMock.sol');
const Crowdsale = artifacts.require('./DSLACrowdsale.sol');
const BigNumber = web3.BigNumber;

contract('ROUND 1', function ([owner, project, anotherAccount, user1, user2, wallet]) {
let token;
let crowdsale;
const releaseDate = 1546243200;
const tokensToSell = new BigNumber('5e27');
const rate = 416700;
const individualFloor = web3.toWei('3', 'ether');
const individualCap = web3.toWei('120', 'ether');
const softCap = 0;
const hardCap = web3.toWei('1200', 'ether');


beforeEach('redeploy', async function () {
token = await Token.new(releaseDate, {from : owner});
token = await Token.new({from : owner});
crowdsale = await Crowdsale.new(wallet, token.address, {from : owner});

await token.setCrowdsaleAddress(crowdsale.address, {from : owner});
await token.transfer(crowdsale.address, tokensToSell, {from : owner});
});

describe('Check if the crowdsale address is set', function () {
it('return the same address', async function () {
assert.equal(await token.crowdsaleAddress.call(), crowdsale.address);
});
});

describe('Private sale period', function () {
it('rejects a contribution made when private sale not yet starting', async function () {
const paymentAmount = web3.toWei('3', 'ether');
Expand Down
7 changes: 2 additions & 5 deletions test/privatesale.vesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assertRevert from './helpers/assertRevert';
import latestTime from './helpers/latestTime';
import { increaseTimeTo, duration } from './helpers/increaseTime';

const Token = artifacts.require('./DSLA.sol');
const Token = artifacts.require('./DSLAMock.sol');
const Crowdsale = artifacts.require('./DSLACrowdsale.sol');
const BigNumber = web3.BigNumber;

Expand All @@ -14,14 +14,11 @@ contract('Vesting', function ([owner, project, anotherAccount, user1, user2, wal
const june30 = 1561881600;
const sept30 = 1569830400;


describe('Vesting process for private sale period', function () {
beforeEach('redeploy', async function () {
var releaseDate = latestTime() + duration.days(30);
token = await Token.new(releaseDate, {from : owner});
token = await Token.new({from : owner});
crowdsale = await Crowdsale.new(wallet, token.address, {from : owner});

await token.setCrowdsaleAddress(crowdsale.address, {from : owner});
await token.transfer(crowdsale.address, tokensToSell, {from : owner});
});
it('rejects claiming tokens from a conntributor of the privatesale before march31', async function () {
Expand Down
12 changes: 2 additions & 10 deletions test/refund.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import assertRevert from './helpers/assertRevert';
import latestTime from './helpers/latestTime';
import { increaseTimeTo, duration } from './helpers/increaseTime';

const Token = artifacts.require('./DSLA.sol');
const Token = artifacts.require('./DSLAMock.sol');
const Crowdsale = artifacts.require('./DSLACrowdsale.sol');
const BigNumber = web3.BigNumber;

contract('Refund', function ([owner, project, anotherAccount, user1, user2, wallet]) {
let token;
let crowdsale;
const releaseDate = 1546243200;
const tokensToSell = new BigNumber('5e27');
const rate = 250000;
const individualFloor = web3.toWei('3', 'ether');
Expand All @@ -18,19 +17,12 @@ contract('Refund', function ([owner, project, anotherAccount, user1, user2, wall
const hardCap = web3.toWei('17200', 'ether');

beforeEach('redeploy', async function () {
token = await Token.new(releaseDate, {from : owner});
token = await Token.new({from : owner});
crowdsale = await Crowdsale.new(wallet, token.address, {from : owner});

await token.setCrowdsaleAddress(crowdsale.address, {from : owner});
await token.transfer(crowdsale.address, tokensToSell, {from : owner});
});

describe('Check if the crowdsale address is set', function () {
it('return the same address', async function () {
assert.equal(await token.crowdsaleAddress.call(), crowdsale.address);
});
});

describe('Refund period', function () {
it('rejects refunding a conntributor of the privatesale period', async function () {
const paymentAmount = web3.toWei('3', 'ether');
Expand Down
12 changes: 2 additions & 10 deletions test/sale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import assertRevert from './helpers/assertRevert';
import latestTime from './helpers/latestTime';
import { increaseTimeTo, duration } from './helpers/increaseTime';

const Token = artifacts.require('./DSLA.sol');
const Token = artifacts.require('./DSLAMock.sol');
const Crowdsale = artifacts.require('./DSLACrowdsale.sol');
const BigNumber = web3.BigNumber;

contract('ROUND 3', function ([owner, project, anotherAccount, user1, user2, wallet]) {
let token;
let crowdsale;
const releaseDate = 1546243200;
const tokensToSell = new BigNumber('5e27');
const rate = 250000;
const individualFloor = web3.toWei('3', 'ether');
Expand All @@ -18,19 +17,12 @@ contract('ROUND 3', function ([owner, project, anotherAccount, user1, user2, wal
const hardCap = web3.toWei('17200', 'ether');

beforeEach('redeploy', async function () {
token = await Token.new(releaseDate, {from : owner});
token = await Token.new({from : owner});
crowdsale = await Crowdsale.new(wallet, token.address, {from : owner});

await token.setCrowdsaleAddress(crowdsale.address, {from : owner});
await token.transfer(crowdsale.address, tokensToSell, {from : owner});
});

describe('Check if the crowdsale address is set', function () {
it('return the same address', async function () {
assert.equal(await token.crowdsaleAddress.call(), crowdsale.address);
});
});

describe('Sale period', function () {
it('rejects a contribution made when sale not yet starting', async function () {
const paymentAmount = web3.toWei('3', 'ether');
Expand Down
Loading

0 comments on commit d53448a

Please sign in to comment.