Skip to content

Instantly share code, notes, and snippets.

@yrong
yrong / ECDSA.sol
Created December 13, 2022 17:58 — forked from BjornvdLaan/ECDSA.sol
Verification of externally created ECDSA signatures in Solidity
pragma solidity ^0.4.24;
contract ECDSA {
function verify() public returns (bool) {
bytes32 message = ethMessageHash("TEST");
bytes memory sig = hex"bceab59162da5e511fb9c37fda207d443d05e438e5c843c57b2d5628580ce9216ffa0335834d8bb63d86fb42a8dd4d18f41bc3a301546e2c47aa1041c3a1823701";
address addr = 0x999471bb43b9c9789050386f90c1ad63dca89106;
@yrong
yrong / launch.json
Created September 15, 2022 10:36 — forked from 0xGabi/launch.json
VSCode configuration to debug using hardhat in a monorepo
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "hardhat test",
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "${workspaceFolder}/packages/hardhat/node_modules/.bin/hardhat",
"args": ["test", "--network", "localhost"],
{
"solidity.packageDefaultDependenciesContractsDirectory": "",
"solidity.packageDefaultDependenciesDirectory": "scripts/evm/node_modules"
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'parallel'",
var InterfacePayroll = = artifacts.require("./InterfacePayroll");
var EmployeeStorage= = artifacts.require("./EmployeeStorage");
var Token= = artifacts.require("./Token");
var Payroll = = artifacts.require("./Payroll");
module.exports = function(deployer) {
deployer.deploy(InterfacePayroll );
deployer.deploy(EmployeeStorage);
deployer.deploy(Token);
deployer.link(InterfacePayroll ,Payroll );
deployer.link(EmployeeStorage,Payroll );
@yrong
yrong / tmux-cheatsheet.markdown
Created June 29, 2022 14:02 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
*
* Implementation of a diamond.
/******************************************************************************/
@yrong
yrong / gist:13afd20937e31430e95228604241ed70
Created June 17, 2022 06:11
add debug info to substrate node
https://github.com/paritytech/substrate/issues/11604#issuecomment-1150974582
@yrong
yrong / manual.rs
Created July 31, 2021 17:06
consensus-manual-seal
use std::sync::Arc;
use asgard_runtime::Header;
use polkadot_service::{FullBackend, LongestChain};
use sc_client_api::ExecutorProvider;
pub use sc_consensus_aura::{ImportQueueParams, StartAuraParams};
use sc_consensus_manual_seal::InstantSealParams;
use sc_consensus_slots::SlotProportion;
use sc_service::{error::Error as ServiceError, Configuration, PartialComponents, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker, TelemetryWorkerHandle};
@yrong
yrong / test_macro.rs
Created April 23, 2021 16:12
rust macro
#![feature(no_std)]
#![no_std]
#![feature(prelude_import)]
#![feature(print_internals)]
#![feature(fmt_internals)]
use std::prelude::v1::*;
#[macro_use]
extern crate std as std;
fn main() {
let fib = {