mirror of
https://github.com/status-im/snt-gas-relay.git
synced 2025-01-27 14:44:47 +00:00
Merge pull request #4 from status-im/ropsten-test
Simplify testing on Ropsten
This commit is contained in:
commit
98e8c010d3
@ -31,8 +31,8 @@ module.exports = {
|
||||
"currency": "USD"
|
||||
}
|
||||
},
|
||||
"0xd7879e4401c548544196dc0215df449B2a1E23B3": {
|
||||
"name": "Status Test Token",
|
||||
"0x121a430A73Fc13e2D6d4a9dc3E943de647c30f8f": {
|
||||
"name": "Status Gas Relayer Test Token",
|
||||
"symbol": "SNT",
|
||||
"minAccepted":{
|
||||
"value": 1,
|
||||
@ -46,7 +46,7 @@ module.exports = {
|
||||
"IdentityGasRelay": {
|
||||
"abiFile": "../abi/IdentityGasRelay.json",
|
||||
"isIdentity": true,
|
||||
"factoryAddress": "0x7F106A1Bc637AC4AAed3DC72582749c4562D4323",
|
||||
"factoryAddress": "0x89976FeEC7CFDF2DF5194e363FD2a3388e2DC91A",
|
||||
"kernelVerification": "isKernel(bytes32)",
|
||||
"allowedFunctions": [
|
||||
{
|
||||
@ -63,7 +63,7 @@ module.exports = {
|
||||
"SNTController": {
|
||||
"abiFile": "../abi/SNTController.json",
|
||||
"isIdentity": false,
|
||||
"address": "0xA77A1014F55157c3119FB3f53E653E42f8fa634c",
|
||||
"address": "0xf558aC91312821B0E1802567BC785355AA811783",
|
||||
"allowedFunctions": [
|
||||
{
|
||||
"function":"transferSNT(address,uint256,uint256,uint256,bytes)"
|
||||
|
@ -69,6 +69,10 @@ class Body extends Component {
|
||||
|
||||
let relayers = this.state.relayers;
|
||||
relayers[msgObj.sig] = msgObj.address;
|
||||
|
||||
if(this.state.relayerAddress == '0x0000000000000000000000000000000000000000'){
|
||||
this.setState({relayerAddress: msgObj.address});
|
||||
}
|
||||
|
||||
this.setState({relayers});
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ class Body extends Component {
|
||||
kid: null,
|
||||
skid: null,
|
||||
message: '',
|
||||
relayers: []
|
||||
relayerAddress: '0x0000000000000000000000000000000000000000',
|
||||
relayers: {}
|
||||
};
|
||||
}
|
||||
|
||||
@ -43,6 +44,14 @@ class Body extends Component {
|
||||
|
||||
const web3js = new Web3('ws://localhost:8546');
|
||||
|
||||
|
||||
// Default for devenv
|
||||
web3js.eth.net.getId().then(netId => {
|
||||
if(netId != 1 && netId != 3){
|
||||
this.setState({relayerAddress: config.relayAccount});
|
||||
}
|
||||
});
|
||||
|
||||
web3js.shh.newKeyPair()
|
||||
.then((kid) => {
|
||||
web3js.shh.addSymKey(config.relaySymKey)
|
||||
@ -58,9 +67,14 @@ class Body extends Component {
|
||||
if(msgObj.message == Messages.available){
|
||||
// found a relayer
|
||||
console.log("Relayer available: " + msgObj.sig);
|
||||
|
||||
let relayers = this.state.relayers;
|
||||
relayers.push(msgObj.sig);
|
||||
relayers = relayers.filter((value, index, self) => self.indexOf(value) === index);
|
||||
relayers[msgObj.sig] = msgObj.address;
|
||||
|
||||
if(this.state.relayerAddress == '0x0000000000000000000000000000000000000000'){
|
||||
this.setState({relayerAddress: msgObj.address});
|
||||
}
|
||||
|
||||
this.setState({relayers});
|
||||
}
|
||||
|
||||
@ -79,7 +93,7 @@ class Body extends Component {
|
||||
|
||||
web3.eth.getAccounts()
|
||||
.then(accounts => {
|
||||
this.setState({walletAddress: accounts[2]});
|
||||
this.setState({walletAddress: accounts[0]});
|
||||
});
|
||||
|
||||
});
|
||||
@ -89,6 +103,10 @@ class Body extends Component {
|
||||
this.setState({tab});
|
||||
};
|
||||
|
||||
updateRelayer = (relayer) => {
|
||||
this.setState({relayerAddress: this.state.relayers[relayer]});
|
||||
}
|
||||
|
||||
updateNonce = (newNonce) => {
|
||||
this.setState({nonce: newNonce});
|
||||
}
|
||||
@ -98,18 +116,18 @@ class Body extends Component {
|
||||
}
|
||||
|
||||
render(){
|
||||
const {tab, walletAddress, nonce, web3js, message, kid, skid, relayers} = this.state;
|
||||
const {tab, walletAddress, nonce, web3js, message, kid, skid, relayers, relayerAddress} = this.state;
|
||||
|
||||
return <Fragment>
|
||||
<Tabs value={tab} onChange={this.handleChange}>
|
||||
<Tab label="Transfer SNT" />
|
||||
<Tab label="Execute" />
|
||||
</Tabs>
|
||||
{tab === 0 && <Container><TransferSNT clearMessages={this.clearMessages} web3={web3js} kid={kid} skid={skid} nonce={nonce} relayers={relayers} /></Container>}
|
||||
{tab === 1 && <Container><Execute clearMessages={this.clearMessages} web3={web3js} kid={kid} skid={skid} nonce={nonce} relayers={relayers} /></Container>}
|
||||
{tab === 0 && <Container><TransferSNT clearMessages={this.clearMessages} web3={web3js} kid={kid} skid={skid} nonce={nonce} relayers={relayers} updateRelayer={this.updateRelayer} /></Container>}
|
||||
{tab === 1 && <Container><Execute clearMessages={this.clearMessages} web3={web3js} kid={kid} skid={skid} nonce={nonce} relayers={relayers} updateRelayer={this.updateRelayer} /></Container>}
|
||||
<Divider />
|
||||
<Container>
|
||||
<Status message={message} nonceUpdateFunction={this.updateNonce} nonce={nonce} walletAddress={walletAddress} />
|
||||
<Status relayerAddress={relayerAddress} message={message} nonceUpdateFunction={this.updateNonce} nonce={nonce} walletAddress={walletAddress} />
|
||||
</Container>
|
||||
</Fragment>;
|
||||
}
|
||||
|
@ -51,6 +51,9 @@ class Execute extends Component {
|
||||
}
|
||||
|
||||
handleChange = name => event => {
|
||||
if(name == 'relayer'){
|
||||
this.props.updateRelayer(event.target.value);
|
||||
}
|
||||
this.setState({
|
||||
[name]: event.target.value
|
||||
});
|
||||
@ -67,7 +70,7 @@ class Execute extends Component {
|
||||
try {
|
||||
const accounts = await web3.eth.getAccounts();
|
||||
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[2])
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[0])
|
||||
.execute(this.state.allowedContract, this.state.data)
|
||||
.setGas(this.state.gasPrice, this.state.gasMinimal);
|
||||
|
||||
@ -104,7 +107,7 @@ class Execute extends Component {
|
||||
try {
|
||||
const accounts = await web3.eth.getAccounts();
|
||||
|
||||
const s = new StatusGasRelayer.AvailableRelayers(Contracts.SNT, SNTController.options.address, accounts[2])
|
||||
const s = new StatusGasRelayer.AvailableRelayers(Contracts.SNT, SNTController.options.address, accounts[0])
|
||||
.setRelayersSymKeyID(skid)
|
||||
.setAsymmetricKeyID(kid)
|
||||
.setGas(STT.options.address, this.state.gasPrice);
|
||||
@ -124,10 +127,16 @@ class Execute extends Component {
|
||||
const {web3, kid} = this.props;
|
||||
|
||||
let relayer = this.state.relayer;
|
||||
if(relayer == '' && this.props.relayers.length == 1){
|
||||
relayer = this.props.relayers[0];
|
||||
}
|
||||
|
||||
|
||||
let relayers = [];
|
||||
for (var key in this.props.relayers) {
|
||||
if (this.props.relayers.hasOwnProperty(key)) relayers.push(key);
|
||||
}
|
||||
|
||||
if(relayer == '' && relayers.length == 1){
|
||||
relayer = relayers[0];
|
||||
}
|
||||
|
||||
this.setState({
|
||||
messagingError: '',
|
||||
@ -138,7 +147,7 @@ class Execute extends Component {
|
||||
try {
|
||||
const accounts = await web3.eth.getAccounts();
|
||||
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[2])
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[0])
|
||||
.execute(this.state.allowedContract, this.state.data)
|
||||
.setGas(this.state.gasPrice, this.state.gasMinimal)
|
||||
.setRelayer(relayer)
|
||||
@ -156,6 +165,12 @@ class Execute extends Component {
|
||||
|
||||
render(){
|
||||
const {classes} = this.props;
|
||||
|
||||
let relayers = [];
|
||||
for (var key in this.props.relayers) {
|
||||
if (this.props.relayers.hasOwnProperty(key)) relayers.push(key);
|
||||
}
|
||||
|
||||
return <div>
|
||||
<Card className={classes.card}>
|
||||
<CardContent>
|
||||
@ -279,12 +294,7 @@ class Execute extends Component {
|
||||
native: true
|
||||
}}
|
||||
>
|
||||
{
|
||||
this.props.relayers.length > 0 ?
|
||||
this.props.relayers.map((r, i) => <option key={i} value={r}>Relayer #{i+1}: {r}</option>)
|
||||
:
|
||||
<option></option>
|
||||
}
|
||||
{ relayers.length > 0 ? relayers.map((r, i) => <option key={i} value={r}>Relayer #{i+1}: {r}</option>) : <option></option> }
|
||||
</TextField>
|
||||
<TextField
|
||||
id="signature"
|
||||
@ -315,7 +325,8 @@ Execute.propTypes = {
|
||||
kid: PropTypes.string,
|
||||
skid: PropTypes.string,
|
||||
clearMessages: PropTypes.func,
|
||||
relayers: PropTypes.array.isRequired
|
||||
updateRelayer: PropTypes.func,
|
||||
relayers: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default withStyles(styles)(Execute);
|
||||
|
@ -83,13 +83,17 @@ class Status extends Component {
|
||||
|
||||
// Default for devenv
|
||||
web3.eth.net.getId().then(netId => {
|
||||
this.setState({isDev: netId != 1 && netId != 3});
|
||||
this.setState({isDev: netId != 1});
|
||||
});
|
||||
|
||||
web3.eth.subscribe('newBlockHeaders')
|
||||
.on('data', (block) => {
|
||||
this.web3BlockRead();
|
||||
}
|
||||
|
||||
web3BlockRead = () => {
|
||||
web3.eth.getBlock('latest').then(block => {
|
||||
this.setState({block: block.number});
|
||||
this.readChain();
|
||||
setTimeout(this.web3BlockRead, 10000);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -52,14 +52,15 @@ class Status extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
'isDev': true,
|
||||
'addressETHBalance': 0,
|
||||
'addressSTTBalance': 0,
|
||||
'relayerAddress': null,
|
||||
'relayerEthBalance': 0,
|
||||
'relayerSTTBalance': 0,
|
||||
'block': 0,
|
||||
'submitState': {
|
||||
'etherSend': false,
|
||||
'changeSNTController': false,
|
||||
'generateSTT': false
|
||||
}
|
||||
};
|
||||
@ -72,19 +73,25 @@ class Status extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
relayerAddress: config.relayAccount
|
||||
});
|
||||
|
||||
this.getBlock();
|
||||
});
|
||||
}
|
||||
|
||||
getBlock = () => {
|
||||
web3.eth.subscribe('newBlockHeaders')
|
||||
.on('data', (block) => {
|
||||
|
||||
// Default for devenv
|
||||
web3.eth.net.getId().then(netId => {
|
||||
this.setState({isDev: netId != 1});
|
||||
});
|
||||
|
||||
this.web3BlockRead();
|
||||
}
|
||||
|
||||
web3BlockRead = () => {
|
||||
web3.eth.getBlock('latest').then(block => {
|
||||
this.setState({block: block.number});
|
||||
this.readChain();
|
||||
setTimeout(this.web3BlockRead, 10000);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@ -117,12 +124,12 @@ class Status extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
web3.eth.getBalance(this.state.relayerAddress)
|
||||
web3.eth.getBalance(this.props.relayerAddress)
|
||||
.then(relayerEthBalance => {
|
||||
this.setState({relayerEthBalance});
|
||||
});
|
||||
|
||||
STT.methods.balanceOf(this.state.relayerAddress)
|
||||
STT.methods.balanceOf(this.props.relayerAddress)
|
||||
.call()
|
||||
.then(relayerSTTBalance => {
|
||||
this.setState({relayerSTTBalance: web3.utils.fromWei(relayerSTTBalance, 'ether')});
|
||||
@ -152,6 +159,12 @@ class Status extends Component {
|
||||
|
||||
changeSNTController = event => {
|
||||
event.preventDefault();
|
||||
|
||||
let submitState = this.state.submitState;
|
||||
submitState.changeSNTController = true;
|
||||
this.setState({submitState});
|
||||
|
||||
|
||||
const toSend = STT.methods.changeController(SNTController.options.address);
|
||||
|
||||
toSend.estimateGas()
|
||||
@ -160,6 +173,9 @@ class Status extends Component {
|
||||
})
|
||||
.then(receipt => {
|
||||
console.log(receipt);
|
||||
submitState = this.state.submitState;
|
||||
submitState.changeSNTController = false;
|
||||
this.setState({submitState});
|
||||
});
|
||||
}
|
||||
|
||||
@ -167,10 +183,10 @@ class Status extends Component {
|
||||
event.preventDefault();
|
||||
|
||||
let submitState = this.state.submitState;
|
||||
submitState.etherSend = false;
|
||||
submitState.etherSend = true;
|
||||
this.setState({submitState});
|
||||
|
||||
web3.eth.sendTransaction({from: web3.eth.defaultAccount, to: this.state.relayerAddress, value: web3.utils.toWei('1', "ether")})
|
||||
web3.eth.sendTransaction({from: web3.eth.defaultAccount, to: this.props.relayerAddress, value: web3.utils.toWei('1', "ether")})
|
||||
.then((receipt) => {
|
||||
console.log(receipt);
|
||||
submitState = this.state.submitState;
|
||||
@ -180,8 +196,8 @@ class Status extends Component {
|
||||
}
|
||||
|
||||
render(){
|
||||
const {classes, walletAddress, nonce} = this.props;
|
||||
const {addressETHBalance, relayerAddress, relayerEthBalance, addressSTTBalance, relayerSTTBalance, submitState, block} = this.state;
|
||||
const {classes, walletAddress, nonce, relayerAddress} = this.props;
|
||||
const {addressETHBalance, relayerEthBalance, addressSTTBalance, relayerSTTBalance, submitState, block, isDev} = this.state;
|
||||
|
||||
return <Fragment>
|
||||
<Card className={classes.card}>
|
||||
@ -200,14 +216,14 @@ class Status extends Component {
|
||||
<Typography variant="display1">
|
||||
Address
|
||||
</Typography>
|
||||
<Button className={classes.button} color="primary" aria-label="Generate STT" onClick={this.generateSTT} disabled={submitState.generateSTT}>
|
||||
{ isDev && <Button className={classes.button} color="primary" aria-label="Generate STT" onClick={this.generateSTT} disabled={submitState.generateSTT}>
|
||||
<AddIcon className={classes.icon} />
|
||||
1. Generate 5K STT (only on dev)
|
||||
</Button>
|
||||
<Button className={classes.button} color="primary" aria-label="Generate STT" onClick={this.changeSNTController}>
|
||||
</Button> }
|
||||
{ isDev && <Button className={classes.button} color="primary" aria-label="Generate STT" onClick={this.changeSNTController}>
|
||||
<AddIcon className={classes.icon} />
|
||||
2. Change SNT Controller
|
||||
</Button>
|
||||
</Button> }
|
||||
</ListItem>
|
||||
<ListItem className={classes.root}>
|
||||
<ListItemIcon>
|
||||
@ -247,10 +263,10 @@ class Status extends Component {
|
||||
<Typography variant="display1">
|
||||
Relayer
|
||||
</Typography>
|
||||
<Button className={classes.button} color="primary" aria-label="Add ether" onClick={this.sendEther} disabled={submitState.etherSend}>
|
||||
{ isDev && <Button className={classes.button} color="primary" aria-label="Add ether" onClick={this.sendEther} disabled={submitState.etherSend}>
|
||||
<AddIcon className={classes.icon} />
|
||||
Send ether
|
||||
</Button>
|
||||
</Button> }
|
||||
</ListItem>
|
||||
<ListItem className={classes.root}>
|
||||
<ListItemIcon>
|
||||
@ -292,7 +308,8 @@ Status.propTypes = {
|
||||
walletAddress: PropTypes.string,
|
||||
nonce: PropTypes.string.isRequired,
|
||||
nonceUpdateFunction: PropTypes.func.isRequired,
|
||||
message: PropTypes.string
|
||||
message: PropTypes.string,
|
||||
relayerAddress: PropTypes.string
|
||||
};
|
||||
|
||||
export default withStyles(styles)(Status);
|
||||
|
@ -51,6 +51,9 @@ class TransferSNT extends Component {
|
||||
}
|
||||
|
||||
handleChange = name => event => {
|
||||
if(name == 'relayer'){
|
||||
this.props.updateRelayer(event.target.value);
|
||||
}
|
||||
this.setState({
|
||||
[name]: event.target.value
|
||||
});
|
||||
@ -77,7 +80,7 @@ class TransferSNT extends Component {
|
||||
try {
|
||||
const accounts = await web3.eth.getAccounts();
|
||||
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[2])
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[0])
|
||||
.transferSNT(this.state.to, this.state.amount)
|
||||
.setGas(this.state.gasPrice);
|
||||
|
||||
@ -105,7 +108,7 @@ class TransferSNT extends Component {
|
||||
try {
|
||||
const accounts = await web3.eth.getAccounts();
|
||||
|
||||
const s = new StatusGasRelayer.AvailableRelayers(Contracts.SNT, SNTController.options.address, accounts[2])
|
||||
const s = new StatusGasRelayer.AvailableRelayers(Contracts.SNT, SNTController.options.address, accounts[0])
|
||||
.setRelayersSymKeyID(skid)
|
||||
.setAsymmetricKeyID(kid)
|
||||
.setGas(STT.options.address, this.state.gasPrice);
|
||||
@ -125,9 +128,16 @@ class TransferSNT extends Component {
|
||||
const {web3, kid} = this.props;
|
||||
|
||||
let relayer = this.state.relayer;
|
||||
if(relayer == '' && this.props.relayers.length == 1){
|
||||
relayer = this.props.relayers[0];
|
||||
}
|
||||
|
||||
|
||||
let relayers = [];
|
||||
for (var key in this.props.relayers) {
|
||||
if (this.props.relayers.hasOwnProperty(key)) relayers.push(key);
|
||||
}
|
||||
|
||||
if(relayer == '' && relayers.length == 1){
|
||||
relayer = relayers[0];
|
||||
}
|
||||
|
||||
this.setState({
|
||||
messagingError: '',
|
||||
@ -138,7 +148,7 @@ class TransferSNT extends Component {
|
||||
try {
|
||||
const accounts = await web3.eth.getAccounts();
|
||||
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[2])
|
||||
const s = new StatusGasRelayer.SNTController(SNTController.options.address, accounts[0])
|
||||
.transferSNT(this.state.to, this.state.amount)
|
||||
.setGas(this.state.gasPrice)
|
||||
.setRelayer(relayer)
|
||||
@ -156,6 +166,12 @@ class TransferSNT extends Component {
|
||||
|
||||
render(){
|
||||
const {classes} = this.props;
|
||||
|
||||
let relayers = [];
|
||||
for (var key in this.props.relayers) {
|
||||
if (this.props.relayers.hasOwnProperty(key)) relayers.push(key);
|
||||
}
|
||||
|
||||
return <div>
|
||||
<Card className={classes.card}>
|
||||
<CardContent>
|
||||
@ -270,12 +286,8 @@ class TransferSNT extends Component {
|
||||
native: true
|
||||
}}
|
||||
>
|
||||
{
|
||||
this.props.relayers.length > 0 ?
|
||||
this.props.relayers.map((r, i) => <option key={i} value={r}>Relayer #{i+1}: {r}</option>)
|
||||
:
|
||||
<option></option>
|
||||
}
|
||||
{ relayers.length > 0 ? relayers.map((r, i) => <option key={i} value={r}>Relayer #{i+1}: {r}</option>) : <option></option> }
|
||||
|
||||
</TextField>
|
||||
<TextField
|
||||
id="signature"
|
||||
@ -306,7 +318,8 @@ TransferSNT.propTypes = {
|
||||
kid: PropTypes.string,
|
||||
skid: PropTypes.string,
|
||||
clearMessages: PropTypes.func,
|
||||
relayers: PropTypes.array.isRequired
|
||||
updateRelayer: PropTypes.func,
|
||||
relayers: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default withStyles(styles)(TransferSNT);
|
||||
|
@ -51,12 +51,12 @@ module.exports = {
|
||||
"IdentityKernel": {"deploy": false},
|
||||
"STT": {
|
||||
"instanceOf": "TestMiniMeToken",
|
||||
"args":["$MiniMeTokenFactory", "0x0", "0x0", "Status Test Token", 18, "STT", true],
|
||||
"args":["$MiniMeTokenFactory", "0x0", "0x0", "Status Gas Relayer Test Token", 18, "STT", true],
|
||||
"gasLimit": 4000000
|
||||
},
|
||||
"SNTController": {
|
||||
"args": ["0x5f803F54679577fC974813E48abF012A243dD439", "$STT"]
|
||||
},
|
||||
},
|
||||
"IdentityGasRelay": {
|
||||
"deploy": true,
|
||||
"args": [[], [], [], 1, 1, "0x0000000000000000000000000000000000000000"]
|
||||
@ -73,31 +73,32 @@ module.exports = {
|
||||
},
|
||||
testnet: {
|
||||
contracts: {
|
||||
//
|
||||
"MiniMeTokenFactory": {
|
||||
"address": "0xBda00586BF6D79F22203EeDe046DEcaaf2B771B4"
|
||||
"address": "0xD1A2f3726331d6100E8BcD1484EdF796B0b20cc9"
|
||||
},
|
||||
"STT": {
|
||||
"instanceOf": "TestMiniMeToken",
|
||||
"address": "0xd7879e4401c548544196dc0215df449B2a1E23B3"
|
||||
"address": "0x121a430A73Fc13e2D6d4a9dc3E943de647c30f8f"
|
||||
},
|
||||
"SNTController": {
|
||||
"address": "0xA77A1014F55157c3119FB3f53E653E42f8fa634c"
|
||||
"address": "0xf558aC91312821B0E1802567BC785355AA811783"
|
||||
},
|
||||
"IdentityGasRelay": {
|
||||
"address": "0xEA60E967BA16Bf4313B5d23b78e44763C8928C67"
|
||||
"address": "0x4b571c5e75E93F53E985b12A3D107318178b9B5F"
|
||||
},
|
||||
"IdentityFactory": {
|
||||
"address": "0x7F106A1Bc637AC4AAed3DC72582749c4562D4323"
|
||||
"address": "0x89976FeEC7CFDF2DF5194e363FD2a3388e2DC91A"
|
||||
},
|
||||
"TestContract": {
|
||||
"address": "0x1F0C9ebD14Ba43BDD5b43C52EbEfc31066704988"
|
||||
"address": "0xa7aeF1cd3e4a8425D9A1E13B5557908895dCbdBE"
|
||||
}
|
||||
// If needed to deploy contracts again, uncomment the following lines
|
||||
/*
|
||||
"MiniMeTokenFactory": {"args":[]},
|
||||
"STT": {
|
||||
"instanceOf": "MiniMeToken",
|
||||
"args":["$MiniMeTokenFactory", "0x0", "0x0", "Status Test Token", 18, "STT", true],
|
||||
"args":["$MiniMeTokenFactory", "0x0", "0x0", "Status Gas Relayer Test Token", 18, "STT", true],
|
||||
"gasLimit": 4000000
|
||||
},
|
||||
"SNTController": {
|
||||
@ -114,9 +115,7 @@ module.exports = {
|
||||
},
|
||||
"TestContract": {
|
||||
"args": ["$STT"]
|
||||
}
|
||||
*/
|
||||
},
|
||||
accounts: [{privateKey: "71DB9B832BF457B4D812D6D6D673A02A1A2F5F687DBF59A2E41302A43459153C"}]
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,47 @@
|
||||
pragma solidity ^0.4.23;
|
||||
|
||||
|
||||
/*
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
INTENTIONALLY INSECURE DO NOT USE IN MAINNET
|
||||
*/
|
||||
/*
|
||||
Copyright 2016, Jordi Baylina
|
||||
|
||||
@ -26,7 +68,6 @@ pragma solidity ^0.4.23;
|
||||
* @dev It is ERC20 compliant, but still needs to under go further testing.
|
||||
*/
|
||||
|
||||
import "../common/Controlled.sol";
|
||||
import "../token/TokenController.sol";
|
||||
import "../token/ApproveAndCallFallBack.sol";
|
||||
import "../token/MiniMeTokenInterface.sol";
|
||||
@ -37,7 +78,7 @@ import "../token/MiniMeTokenFactory.sol";
|
||||
* that deploys the contract, so usually this token will be deployed by a
|
||||
* token controller contract, which Giveth will call a "Campaign"
|
||||
*/
|
||||
contract TestMiniMeToken is MiniMeTokenInterface, Controlled {
|
||||
contract TestMiniMeToken is MiniMeTokenInterface {
|
||||
|
||||
string public name; //The Token's name: e.g. DigixDAO Tokens
|
||||
uint8 public decimals; //Number of decimals of the smallest unit
|
||||
@ -86,6 +127,20 @@ contract TestMiniMeToken is MiniMeTokenInterface, Controlled {
|
||||
// The factory used to create new clone tokens
|
||||
MiniMeTokenFactory public tokenFactory;
|
||||
|
||||
modifier onlyController {
|
||||
require(msg.sender == controller);
|
||||
_;
|
||||
}
|
||||
|
||||
address public controller;
|
||||
|
||||
/// @notice Changes the controller of the contract
|
||||
/// @param _newController The new controller of the contract
|
||||
function changeController(address _newController) public {
|
||||
controller = _newController;
|
||||
}
|
||||
|
||||
|
||||
////////////////
|
||||
// Constructor
|
||||
////////////////
|
||||
@ -116,6 +171,8 @@ contract TestMiniMeToken is MiniMeTokenInterface, Controlled {
|
||||
)
|
||||
public
|
||||
{
|
||||
controller = msg.sender;
|
||||
|
||||
tokenFactory = MiniMeTokenFactory(_tokenFactory);
|
||||
name = _tokenName; // Set the name
|
||||
decimals = _decimalUnits; // Set the decimals
|
||||
|
Loading…
x
Reference in New Issue
Block a user