Skip to content

Instantly share code, notes, and snippets.

View viannaandreBR's full-sized avatar
🏠
Working from Office

Andre viannaandreBR

🏠
Working from Office
View GitHub Profile
@viannaandreBR
viannaandreBR / Array.sol
Created July 1, 2019 03:18
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract ArraySol {
address dono;
uint numeroSorteado;
uint contadorDeSorteios = 0;
uint [ ] numerosSorteados;
constructor (uint numeroInicial) public payable comCustoMinimo (1000) {
@viannaandreBR
viannaandreBR / Array.sol
Created July 1, 2019 03:19
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract ArraySol {
address dono;
uint numeroSorteado;
uint contadorDeSorteios = 0;
uint [ ] numerosSorteados;
constructor (uint numeroInicial) public payable comCustoMinimo (1000) {
const _deploy_contracts = require("../migrations/2_deploy_contracts")
var DappToken = artifacts.require('DappToken')
_deploy_contracts('DappToken', function(accounts)){
it('sets the total supply upon deployment', function(){
return DappToken deployed()
})
})
@viannaandreBR
viannaandreBR / DappToken.sol
Created July 30, 2020 05:58
Solidity Program win Constructor Method
pragma solidity >=0.4.2;
contract DappToken{
// Constructor
// Set the Total number of tokens
// Read the total number of tokens
uint256 public totalSupply;
constructor () public{
totalSupply = 1000000;
@viannaandreBR
viannaandreBR / DappToken.js
Last active July 30, 2020 06:15
Truffle Test
var DappToken = artifacts.require('DappToken.sol')
contract ('DappToken', function(accounts){
it('sets the total upon deployment', function(){
return DappToken.deployed().then(function(instance){
tokenInstance = instance;
return tokenInstance.totalSupply();
}).then(function(totalSupply) {
assert.equal(totalSupply.toNumber(), 9000000, 'sets the total supply to 1.000.000');
@viannaandreBR
viannaandreBR / DappToken.sol
Created July 30, 2020 06:36
constructor with _initialSupply
pragma solidity >=0.4.2;
contract DappToken{
// Constructor
// Set the Total number of tokens
// Read the total number of tokens
uint256 public totalSupply;
constructor (uint256 _initialSupply) public{
totalSupply = _initialSupply;
@viannaandreBR
viannaandreBR / DappToken.sol
Created July 30, 2020 07:04
Solidity BalanceOf
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.2;
contract DappToken{
// DappToken
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
@viannaandreBR
viannaandreBR / DappToken.sol
Created July 30, 2020 23:17
Resolution issue with event & emit
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;
contract DappToken{
event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
@viannaandreBR
viannaandreBR / general.sol
Created August 2, 2020 05:42 — forked from eCoinomic/general.sol
general.sol
pragma solidity >=0.4.22 <0.6.0;
// Current version:0.5.3+commit.10d17f24.Emscripten.clang
// Optinization: YES
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
@viannaandreBR
viannaandreBR / index.html
Created August 3, 2020 17:11
Index.html for ICO Sale Token ERC20 Blockchain Ethereum
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE-edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dapp Token ICO Sale - Title</title>
<!-- BootStrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">