Skip to content

Commit 23ad442

Browse files
contract
1 parent fb6e7b8 commit 23ad442

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

build_contract.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
const inputFileName = './contracts/contracts/Abab.sol';
1414
const pragma = '^0.4.11';
15+
const ContractName = 'Abab';
1516
const account_address = '0xa1b1d9551211755165a677c5e9d4b1041f4b5fd6';
1617
const account_private = 'df03891cdfb422bf856717211fb09733962e8feff9e7284e1304e1b1f2d55082';
1718

@@ -27,6 +28,7 @@ const Tx = require('ethereumjs-tx');
2728

2829
const fs = require('fs');
2930
const path = require('path');
31+
const shelljs = require('shelljs');
3032
var solc = require('solc');
3133
var argv = require('minimist')(process.argv.slice(2));
3234
const importFile = [];
@@ -110,7 +112,7 @@ function deploy(source, cb) {
110112
console.log('Tx check.');
111113
return false;
112114
}
113-
cb && cb(txData, output.contracts[':Abab'].interface, output.contracts[':Abab'].bytecode,source, solcSnapshot.version());
115+
cb && cb(txData, output.contracts[':Abab'].interface, output.contracts[':Abab'].bytecode, source, solcSnapshot.version());
114116
clearInterval(checkTx);
115117

116118

@@ -119,19 +121,20 @@ function deploy(source, cb) {
119121
});
120122
});
121123
}
122-
deploy(source, function (tx, _interface, _bytecode, source,solc_version) {
124+
deploy(source, function (tx, _interface, _bytecode, source, solc_version) {
123125
console.log('Updating config.sol.js and source.sol ....');
124126
fs.writeFileSync("./source.sol", source);
125127
fs.writeFileSync("./config.sol.js", 'const _address = "' + tx.contractAddress + '"; // smart contract address\n' +
126128
'const _contract_fixed = 100000000;\n' +
127-
'const _name = "Abab";\n' +
129+
'const _name = "' + ContractName + '";\n' +
128130
'const _symbol = "ABC";\n' +
129131
'const _abi = ' + _interface + ';\n' +
130132
'const _bytecode = "' + _bytecode + '";\n' +
131133
'const _version = "' + solc_version + '";\n' +
132134
'module.exports = {_address: _address,_contract_fixed: _contract_fixed,_name: _name,_symbol: _symbol,_abi: _abi,_bytecode:_bytecode,_version:_version};');
133135
console.log('Deploy Contract Success:\n\tAddress: ' + tx.contractAddress + '\n\tBlockHash: ' + tx.blockHash + '\n\tblockNumber: ' + tx.blockNumber);
134136
console.log('== END ==');
137+
135138
process.exit(0);
136139
});
137140
// console.log(output.contracts[':Abab'].bytecode);

config.sol.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/src/js/ABAB.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,18 @@ function initMap() {
242242

243243
}
244244
var ABAB = {
245-
245+
map:{
246+
init:false,
247+
cb_function_arr: [],
248+
call_wait_auth: function (fn) {
249+
if (!ABAB.map.init) {
250+
ABAB.map.cb_function_arr.push(fn);
251+
} else {
252+
fn();
253+
}
254+
},
255+
fn:function(){}
256+
},
246257
event: {},
247258
page: null,
248259
pageObj: {

0 commit comments

Comments
 (0)