Skip to content

Instantly share code, notes, and snippets.

View mverzilli's full-sized avatar

Martin Verzilli mverzilli

View GitHub Profile
{
"id": "92cee3a25070d1793d4697a3252d7dc4",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.2",
"solcLongVersion": "0.8.2+commit.661d1103",
"input": {
"language": "Solidity",
"sources": {
"contracts/WithConst.sol": {
"content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract WithConst {\n uint256 public value;\n constructor(uint256 initialValue) {\n value = initialValue;\n }\n\n function greet() public returns(uint256) {\n return value;\n }\n}\n"
This file has been truncated, but you can view the full file.
{
"id": "d152393456c388db1a14d8a833bc35a9",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.2",
"solcLongVersion": "0.8.2+commit.661d1103",
"input": {
"language": "Solidity",
"sources": {
"contracts/VaultUUPS.sol": {
"content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Proxiable.sol\";\nimport \"./Vault.sol\";\n\ncontract VaultProxiable is Vault, Proxiable {\n function _beforeUpgrade(address newImplementation) internal virtual override onlyAdmin {\n }\n}\n\ncontract VaultProxiableV2 is VaultV2, Proxiable {\n function _beforeUpgrade(address newImplementation) internal virtual override onlyAdmin {\n }\n}\n\ncontract VaultProxiableV3 is VaultV3, Proxiable {\n function _beforeUpgrade(address newImplementation) internal virtual override onlyAdmin {\n }\n}"
@mverzilli
mverzilli / compile-artifact.json
Created August 19, 2022 09:16
compile-artifact
This file has been truncated, but you can view the full file.
{
"id": "1c0394f32c0868f623d0d7a071078ffb",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.2",
"solcLongVersion": "0.8.2+commit.661d1103",
"input": {
"language": "Solidity",
"sources": {
"contracts/Proxiable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary StorageSlot {\n struct AddressSlot { address value; }\n struct BooleanSlot { bool value; }\n struct Bytes32Slot { bytes32 value; }\n struct Uint256Slot { uint256 value; }\n\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } }\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } }\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } }\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } }\n\n // TODO: ad
@mverzilli
mverzilli / TimelockController.json
Created August 23, 2021 19:00
TimelockController ABI
[
{
"inputs": [
{
"internalType": "uint256",
"name": "minDelay",
"type": "uint256"
},
{
"internalType": "address[]",
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArlNte/eRXh5rFRFbKzqIb15Vir2gyyLCu1Lfq5oLGCNS4XFTN9zZTJLFg+g3iY4K5x7omKK/+D+fRvcHRT0T8/pt2zfHpmNV7qZDkwiJSBEyO2o/51/BM/4Pfd03jrYlt3MTwYL8s0BqFAztRJEhg3oqIbFZDYRTCjGelwQ4NCbGAjQPuXkZIF60LuyorH02BjNBwaWAJxcK9FDz9rF8aXM7L59AoZZNDpPJp8HjX6LtwrQvQoSQ7RcwrTCa6RR6JOPh8KraqhYkZLwa2Wo2AU3YESo+RdzMaUaEFy98NeVTpQbGI5lXVdrFjPj5RyT9iyLsm/zNn7nKpLFPL58eFQ== [email protected]
@mverzilli
mverzilli / interf.cr
Last active July 19, 2017 14:05
Using modules as interfaces in Crystal
module Foo
abstract def foo_sth
end
class SomeFoo
include Foo
end
class Bar
def initialize(@foo : Foo)
@mverzilli
mverzilli / how_we_build_crystal_the_executable.md
Last active April 9, 2017 15:34
How we build `crystal`, the executable

How we build crystal, the executable

Note: most of this article is simply an incomplete natural language narration of what Crystal's Makefile specifies. If you, like me, feel a bit intimidated by Make, you may find this article more welcoming than venturing into the code by yourself and figuring things out from scratch.

At the root level of crystal-lang/crystal there's a Makefile that triggers the build process. The default task in that Makefile is crystal. That task checks whether there's a .build/crystal executable. To build the executable, you first need its dependencies (DEPS) and the source code (SOURCES).

With the dependencies built and the list of source code files, we are ready to compile Crystal, by running a previous version of the compiler that sits at bin/crystal. The new compiler will be written to .build/crystal.

@mverzilli
mverzilli / gist:3112e642f5c2f9eb2d171cfeb75f09e3
Created January 9, 2017 15:33
Crystal case in types vs. values
def get()
if 2 > 1
{"String", {"foo" => "bar"}}
else
nil
end
end
x = get
case x; when {String, Hash}; p typeof(x); end
@mverzilli
mverzilli / piedoom.cr
Last active September 16, 2016 00:55
piedoom's problem
require "json"
class Blog
JSON.mapping({
name: {type: String},
likes: {type: Int32},
following: {type: Int32},
default_post_format: {type: String},
})
end
@mverzilli
mverzilli / circle.yml
Created June 15, 2016 14:35
CircleCI for Crystal Projects
# Include this file in your project's root folder to integrate with CircleCI.
# Replace 0.18.0 with the Crystal version you're using.
dependencies:
cache_directories:
- "crystal-0.18.0-1"
pre:
- if [[ ! -e crystal-0.18.0-1 ]]; then wget https://github.com/crystal-lang/crystal/releases/download/0.18.0/crystal-0.18.0-1-linux-x86_64.tar.gz && tar xvfz crystal-0.18.0-1-linux-x86_64.tar.gz; fi
test:
pre:
- crystal-0.18.0-1/bin/crystal deps