-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring for tests + added new interface for setting exchange rate
- Loading branch information
1 parent
4baa587
commit 06f42ea
Showing
15 changed files
with
115 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,35 @@ | ||
pragma solidity ^0.4.23; | ||
|
||
import "eip820/contracts/ERC820Implementer.sol"; | ||
import "./JaroCoinToken.sol"; | ||
|
||
interface ERC777TokensRecipient { | ||
function tokensReceived(address operator, address from, address to, uint amount, bytes userData, bytes operatorData) external; | ||
} | ||
|
||
contract BurnableToken { | ||
event Burned(address indexed operator, address indexed from, uint256 amount, bytes userData, bytes operatorData); | ||
function burn(uint256 _amount, bytes _userData) public { | ||
emit Burned(msg.sender, msg.sender, _amount, _userData, ""); | ||
} | ||
} | ||
|
||
/** | ||
* The Pay contract helps people to burn JaroCoin tokens (pay for Jaro services) | ||
* without knowing how to touch `burn` function from JaroCoin Token smart contract. | ||
*/ | ||
contract Pay is ERC820Implementer, ERC777TokensRecipient { | ||
JaroCoinToken public token; | ||
BurnableToken public token; | ||
|
||
event Payed(address operator, address from, address to, uint amount, bytes userData, bytes operatorData); | ||
|
||
constructor(address _token) public { | ||
setInterfaceImplementation("ERC777TokensRecipient", this); | ||
token = JaroCoinToken(_token); | ||
token = BurnableToken(_token); | ||
} | ||
|
||
// ERC777 tokens receiver callback | ||
function tokensReceived(address operator, address from, address to, uint amount, bytes userData, bytes operatorData) external { | ||
token.burn(amount, userData); | ||
emit Payed(operator, from, to, amount, userData, operatorData); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const JaroCoin = artifacts.require("./JaroCoinToken.sol") | ||
const JaroCoinCrowdsale = artifacts.require("./JaroCoinCrowdsale.sol") | ||
const CrowdsaleProxy = artifacts.require("./CrowdsaleProxy.sol") | ||
const EIP820Registry = require("eip820"); | ||
|
||
const owner = '0xa465495956083b62b5a2a864ff6a00bc0034d16d' | ||
const familyOwner = '0x807EcA0E76075253816F0361E149b8F2D6F7B42d' | ||
const personalOwner = '0x83A63Ee3E80716391b5C77E7e06c3d75e64597f4' | ||
|
||
module.exports = function(deployer, network, accounts) { | ||
if (network === 'development') { | ||
const Web3Latest = require("web3"); | ||
const web3latest = new Web3Latest('http://localhost:8545'); | ||
return EIP820Registry.deploy(web3latest, accounts[0]); | ||
} | ||
|
||
deployer.deploy(JaroCoin).then(() => { | ||
return deployer.deploy(JaroCoinCrowdsale) | ||
}).then(() => { | ||
return deployer.deploy(CrowdsaleProxy, JaroCoinCrowdsale.address) | ||
}).then(() => { | ||
return CrowdsaleProxy.deployed() | ||
}).then((proxy) => { | ||
return proxy.___initialize(JaroCoin.address, familyOwner, personalOwner) | ||
}).then(() => { | ||
return JaroCoin.deployed() | ||
}).then((token) => { | ||
return token.transferOwnership(CrowdsaleProxy.address) | ||
}).then(() => { | ||
return CrowdsaleProxy.deployed() | ||
}).then((proxy) => { | ||
const proxiedCrowdsale = JaroCoinCrowdsale.at(proxy.address) | ||
return proxiedCrowdsale.startSale(1523855000) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.