Skip to content

Instantly share code, notes, and snippets.

View ernestognw's full-sized avatar
👨‍💻

Ernesto García ernestognw

👨‍💻
View GitHub Profile
pragma solidity ^0.5.1;
contract Votacion {
mapping (bytes32 => datosDelCantidato) public candidatos; // mapping de nombres de candidato a datos de candidato
struct datosDelCantidato {
uint votos; // Conteo de votos
bool valid; // Para saber si es valido
}
pragma solidity ^0.5.0;
// Este contrato garantiza propiedad sobre un contrato
// Puede ser reemplazado con el de open zeppelin
// https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
contract Owned{
address owner;
constructor() public {
owner = msg.sender;
/* ETH price fetcher
This smart contract keeps tracking
of ETH price in USD
*/
pragma solidity ^0.4.24;
import "github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol";
pragma solidity ^0.5.9;
contract Voting {
struct voter {
address voterAddress;
uint tokensBought;
uint[] tokensUsedPerCandidate;
}
<!DOCTYPE html>
<html>
<head>
<title>Votaciones con token</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
</head>
<body>
.col-margin-bottom-1 {
margin-bottom: 1em;
}
a {
cursor: pointer;
}
.navbar.main {
background: #5f6d7f;
// Import the page's CSS. Webpack will know what to do with it.
// import "../styles/app.css";
// Import libraries we need.
import { default as Web3 } from "web3";
import { default as contract } from "truffle-contract";
import voting_artifacts from "../../build/contracts/Voting.json";
let Voting = contract(voting_artifacts);
@ernestognw
ernestognw / ERC1400Standard.sol
Created July 5, 2019 18:16
ERC1400Standard.sol
pragma solidity ^0.4.24;
import "https://gist.githubusercontent.com/MauPIslas/8f6fa6d7babfc3b5ed9fe494899178b6/raw/1f877d680277ba656ac8fcb9110b9fb135a21072/ERC1400Operator.sol";
import "https://raw.githubusercontent.com/SecurityTokenStandard/EIP-Spec/master/contracts/ERC1410/IERC1410.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/escrow-exploration/contracts/ownership/Ownable.sol";
contract ERC1410Standard is IERC1410, ERC1410Operator, Ownable {
/// @notice Increases totalSupply and the corresponding amount of the specified owners partition
/// @param _partition The partition to allocate the increase in balance
Verifying my Blockstack ID is secured with the address 1BHc2RKXsSUR1JASVpQEwkP7fqsnegpdUW https://explorer.blockstack.org/address/1BHc2RKXsSUR1JASVpQEwkP7fqsnegpdUW
// icpScore
// Ernesto García A00820783
// Created at Mon Sep 2 18:00:11 CDT 2019
#include<iostream>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<string>
using namespace std;