Skip to content

Instantly share code, notes, and snippets.

@Ramarti
Ramarti / ERC7201Helper.s.sol
Created April 12, 2024 14:25
ERC7201HelperScript
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import { Script } from "forge-std/Script.sol";
import { console2 } from "forge-std/console2.sol";
/// @title ERC7201 Helper Script
/// @author Raul Martinez (Story Protocol)
/// @notice This script logs the boilerplate code for ERC7201 storage location and getter function, to
/// help developers implement the ERC7201 interface in their contracts.
@Ramarti
Ramarti / EthixToken.json
Created June 7, 2021 14:01
ABI for StakedToken
{
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
@Ramarti
Ramarti / StakedToken.json
Created June 7, 2021 13:56
ABI for EthicHub base staked token
{
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
@Ramarti
Ramarti / prepareDataStruct.js
Last active October 22, 2020 10:33
EIP712 for DAI style permit()
async preparePermitDataStruct (holder, allowed) {
const netId = await this.web3.eth.net.getId()
let nonce = await this.stableTokenContract.methods.nonces(holder).call({
from: holder
})
const expiration = Math.floor(Date.now() / 1000) + 900000
const EIP712Domain = [
{
name: 'name',
type: 'string'
@Ramarti
Ramarti / MockStableCoin.json
Created December 3, 2019 12:02
MockStableCoin.json
{
"contractName": "MockStableCoin",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "chainId_",
"type": "uint256"
}
import axios from 'axios'
import VueAxios from 'vue-axios'
import Vue from 'vue'
Vue.use(VueAxios, axios)
Vue.axios.defaults.baseURL = process.env.VUE_APP_BASE_URL
Vue.axios.defaults.headers.common['Content-Type'] = 'application/json'
Vue.axios.defaults.headers.post['Content-Type'] = 'application/json'
Vue.axios.defaults.headers.put['Content-Type'] = 'application/json'
@Ramarti
Ramarti / docker_commands.txt
Last active November 21, 2018 12:17
Docker commands
# Restart one service
docker-compose -f local.yml build --no-cache $(docker ps --format '{{.Names}}' --filter=ancestor=ethichub_local_vue)
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
@Ramarti
Ramarti / EthicHubReputation.sol
Last active June 5, 2018 07:56
EthicHubReputation snippet
pragma solidity ^0.4.23;
import '../EthicHubBase.sol';
import '../math/SafeMath.sol';
import './EthicHubReputationInterface.sol';
contract EthicHubReputation is EthicHubBase, EthicHubReputationInterface {
//10 with 2 decilmals
uint maxReputation = 1000;
@Ramarti
Ramarti / reputation.tex
Created May 17, 2018 10:19
EthicHubReputation formulas
Rc = Rc_{p} - Rc_{p} · \frac{d}{d_{max} }
Dln = Rln_{p} · \frac{d}{d_{max} }
Rln =\begin{cases} Rln_{p} - Dln & Dln < 1\\Rln_{p} - 1 & Dln >= 1\end{cases}
P_{a} = t_{n}·C
Rc = Rc_{p} + \frac{1}{N_{t_{n}}