Permalink
Browse files

removed onlyOwnerOrigin

update deploy instructions
  • Loading branch information...
conejoninja committed Jun 6, 2018
1 parent 4c2273e commit 1e66bc3b023bee954b802799e6b7f8a568965a99
@@ -82,15 +82,27 @@ Instrucciones para interactuar con contratos:
DEPLOY EN ESTE ORDEN :

1.- Publicar contrato Escrow
2.- Publicar contrato ComplianceServiceAlwaysTrue
2.- Publicar contrato ComplianceService
3.- Publicar contrato Tokens(EscrowAddress, ComplianceServiceAddress) <-- Hay que pasarle el address del escrow

4.- Escrow.setTokensContract(TokensAddress) <-- Hay que llamar a esta funcion (ver arriba instrucciones para interactuar con contratos, usar el ABI de Escrow y su dirección)

5.- Publicar contrato Whitelist
6.- Publicar contrato RefundVault
7.- Publicar contrato ICOPreSale(escrow, tokens, whitelist, refundvault) <-- Hay que pasarle todos los address anteriores
8.- Publicar contrato ICOTierOne(escrow, tokens, whitelist, refundvault) <-- Hay que pasarle todos los address anteriores. Esto cambia el ICOAddress de Escrow

8.- Tokens.setMyICOContract(ICO address)
9.- RefundVault.setMyICOContract(ICO address)
10.- Escrow.setMyICOContract(ICO address)
11.- ICOPresale.fundICO()


12.- Publicar contrato ICOTierOne(escrow, tokens, whitelist, refundvault) <-- Hay que pasarle todos los address anteriores. Esto cambia el ICOAddress de Escrow

13.- Tokens.setMyICOContract(ICO address)
14.- RefundVault.setMyICOContract(ICO address)
15.- Escrow.setMyICOContract(ICO address)
16.- ICOTierOne.fundICO()



@@ -62,8 +62,8 @@ contract Escrow is System, HardcodedWallets {
return false;
}

if (msg.sender != addressSCICO && tx.origin != owner) {
error('Escrow: not allowed to withdraw');
if (msg.sender != addressSCICO || tx.origin != owner) {
error('Escrow: not allowed to fund the ICO');
return false;
}
if (deposited[this]<_amount) {
@@ -82,14 +82,14 @@ contract Escrow is System, HardcodedWallets {
/**
* @notice The owner can specify which ICO contract is allowed to transfer tokens while timelock is on
*/
function setMyICOContract(address _SCICO) public onlyOwnerOrigin {
function setMyICOContract(address _SCICO) public onlyOwner {
addressSCICO = _SCICO;
}

/**
* @notice Set the tokens contract
*/
function setTokensContract(address _addressSCTokens) public onlyOwnerOrigin {
function setTokensContract(address _addressSCTokens) public onlyOwner {
addressSCTokens = _addressSCTokens;
SCTokens = Tokens(_addressSCTokens);
}
@@ -62,6 +62,7 @@ contract ICO is HardcodedWallets, Haltable {
Tokens public SCTokens; // The token being sold
RefundVault public SCRefundVault; // The vault for softCap refund
Whitelist public SCWhitelist; // The whitelist of allowed wallets to buy tokens on ICO
Escrow public SCEscrow; // Escrow service

// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
@@ -277,9 +278,16 @@ contract ICO is HardcodedWallets, Haltable {
return true;
}

function fundICO() public onlyOwner {
if (!SCEscrow.fundICO(tokensHardCap, 0)) {
revert('ICO funding failed');
}
}




// **** EVENTS
// **** EVENTS

// Triggered when an investor buys some tokens directly with Ethers
event BuyTokens(address indexed _purchaser, uint256 _value, uint256 _amount);
@@ -27,9 +27,6 @@ contract ICOPreSale is ICO {
SCWhitelist = Whitelist(_SCWhitelist);
SCRefundVault = RefundVault(_SCRefundVault);

SCTokens.setMyICOContract(this); // Set circular reference of this ICO contract on its Token contract
SCRefundVault.setMyICOContract(this); // Set circular reference of this ICO contract on its RefundVault contract

weisPerEther = 1 ether; // 10e^18 multiplier

// Deadline
@@ -65,12 +62,7 @@ contract ICOPreSale is ICO {
etherSoftCap = 750; // As of 2018-05-09 => Softcap pre sale: 750 ETH
weisSoftCap = weisPerEther.mul(etherSoftCap);

// Fill ICO contract with for-sale tokens. SC Escrow is supposed to own the ICO tokens before contract deployment
Escrow SCEscrow = Escrow(_SCEscrow);
SCEscrow.setMyICOContract(this);
if (!SCEscrow.fundICO(tokensHardCap, 0)) {
error('ICO constructor: Token funding failed');
}
SCEscrow = Escrow(_SCEscrow);
}

}
@@ -27,9 +27,6 @@ contract ICOTierOne is ICO {
SCWhitelist = Whitelist(_SCWhitelist);
SCRefundVault = RefundVault(_SCRefundVault);

SCTokens.setMyICOContract(this); // Set circular reference of this ICO contract on its Token contract
SCRefundVault.setMyICOContract(this); // Set circular reference of this ICO contract on its RefundVault contract

weisPerEther = 1 ether; // 10e^18 multiplier

// Deadline
@@ -65,12 +62,7 @@ contract ICOTierOne is ICO {
etherSoftCap = 0; // As of 2018-05-09 => Softcap pre sale: 750 ETH
weisSoftCap = weisPerEther.mul(etherSoftCap);

// Fill ICO contract with for-sale tokens. SC Escrow is supposed to own the ICO tokens before contract deployment
Escrow SCEscrow = Escrow(_SCEscrow);
SCEscrow.setMyICOContract(this);
if (!SCEscrow.fundICO(tokensHardCap, 1)) {
error('ICO constructor: Token funding failed');
}
SCEscrow = Escrow(_SCEscrow);
}

}
@@ -137,7 +137,7 @@ contract RefundVault is HardcodedWallets, System {
/**
* @notice The owner must specify which ICO contract is allowed call for refunds
*/
function setMyICOContract(address _SCICO) public onlyOwnerOrigin {
function setMyICOContract(address _SCICO) public onlyOwner {
require(address(this).balance == 0);
addressSCICO = _SCICO;
}
@@ -87,16 +87,6 @@ contract System {
}
}

// @notice To limit functions usage to contract owner, directly or indirectly (through another contract call)
modifier onlyOwnerOrigin() {
if (msg.sender != owner && tx.origin != owner) {
error('System: onlyOwnerOrigin function called by user that is not owner nor a contract called by owner at origin');
} else {
_;
}
}


// **** FUNCTIONS

// @notice Calls whenever an error occurs, logs it or reverts transaction
@@ -232,7 +232,7 @@ contract Tokens is HardcodedWallets, ERC20, Haltable {
/**
* @notice The owner can specify which ICO contract is allowed to transfer tokens while timelock is on
*/
function setMyICOContract(address _SCICO) public onlyOwnerOrigin {
function setMyICOContract(address _SCICO) public onlyOwner {
addressSCICO = _SCICO;
}

0 comments on commit 1e66bc3

Please sign in to comment.