Easy:
- syntax is like Javascript
Hard:
- learning all the types
- lack of Javascript-like arrays and objects
//Speed optimizations for Truffle deployment on public testnets / mainnet | |
/* | |
* Optimization 1: Don't use Truffle deploy system, as for each deployment we have an extra transaction | |
* for updating `Migrations.sol` | |
*/ | |
//Before | |
await deployer.deploy(MyContract); | |
const myContract = await MyContract.deployed(); |
Easy:
Hard:
pragma solidity ^0.5.0; | |
contract Split { | |
struct Proposal { | |
uint id; | |
string description; | |
uint voteYes; | |
uint voteNo; | |
uint initialTotalBalance; | |
bool _sealed; //sealed is a reserved keyword |
pragma solidity ^0.5.0; | |
contract Race { | |
struct Proposal { | |
uint id; | |
string description; | |
uint voteYes; | |
uint voteNo; | |
uint initialTotalBalance; | |
bool _sealed; //sealed is a reserved keyword |
pragma solidity ^0.5.0; | |
contract DAO { | |
struct Proposal { | |
uint id; | |
string description; | |
uint voteYes; | |
uint voteNo; | |
uint initialTotalBalance; | |
bool _sealed; //sealed is a reserved keyword |
pragma solidity ^0.5.0; | |
contract DAO { | |
struct Proposal { | |
uint id; | |
string description; | |
uint voteYes; | |
uint voteNo; | |
uint initialTotalBalance; | |
bool _sealed; //sealed is a reserved keyword |
const flatten = array => array.reduce((a, b) => { | |
if(Array.isArray(b)) { | |
return a.concat(flatten(b)) | |
} else { | |
return a.concat(b) | |
}}, []); | |
const inputArray = [[1,2,[3]],4] | |
const flattenedArray = flatten(inputArray) |
0x9359f2842dfB515c4Eb27A39955f0647875D58BC |