Files required for building a plasma service

This commit is contained in:
Richard Ramos 2018-08-01 15:14:34 -04:00
parent 4f5d97242e
commit 50e66fd679
9 changed files with 2207 additions and 0 deletions

4
plasma_service/.babelrc Normal file
View File

@ -0,0 +1,4 @@
{
"presets": ["es2015", "stage-2"],
"plugins": []
}

1
plasma_service/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
dist/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,194 @@
{
"className": "ValidatorManagerContract",
"args": [],
"code": "608060405260008054600160a060020a031916331790556103f4806100256000396000f3006080604052600436106100985763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631124e56f811461009d57806315c75f89146100c0578063797327ae146100e157806379ba5097146101165780638da5cb5b1461012b578063a6f9dae11461015c578063d4ee1d901461017d578063e744092e14610192578063fa52c7d8146101b3575b600080fd5b3480156100a957600080fd5b506100be600160a060020a03600435166101d4565b005b3480156100cc57600080fd5b506100be600160a060020a0360043516610214565b3480156100ed57600080fd5b50610102600160a060020a03600435166102b3565b604080519115158252519081900360200190f35b34801561012257600080fd5b506100be6102f5565b34801561013757600080fd5b5061014061033a565b60408051600160a060020a039092168252519081900360200190f35b34801561016857600080fd5b506100be600160a060020a0360043516610349565b34801561018957600080fd5b5061014061038f565b34801561019e57600080fd5b50610102600160a060020a036004351661039e565b3480156101bf57600080fd5b50610102600160a060020a03600435166103b3565b600054600160a060020a031633146101eb57600080fd5b600160a060020a03166000908152600260205260409020805460ff19811660ff90911615179055565b61021d336102b3565b151561028a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420612076616c696461746f720000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03166000908152600360205260409020805460ff19811660ff90911615179055565b60008054600160a060020a03838116911614156102d2575060016102f0565b50600160a060020a03811660009081526002602052604090205460ff165b919050565b600154600160a060020a0316331415610338576001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600054600160a060020a031681565b600054600160a060020a0316331461036057600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a031681565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff16815600a165627a7a7230582024f9fab31318aec7c9c9ba8dfdc86f367bd06fd4195c64b19bf00373b17787fa0029",
"runtimeBytecode": "6080604052600436106100985763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631124e56f811461009d57806315c75f89146100c0578063797327ae146100e157806379ba5097146101165780638da5cb5b1461012b578063a6f9dae11461015c578063d4ee1d901461017d578063e744092e14610192578063fa52c7d8146101b3575b600080fd5b3480156100a957600080fd5b506100be600160a060020a03600435166101d4565b005b3480156100cc57600080fd5b506100be600160a060020a0360043516610214565b3480156100ed57600080fd5b50610102600160a060020a03600435166102b3565b604080519115158252519081900360200190f35b34801561012257600080fd5b506100be6102f5565b34801561013757600080fd5b5061014061033a565b60408051600160a060020a039092168252519081900360200190f35b34801561016857600080fd5b506100be600160a060020a0360043516610349565b34801561018957600080fd5b5061014061038f565b34801561019e57600080fd5b50610102600160a060020a036004351661039e565b3480156101bf57600080fd5b50610102600160a060020a03600435166103b3565b600054600160a060020a031633146101eb57600080fd5b600160a060020a03166000908152600260205260409020805460ff19811660ff90911615179055565b61021d336102b3565b151561028a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420612076616c696461746f720000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03166000908152600360205260409020805460ff19811660ff90911615179055565b60008054600160a060020a03838116911614156102d2575060016102f0565b50600160a060020a03811660009081526002602052604090205460ff165b919050565b600154600160a060020a0316331415610338576001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600054600160a060020a031681565b600054600160a060020a0316331461036057600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a031681565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff16815600a165627a7a7230582024f9fab31318aec7c9c9ba8dfdc86f367bd06fd4195c64b19bf00373b17787fa0029",
"realRuntimeBytecode": "6080604052600436106100985763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631124e56f811461009d57806315c75f89146100c0578063797327ae146100e157806379ba5097146101165780638da5cb5b1461012b578063a6f9dae11461015c578063d4ee1d901461017d578063e744092e14610192578063fa52c7d8146101b3575b600080fd5b3480156100a957600080fd5b506100be600160a060020a03600435166101d4565b005b3480156100cc57600080fd5b506100be600160a060020a0360043516610214565b3480156100ed57600080fd5b50610102600160a060020a03600435166102b3565b604080519115158252519081900360200190f35b34801561012257600080fd5b506100be6102f5565b34801561013757600080fd5b5061014061033a565b60408051600160a060020a039092168252519081900360200190f35b34801561016857600080fd5b506100be600160a060020a0360043516610349565b34801561018957600080fd5b5061014061038f565b34801561019e57600080fd5b50610102600160a060020a036004351661039e565b3480156101bf57600080fd5b50610102600160a060020a03600435166103b3565b600054600160a060020a031633146101eb57600080fd5b600160a060020a03166000908152600260205260409020805460ff19811660ff90911615179055565b61021d336102b3565b151561028a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420612076616c696461746f720000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03166000908152600360205260409020805460ff19811660ff90911615179055565b60008054600160a060020a03838116911614156102d2575060016102f0565b50600160a060020a03811660009081526002602052604090205460ff165b919050565b600154600160a060020a0316331415610338576001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600054600160a060020a031681565b600054600160a060020a0316331461036057600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a031681565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff16815600a165627a7a7230582024f9fab31318aec7c9c9ba8dfdc86f367bd06fd4195c64b19bf00373b17787fa0029",
"swarmHash": "24f9fab31318aec7c9c9ba8dfdc86f367bd06fd4195c64b19bf00373b17787fa",
"gasEstimates": {
"creation": {
"codeDepositCost": "202400",
"executionCost": "20513",
"totalCost": "222913"
},
"external": {
"acceptOwnership()": "21010",
"allowedTokens(address)": "697",
"changeOwner(address)": "20932",
"checkValidator(address)": "986",
"newOwner()": "669",
"owner()": "625",
"toggleToken(address)": "21336",
"toggleValidator(address)": "20888",
"validators(address)": "719"
}
},
"functionHashes": {
"acceptOwnership()": "79ba5097",
"allowedTokens(address)": "e744092e",
"changeOwner(address)": "a6f9dae1",
"checkValidator(address)": "797327ae",
"newOwner()": "d4ee1d90",
"owner()": "8da5cb5b",
"toggleToken(address)": "15c75f89",
"toggleValidator(address)": "1124e56f",
"validators(address)": "fa52c7d8"
},
"abiDefinition": [
{
"constant": false,
"inputs": [
{
"name": "_address",
"type": "address"
}
],
"name": "toggleValidator",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0x1124e56f"
},
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
}
],
"name": "toggleToken",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0x15c75f89"
},
{
"constant": true,
"inputs": [
{
"name": "_address",
"type": "address"
}
],
"name": "checkValidator",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0x797327ae"
},
{
"constant": false,
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0x79ba5097"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0x8da5cb5b"
},
{
"constant": false,
"inputs": [
{
"name": "_newOwner",
"type": "address"
}
],
"name": "changeOwner",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0xa6f9dae1"
},
{
"constant": true,
"inputs": [],
"name": "newOwner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0xd4ee1d90"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "allowedTokens",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0xe744092e"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "validators",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0xfa52c7d8"
}
],
"filename": "plasma/ValidatorManagerContract.sol",
"gas": 339885,
"gasPrice": null,
"type": "file",
"deploy": true,
"_gasLimit": false,
"error": false,
"realArgs": [],
"deployedAddress": "0xd8a512EBD6fd82f44dFFD968EEB0835265497d20",
"transactionHash": "0x70ecb5640e9213d33aad45720e7632f09017bbebd1ffef2ee6403bb12bcb5167"
}

View File

@ -0,0 +1,26 @@
{
"name": "plasma_service",
"version": "0.0.1",
"description": "",
"main": "main.js",
"scripts": {
"start": "nodemon src/main.js --exec babel-node",
"build": "babel src -d dist",
"serve": "node dist/main.js",
"test": "mocha --require babel-core/register"
},
"author": "",
"license": "MIT",
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.3"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.26.0",
"mocha": "^5.2.0",
"nodemon": "^1.18.3"
}
}

View File

@ -0,0 +1,18 @@
import express from 'express';
import bodyParser from 'body-parser';
const router = express.Router();
router.use(bodyParser.urlencoded({ extended: true }));
router.get('/', (req, res) => {
res.status(200).send({ 'test': true});
})
const app = express();
const port = process.env.PORT || 3000;
app.use('/', router);
const server = app.listen(port, () => {
console.log('Server listening on port ' + port);
});

View File

@ -0,0 +1,13 @@
import http from 'http';
import assert from 'assert';
import '../src/main.js';
describe('Test', () => {
it('should return 200', done => {
http.get('http://127.0.0.1:3000', res => {
assert.equal(200, res.statusCode);
done();
});
});
});