Skip to content

Commit 7692a76

Browse files
Import from crosslink challenge
0 parents  commit 7692a76

File tree

195 files changed

+21330
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+21330
-0
lines changed

.babelrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
"react",
4+
"es2015",
5+
"stage-2",
6+
"stage-3"
7+
],
8+
"plugins": ["syntax-async-functions"]
9+
}

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build
5+
build/
6+
build_webpack/
7+
8+
# Personal
9+
.todo
10+
scripts/testrpc_pid
11+
.idea/
12+
.DS_Store
13+
gamedata/deploy.development.json
14+
15+
# Private stuff
16+
.env
17+
18+
# Misc
19+
.tern-port

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language : node_js
2+
node_js:
3+
- "9"
4+
# script:
5+
#- if [ "$TRAVIS_BRANCH" == "master" ]; then
6+
# npm run deploy:ui;
7+
# fi

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Smart Contract Solutions, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included
14+
in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Ethernaut
2+
3+
<p>Cypherpunks CTF is a Web3/Solidity based wargame inspired in <a href="https://ethernaut.openzeppelin.com" target="_blank" rel="noopener noreferred">Ethernaut</a>, to be played in the Ethereum Virtual Machine. Each level is a smart contract that needs to be 'hacked'.</p>
4+
5+
*Level PR's are welcome!*
6+
7+
### Deploy
8+
9+
1. Install all the dependencies
10+
```
11+
git clone https://github.com/StillFantastic/Crosslink-Ethernaut.git
12+
npm install
13+
```
14+
2. Compile contracts and get static frontend files
15+
```
16+
npm run deploy:ui
17+
```
18+
19+
### Coontributing
20+
See `contributing.md` on the repository for information about how to contribute.
21+
22+
#### Example level development
23+
24+
Let's suppose that we are creating a level.
25+
26+
1. Fork this repo, clone and npm install.
27+
2. Implement the desired instance and factory logic in solidity. See current levels and notes to understand how the game mechanics work.
28+
3. Register the level in gamedata/gamedata.json.
29+
4. Deploy `cypherpunks.sol` by yourself, then replace the address of `cypherpunks` in gamedata/deploy.ropsten.json
30+
5. Deploy your factory contract and Register your factory contract in `cypherpunks.sol`
31+
6. Start running application by `npm run start`
32+
7. Add a description markdown file in gamedata/levels/ (make sure gamedata.json points to it). This content will now be displayed in the ui for the level.
33+
8. Verify that the level is playable and winnable via UI. It is common for levels to be beatable in some way in tests that doesn't work using the UI, so it is important to test it manually as well.
34+
9. Add a completed description markdown file, in gamedata/levels/ (make sure gamedata.json points to it). The level will display this as additional info once the level is solved, usually to include historical information related to the level.
35+
10. Make a PR request so that we can re-deploy the game with the new level!

config/env.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
2+
// injected into the application via DefinePlugin in Webpack configuration.
3+
4+
var REACT_APP = /^REACT_APP_/i;
5+
6+
function getClientEnvironment(publicUrl) {
7+
var processEnv = Object
8+
.keys(process.env)
9+
.filter(key => REACT_APP.test(key))
10+
.reduce((env, key) => {
11+
env[key] = JSON.stringify(process.env[key]);
12+
return env;
13+
}, {
14+
// Useful for determining whether we’re running in production mode.
15+
// Most importantly, it switches React into the correct mode.
16+
'NODE_ENV': JSON.stringify(
17+
process.env.NODE_ENV || 'development'
18+
),
19+
// Useful for resolving the correct path to static assets in `public`.
20+
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
21+
// This should only be used as an escape hatch. Normally you would put
22+
// images into the `src` and `import` them in code to get their paths.
23+
'PUBLIC_URL': JSON.stringify(publicUrl)
24+
});
25+
return {'process.env': processEnv};
26+
}
27+
28+
module.exports = getClientEnvironment;

config/jest/cssTransform.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This is a custom Jest transformer turning style imports into empty objects.
2+
// http://facebook.github.io/jest/docs/tutorial-webpack.html
3+
4+
module.exports = {
5+
process() {
6+
return 'module.exports = {};';
7+
},
8+
getCacheKey(fileData, filename) {
9+
// The output is always the same.
10+
return 'cssTransform';
11+
},
12+
};

config/jest/fileTransform.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const path = require('path');
2+
3+
// This is a custom Jest transformer turning file imports into filenames.
4+
// http://facebook.github.io/jest/docs/tutorial-webpack.html
5+
6+
module.exports = {
7+
process(src, filename) {
8+
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
9+
},
10+
};

config/paths.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var path = require('path');
2+
var fs = require('fs');
3+
4+
// Make sure any symlinks in the project folder are resolved:
5+
// https://github.com/facebookincubator/create-react-app/issues/637
6+
var appDirectory = fs.realpathSync(process.cwd());
7+
function resolveApp(relativePath) {
8+
return path.resolve(appDirectory, relativePath);
9+
}
10+
11+
// We support resolving modules according to `NODE_PATH`.
12+
// This lets you use absolute paths in imports inside large monorepos:
13+
// https://github.com/facebookincubator/create-react-app/issues/253.
14+
15+
// It works similar to `NODE_PATH` in Node itself:
16+
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
17+
18+
// We will export `nodePaths` as an array of absolute paths.
19+
// It will then be used by Webpack configs.
20+
// Jest doesn’t need this because it already handles `NODE_PATH` out of the box.
21+
22+
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
23+
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
24+
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
25+
26+
var nodePaths = (process.env.NODE_PATH || '')
27+
.split(process.platform === 'win32' ? ';' : ':')
28+
.filter(Boolean)
29+
.filter(folder => !path.isAbsolute(folder))
30+
.map(resolveApp);
31+
32+
// config after eject: we're in ./config/
33+
module.exports = {
34+
// Changed from build to build_webpack so smart contract compilations are not overwritten.
35+
appBuild: resolveApp('build_webpack'),
36+
appPublic: resolveApp('public'),
37+
appHtml: resolveApp('public/index.html'),
38+
appIndexJs: resolveApp('src/index.js'),
39+
appPackageJson: resolveApp('package.json'),
40+
appSrc: resolveApp('src'),
41+
yarnLockFile: resolveApp('yarn.lock'),
42+
testsSetup: resolveApp('src/setupTests.js'),
43+
appNodeModules: resolveApp('node_modules'),
44+
ownNodeModules: resolveApp('node_modules'),
45+
nodePaths: nodePaths
46+
};

config/polyfills.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if (typeof Promise === 'undefined') {
2+
// Rejection tracking prevents a common issue where React gets into an
3+
// inconsistent state due to an error, but it gets swallowed by a Promise,
4+
// and the user has no idea what causes React's erratic future behavior.
5+
require('promise/lib/rejection-tracking').enable();
6+
window.Promise = require('promise/lib/es6-extensions.js');
7+
}
8+
9+
// fetch() polyfill for making API calls.
10+
require('whatwg-fetch');
11+
12+
// Object.assign() is commonly used with React.
13+
// It will use the native implementation if it's present and isn't buggy.
14+
Object.assign = require('object-assign');
15+
16+
require('babel-register');
17+
require('babel-polyfill');

0 commit comments

Comments
 (0)