Skip to content

Commit

Permalink
Round Tripping Claim in Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Arie Trouw committed Aug 30, 2018
1 parent e894477 commit ec27514
Show file tree
Hide file tree
Showing 14 changed files with 3,652 additions and 2,307 deletions.
25 changes: 25 additions & 0 deletions .eslintrc
@@ -0,0 +1,25 @@
{
"extends": ["airbnb", "standard", "standard-react"],
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true
},
"rules": {
"func-names": 0,
"quotes": [2, "backtick"],
"no-plusplus": 0,
"class-methods-use-this": 0,
"prefer-destructuring": 0,
"max-len": 0,
"no-console": 0
},
"globals": {
"artifacts": true,
"contract": true,
"assert": true,
"web3": true
}
}
2 changes: 1 addition & 1 deletion build/contracts/ERC20.json
Expand Up @@ -1233,5 +1233,5 @@
},
"networks": {},
"schemaVersion": "2.0.1",
"updatedAt": "2018-08-28T21:16:07.937Z"
"updatedAt": "2018-08-30T20:15:47.159Z"
}
2 changes: 1 addition & 1 deletion build/contracts/ERC20Basic.json
Expand Up @@ -862,5 +862,5 @@
},
"networks": {},
"schemaVersion": "2.0.1",
"updatedAt": "2018-08-28T21:16:07.936Z"
"updatedAt": "2018-08-30T20:15:47.158Z"
}
2 changes: 1 addition & 1 deletion build/contracts/Migrations.json
Expand Up @@ -1383,5 +1383,5 @@
}
},
"schemaVersion": "2.0.1",
"updatedAt": "2018-08-28T21:16:08.280Z"
"updatedAt": "2018-08-30T20:18:06.890Z"
}
34 changes: 17 additions & 17 deletions build/contracts/Ownable.json
Expand Up @@ -288,7 +288,7 @@
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 862,
"referencedDeclaration": 873,
"src": "575:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
Expand Down Expand Up @@ -377,7 +377,7 @@
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 862,
"referencedDeclaration": 873,
"src": "705:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
Expand Down Expand Up @@ -431,10 +431,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
865,
866
876,
877
],
"referencedDeclaration": 865,
"referencedDeclaration": 876,
"src": "697:7:2",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
Expand Down Expand Up @@ -923,10 +923,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
865,
866
876,
877
],
"referencedDeclaration": 865,
"referencedDeclaration": 876,
"src": "1574:7:2",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
Expand Down Expand Up @@ -1339,7 +1339,7 @@
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 862,
"referencedDeclaration": 873,
"src": "575:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
Expand Down Expand Up @@ -1428,7 +1428,7 @@
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 862,
"referencedDeclaration": 873,
"src": "705:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
Expand Down Expand Up @@ -1482,10 +1482,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
865,
866
876,
877
],
"referencedDeclaration": 865,
"referencedDeclaration": 876,
"src": "697:7:2",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
Expand Down Expand Up @@ -1974,10 +1974,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
865,
866
876,
877
],
"referencedDeclaration": 865,
"referencedDeclaration": 876,
"src": "1574:7:2",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
Expand Down Expand Up @@ -2188,5 +2188,5 @@
},
"networks": {},
"schemaVersion": "2.0.1",
"updatedAt": "2018-08-28T21:16:07.939Z"
"updatedAt": "2018-08-30T20:15:47.161Z"
}
2 changes: 1 addition & 1 deletion build/contracts/StandardToken.json
Expand Up @@ -6786,5 +6786,5 @@
}
},
"schemaVersion": "2.0.1",
"updatedAt": "2018-08-28T21:16:08.283Z"
"updatedAt": "2018-08-30T20:18:06.893Z"
}
18 changes: 9 additions & 9 deletions build/contracts/XyoNodeMapping.json
Expand Up @@ -500,10 +500,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
865,
866
876,
877
],
"referencedDeclaration": 865,
"referencedDeclaration": 876,
"src": "356:7:3",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
Expand Down Expand Up @@ -1263,7 +1263,7 @@
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 862,
"referencedDeclaration": 873,
"src": "697:3:3",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
Expand Down Expand Up @@ -3067,10 +3067,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
865,
866
876,
877
],
"referencedDeclaration": 865,
"referencedDeclaration": 876,
"src": "356:7:3",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
Expand Down Expand Up @@ -3830,7 +3830,7 @@
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 862,
"referencedDeclaration": 873,
"src": "697:3:3",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
Expand Down Expand Up @@ -5274,5 +5274,5 @@
},
"networks": {},
"schemaVersion": "2.0.1",
"updatedAt": "2018-08-28T21:16:07.946Z"
"updatedAt": "2018-08-30T20:15:47.164Z"
}
4,209 changes: 2,253 additions & 1,956 deletions build/contracts/XyoStaked.json

Large diffs are not rendered by default.

495 changes: 256 additions & 239 deletions build/contracts/XyoStakedConsensus.json

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions contracts/XyoStaked.sol
Expand Up @@ -17,6 +17,11 @@ contract XyoStaked is Ownable, XyoNodeMapping {
uint time;
}

event Claim (
address owner,
address node
);

mapping(address => address) public nodeOwners; //Lists the owners of the ndoes

Request[] public stakeRequests; //List of Stake Requests
Expand Down Expand Up @@ -55,9 +60,11 @@ contract XyoStaked is Ownable, XyoNodeMapping {
)
public
{
bytes32 hashValue = sha256(abi.encodePacked(msg.sender, node));
bytes32 hashValue = keccak256(abi.encodePacked(msg.sender, node));

address realAddress = ecrecover(hashValue, v, r, s);
require (realAddress == msg.sender);
emit Claim(msg.sender, node);
require (realAddress == node);
nodeOwners[node] = msg.sender;
}

Expand Down
10 changes: 5 additions & 5 deletions migrations/2_deploy_contracts.js
@@ -1,8 +1,8 @@
const StandardToken = artifacts.require('StandardToken.sol')
const XyoStaked = artifacts.require('XyoStaked.sol')
const StandardToken = artifacts.require('StandardToken.sol');
const XyoStaked = artifacts.require('XyoStaked.sol');

module.exports = function _(deployer, network, [owner1]) {
return deployer.deploy(StandardToken, { from: owner1 }).then((token) => {
deployer.deploy(XyoStaked, token, 10000, { from: owner1 })
})
}
deployer.deploy(XyoStaked, token, 10000, { from: owner1 });
});
};
17 changes: 15 additions & 2 deletions package.json
Expand Up @@ -17,6 +17,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"babel-eslint": "^8.2.2",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
Expand All @@ -25,9 +26,21 @@
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-bignumber": "^2.0.2",
"elliptic": "^6.4.1",
"eslint": "^5.4.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-standard": "^11.0.0",
"eslint-config-standard-react": "^6.0.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-react": "^7.11.0",
"ganache-cli": "^6.1.0",
"js-sha3": "^0.8.0",
"openzeppelin-solidity": "^1.11.0",
"truffle-hdwallet-provider": "^0.0.5",
"truffle": "^4.1.3",
"ganache-cli": "^6.1.0"
"truffle-hdwallet-provider": "^0.0.5"
}
}

0 comments on commit ec27514

Please sign in to comment.