Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #242 from gnosis/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
giacomolicari authored Apr 1, 2019
2 parents ca98135 + 9c91a72 commit 1b22b17
Show file tree
Hide file tree
Showing 159 changed files with 150,562 additions and 6,196 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ dapp/localhost.key

# Travis
.travis/deploy_key

# built package.json
dapp/src/package.json
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ deploy:
access_key_id:
secure: BDEFvOIGXS59CL3DzPDZ3q2AkkRdFzwgiGoyou2KEE1Kv3D7TxxTKM8cvuFSHlvGls8qronN7zgB8Zt5wEXJS6+mBotb6T8W3c5xWKyrPooTdwMsvTwtXbUiJeU6Kp6YJCkKUHDYo2XPFDGuYQXK4GBImaMsS2bTcBwM14K7oD6pTzLDERU8Ll+/1u3HtboJOy688+hWs+P2K4xUO+W+3KXGI1MNapg9QcqyzgPCByBny/uvhzc262xbpe6U/QOKEKjmZQb7mpgidrPNGk3MesepAlGg/WoM8ufmbOFBqI/gWHknOY+26oRkdzP3NHhQXHXqSZTvcEFtlGNonSCc50o8p3NoMbR673cbgbecJ0OrP6ZzAcll7SGWa5JQqpA+6Ep82jEExTWjTOUK2aQYaRgPkahVNuwmqpoXt4tvnnlIETt10O9P7Un1dmBxJn6TxIroZW+9suhbzs5UmzjB+wJU2io2/FTxNHzgGj9cRQ3FG2regirneJ4SFImf8+ZJymdc86qUE1/3fXzt3f0c3MZhm3C8ZTXEcZJuqpCNu04nxapch6G0I4NlyziTh+1ezUa6+yZs8P/NRnKcHiU+7j7AV0ewJyK92QY7dfr+LjnqYw8q9GBj1djgf0i7FVzyAAuGL52MXrnWAn3Jfypg6Zsu8nVdeToowpJTQ60m0kA=
skip_cleanup: true
local_dir: dapp
local_dir: dapp/src
on:
branch: develop
condition: $DIST = web
Expand All @@ -47,7 +47,7 @@ deploy:
access_key_id:
secure: BDEFvOIGXS59CL3DzPDZ3q2AkkRdFzwgiGoyou2KEE1Kv3D7TxxTKM8cvuFSHlvGls8qronN7zgB8Zt5wEXJS6+mBotb6T8W3c5xWKyrPooTdwMsvTwtXbUiJeU6Kp6YJCkKUHDYo2XPFDGuYQXK4GBImaMsS2bTcBwM14K7oD6pTzLDERU8Ll+/1u3HtboJOy688+hWs+P2K4xUO+W+3KXGI1MNapg9QcqyzgPCByBny/uvhzc262xbpe6U/QOKEKjmZQb7mpgidrPNGk3MesepAlGg/WoM8ufmbOFBqI/gWHknOY+26oRkdzP3NHhQXHXqSZTvcEFtlGNonSCc50o8p3NoMbR673cbgbecJ0OrP6ZzAcll7SGWa5JQqpA+6Ep82jEExTWjTOUK2aQYaRgPkahVNuwmqpoXt4tvnnlIETt10O9P7Un1dmBxJn6TxIroZW+9suhbzs5UmzjB+wJU2io2/FTxNHzgGj9cRQ3FG2regirneJ4SFImf8+ZJymdc86qUE1/3fXzt3f0c3MZhm3C8ZTXEcZJuqpCNu04nxapch6G0I4NlyziTh+1ezUa6+yZs8P/NRnKcHiU+7j7AV0ewJyK92QY7dfr+LjnqYw8q9GBj1djgf0i7FVzyAAuGL52MXrnWAn3Jfypg6Zsu8nVdeToowpJTQ60m0kA=
skip_cleanup: true
local_dir: dapp
local_dir: dapp/src
on:
branch: master
condition: $DIST = web
Expand Down
2 changes: 1 addition & 1 deletion contracts/MultiSigWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ contract MultiSigWallet {

// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
Expand Down
2 changes: 1 addition & 1 deletion contracts/MultiSigWalletWithDailyLimit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
Expand Down
151 changes: 146 additions & 5 deletions dapp/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function(grunt) {
'dev': {

// the server root directory
root: './',
root: './src',

// the server port
// can also be written as a function, e.g.
Expand Down Expand Up @@ -82,21 +82,21 @@ module.exports = function(grunt) {
},
ngtemplates: {
multiSigWeb: {
src: ['partials/**.html', 'partials/modals/**.html'],
dest: 'partials.js'
src: ['src/partials/**.html', 'src/partials/modals/**.html'],
dest: 'src/partials.js'
}
},
watch: {
scripts: {
files: ['partials/*.html', 'partials/modals/*.html'],
files: ['src/partials/*.html', 'src/partials/modals/*.html'],
tasks: ['ngtemplates'],
options: {
livereload: true,
}
}
},
eslint: {
target: ['Gruntfile.js', 'controllers/**.js', 'services/**.js', '**.js']
target: ['Gruntfile.js', 'src/controllers/**.js', 'src/services/**.js', '**.js']
},
'npm-command': {
certs: {
Expand All @@ -123,4 +123,145 @@ module.exports = function(grunt) {

grunt.registerTask('default', ['ngtemplates', 'http-server']);
grunt.registerTask('ledger', ['ssl-cert', 'ngtemplates', 'http-server:ssl']);
grunt.registerTask('bundle', '', function () {
// Command: `npx grunt bundle` or `npx grunt bundle --mode=electron`
const fs = require('fs');
const path = require('path')
const Terser = require("terser");

const MODE_WEB = 'web';
const appMode = grunt.option('mode') || 'web';
const minify = grunt.option('minify') ? grunt.option('minify') : false;
console.log(`Running in ${appMode} mode`);

const jsBundlePath = path.resolve(__dirname, 'src/bundles/js/bundle.js');
const jsStandaloneDirPath = path.resolve(__dirname, 'src/bundles/js');
const cssBundlePath = path.resolve(__dirname, 'src/bundles/css/bundle.css');
const fontsStandaloneDirPath = path.resolve(__dirname, 'src/bundles/fonts');

const modules = [
'node_modules/web3/dist/web3.min.js',
'node_modules/web3-provider-engine/dist/HookedWalletSubprovider.js',
'node_modules/web3-provider-engine/dist/RpcSubprovider.js',
'node_modules/web3-provider-engine/dist/ProviderEngine.js',
'node_modules/browser-builds/dist/ethereumjs-tx/ethereumjs-tx-1.3.3.min.js',
'node_modules/angular/angular.min.js',
'node_modules/angular-animate/angular-animate.min.js',
'node_modules/jquery/dist/jquery.min.js',
'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/angular-route/angular-route.min.js',
'node_modules/angular-touch/angular-touch.min.js',
'node_modules/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js',
'node_modules/moment/min/moment-with-locales.min.js',
'node_modules/abi-decoder/dist/abi-decoder.js',
'node_modules/clipboard/dist/clipboard.min.js',
'node_modules/ngclipboard/dist/ngclipboard.min.js',
'node_modules/angular-ui-notification/dist/angular-ui-notification.min.js',
'src/trezor-connect-v4.js'
];

const webOnlyModules = [
'node_modules/ledger-wallet-provider/dist/ledgerwallet.js'
];

const standaloneLibs = [
{
'name': 'jquery.min.js',
'path': 'node_modules/jquery/dist/jquery.min.js'
}
];

const css = [
'css/app.css',
'css/gnosis-bootstrap.css',
'css/gnosis-bootstrap-dialog.css',
'node_modules/font-awesome/css/font-awesome.min.css',
'node_modules/spinkit/css/spinkit.css',
'node_modules/angular-ui-notification/dist/angular-ui-notification.css'
];

const standaloneFonts = [
{
'name': 'fontawesome-webfont.woff2',
'path': 'node_modules/font-awesome/fonts/fontawesome-webfont.woff2',
}
];

try {
// Remove file if it exists
fs.unlinkSync(jsBundlePath);
} catch (error) {
//console.error(error);
}
try {
fs.unlinkSync(cssBundlePath);
} catch (error) {
//console.error(error);
}

let jsBundleFileContent = '';
let moduleContent;
for (let x in modules) {
console.log("Packaging " + modules[x]);
moduleContent = fs.readFileSync(modules[x], 'utf8');
jsBundleFileContent += '\n';
jsBundleFileContent += moduleContent;
}

if (appMode == MODE_WEB) {
moduleContent = '';
for (let x in webOnlyModules) {
console.log("Packaging " + webOnlyModules[x]);
moduleContent = fs.readFileSync(webOnlyModules[x], 'utf8');
jsBundleFileContent += '\n';
jsBundleFileContent += moduleContent;
}
}

// Update file
if (minify) {
console.log('Start minifying JS...');
jsBundleFileContent = Terser.minify(jsBundleFileContent); // Minify JS
if (jsBundleFileContent.error) {
console.error('There have been some errores while minifying', jsBundleFileContent.error);
} else {
fs.writeFileSync(jsBundlePath, jsBundleFileContent.code, 'utf8');
}
} else {
fs.writeFileSync(jsBundlePath, jsBundleFileContent, 'utf8');
}

// Standalone libs
let standaloneModuleContent;
let jsStandaloneFileContent;
for (let x in standaloneLibs) {
console.log("Packaging " + standaloneLibs[x].name);
standaloneModuleContent = fs.readFileSync(standaloneLibs[x].path, 'utf8');
jsStandaloneFileContent = ''; // clear file content
jsStandaloneFileContent += '\n';
jsStandaloneFileContent += standaloneModuleContent;
fs.writeFileSync(jsStandaloneDirPath + '/' + standaloneLibs[x].name, jsStandaloneFileContent, 'utf8');
}

// Package CSS
let cssBundleFileContent = '';
let cssContent;
for (let x in css) {
console.log("Packaging " + css[x]);
cssContent = fs.readFileSync(css[x], 'utf8');
cssBundleFileContent += '\n';
cssBundleFileContent += cssContent;
}
// Update file
fs.writeFileSync(cssBundlePath, cssBundleFileContent, 'utf8');

// Copy standalone Fonts
for (let x in standaloneFonts) {
console.log("Copying " + standaloneFonts[x].path + "into fonts/" + standaloneFonts[x].name);
// fs.copyFileSync(src, dest)
fs.copyFileSync(standaloneFonts[x].path, fontsStandaloneDirPath + '/' + standaloneFonts[x].name)
}

})
};
18 changes: 15 additions & 3 deletions dapp/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ Requirements
-------------
* Node v5+
* [Grunt-cli](http://gruntjs.com/getting-started#installing-the-cli)
* [bower](https://bower.io/#install-bower)

Install
-------------
```
npm install -g bower
npm install -g grunt-cli
npm install
bower install
grunt
```

Expand All @@ -24,3 +21,18 @@ Test
```
npm test
```

Build
-------------

Web version

```
npm run build-libs-web
```

Desktop version

```
npm run build-libs-electron
```
8 changes: 4 additions & 4 deletions dapp/config.karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ module.exports = function(config) {
'bower_components/web3-provider-engine/dist/ProviderEngine.js',
'bower_components/angular-ui-notification/dist/angular-ui-notification.js',
'node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js',
'app.js',
'abi.js',
'config.js',
'services/**/*.js',
'src/app.js',
'src/abi.js',
'src/config.js',
'src/services/**/*.js',
'tests/*.test*'
],

Expand Down
Loading

0 comments on commit 1b22b17

Please sign in to comment.