Skip to content

Instantly share code, notes, and snippets.

Avatar

Leonardo Marciano leonardomarciano

View GitHub Profile
View sudo-example.json
[
{
"id":1,
"hash":"5ba92bd1032f6721f7055e8d",
"birthdate":"1999-08-05T03:00:00.000Z",
"Wallet":[
{
"id":1,
"address":"15rKHfPAXmzKV9YnqeJUpwvtnQkFk4xN6K",
"hash":"5D68217D0C3DDFC029F1F8F2E61A80A8256342F27893FF0FE55DA861E75325D6F7C805A26CAE587F01AEE7980700E8F06422C233A0E2A8E9BF26AAD0C39E00C6",
View coin.js
...
class creDE{
static send(value, to) {
...
}
static receive() {
...
}
}
View ListeningTruffle.js
const Web3 = require('web3') // Web3 0.20.4 or web3 1 beta
const truffleContract = require("truffle-contract")
const contractArtifact = require('./build/contracts/TutorialToken.json')
const providerUrl = 'http://localhost:8545'
const provider = new Web3.providers.HttpProvider(providerUrl)
const contract = truffleContract(contractArtifact)
contract.setProvider(provider)
View MyContract.js
contract MyContract {
event Transfer(address indexed from, address indexed to, uint256 value); /* Isso é um evento */
function MyContract() {} /* constructor */
function transfer(address _to) public {
Transfer(msg.sender, _to, msg.value);
}
}