Skip to content

Instantly share code, notes, and snippets.

View rpaskin's full-sized avatar

Ronnie Paskin rpaskin

  • Rio de Janeiro, Brazil
  • 20:39 (UTC -03:00)
  • LinkedIn in/rpaskin
View GitHub Profile
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// @title Contrato para votar no melhor sanduíche
contract Votoiche {
// quem votou em qual grupo
mapping(address => uint8) public voto;
// número de votos de cada grupo
mapping(uint8 => uint) public numeroDeVotos;
@rpaskin
rpaskin / Web3...dCoin.sol
Last active July 29, 2022 18:45
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.5.17+commit.d19bba13.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
// dCoin - contract @ 0x9824eB5D5FfA57b0F7C4EC8cF73cE07adB2c7812
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
//
// ----------------------------------------------------------------------------
contract ERC20Interface {
@rpaskin
rpaskin / BaseExtra.sol
Last active March 16, 2022 17:46
Solidity contract call contract
/// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// Adapted from https://ethereum.stackexchange.com/questions/45277/calling-one-contract-to-another-contract-method
contract Base {
uint public dataA;
bytes4 public dataB;
pragma solidity 0.6.6;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract SimpleCollectible is ERC721 {
uint256 public tokenCounter;
constructor () public ERC721 ("Dogie", "DOG"){
tokenCounter = 0;
}
function createCollectible(string memory tokenURI) public returns (uint256) {
uint256 newItemId = tokenCounter;
_safeMint(msg.sender, newItemId);
@rpaskin
rpaskin / Pizza.sol
Last active October 29, 2021 12:54
Exercicio de criar um contrato de venda de pizza em solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Pizzaria {
uint public precoDaPizza = 1 ether;
address payable public comprador;
address payable public donoDaPizzaria;
constructor() {
@rpaskin
rpaskin / settings.py
Created September 10, 2021 14:16
Settings.py for adding a /static/ path
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
DIR_STATIC = 'static'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, DIR_STATIC),
'/var/www/static/',
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract StoreWeather {
enum Weather { sunny, cloudy, rainy, snow }
address public owner = msg.sender;
Weather currentWeather;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract Strings {
string myString;
function store(string memory _entrada) public {
myString = _entrada;
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.7.0;
contract JurosOracle {
mapping (uint => uint) jurosNaData;
address public owner;
constructor() {
owner = msg.sender;
}
@rpaskin
rpaskin / SimpleStorage.sol
Last active June 30, 2021 21:04
Solidity base example from the documentation
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {