Skip to content

Instantly share code, notes, and snippets.

View hbarcelos's full-sized avatar
🕶️
I know how to exit Vim :v

Henrique Barcelos hbarcelos

🕶️
I know how to exit Vim :v
View GitHub Profile
@hbarcelos
hbarcelos / parameter-passing-c-vs-solidity-complete-guide.md
Created August 28, 2025 00:31
Parameter Passing: C vs Solidity Complete Guide

Parameter Passing: C vs Solidity Complete Guide

Core Concepts

Parameter Passing Mechanisms

  • Pass by Value/Copy: A copy of the value is made and passed to the function. Changes inside the function don't affect the original variable.
  • Pass by Reference: The function receives a reference (alias) to the original variable. Changes directly modify the original.

Traditional Languages: C

@hbarcelos
hbarcelos / .deps...remix-tests...remix_accounts.sol
Created August 27, 2025 23:22
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.8.30+commit.73712a01.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library TestsAccounts {
function getAccount(uint index) pure public returns (address) {
address[15] memory accounts;
accounts[0] = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
accounts[1] = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;
#!/bin/env bash
set -euo pipefail
[ -z "$1" ] && {
cat <<USAGE
Usage:
$0 <ilk> [--estimate]
USAGE
@hbarcelos
hbarcelos / RwaLiquidationOracle2.sol
Last active March 22, 2022 20:07
RwaLiquidationOracle2 and RwaUrn2
// Copyright (C) 2020, 2021 Lev Livnev <[email protected]>
// Copyright (C) 2022 Dai Foundation
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@hbarcelos
hbarcelos / LightCurate_Brainstorming.md
Last active October 4, 2021 18:48
LightCurate Brainstorming

Current:

struct Item {
  Status status; // The current status of the item.
  Request[] requests; // List of status change requests made for the item in the form requests[requestID].
}

struct Request {
   bool disputed; // True if a dispute was raised.
@hbarcelos
hbarcelos / Constants.sol
Created June 24, 2021 18:44
Solidity Constants Initialization
pragma solidity ^0.8.0;
contract Contants {
uint256 public constant A = 10;
uint256 public constant B = 20;
uint256 public constant C = B/A;
}
@hbarcelos
hbarcelos / README.md
Created March 23, 2021 16:42
IPFS Cluster Example with IPFS Proxy Enabled

This example is adapted from the docker-compose file on IPFS Cluster repo.

It enables the usage of the IPFS Proxy API for clusters.

This API automatically pins content to all nodes in the cluster when /add is called.

@hbarcelos
hbarcelos / RealitioHomeArbitrationProxy.sol
Created October 22, 2020 15:15
Realitio Home Arbitration Proxy (fixed)
// File: src/dependencies/IAMB.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.2;
interface IAMB {
function requireToPassMessage(
address _contract,
bytes memory _data,
uint256 _gas
@hbarcelos
hbarcelos / keybase.md
Created October 19, 2020 20:37
Keybase Proof

Keybase proof

I hereby claim:

  • I am hbarcelos on github.
  • I am hbarcelos (https://keybase.io/hbarcelos) on keybase.
  • I have a public key ASDXXwdVi-W2TfqEWMFIO6V7uEdAvwN1B_bGUG1bk1jj-Qo

To claim this, I am signing this object:

@hbarcelos
hbarcelos / RealitioHomeArbitrationProxy.sol
Created October 15, 2020 14:32
Cross-chain Realitio Arbitration
// SPDX-License-Identifier: MIT
// File: src/dependencies/IAMB.sol
pragma solidity ^0.7.2;
interface IAMB {
function requireToPassMessage(
address _contract,
bytes memory _data,
uint256 _gas
) external returns (bytes32);