Skip to content

Instantly share code, notes, and snippets.

View MarcoWorms's full-sized avatar
:shipit:
undefined

Marco Guaspari Worms MarcoWorms

:shipit:
undefined
View GitHub Profile
View example.sol
/**
* @notice Determine whether or not a given target and calldata is valid
* @dev In order to be valid, target and calldata must pass the allowlist conditions tests
* @param targetAddress The target address of the method call
* @param data The raw calldata of the call
* @return isValid True if valid, false if not
*/
function validateCalldataByOrigin(
string memory originName,
View example.json
{
"id": "TOKEN_APPROVE_VAULT",
"implementationId": "IMPLEMENTATION_YEARN_VAULTS",
"methodName": "approve",
"paramTypes": ["address", "uint256"],
"requirements": [
["target", "isVaultUnderlyingToken"],
["param", "isVault", "0"]
]
}
View shitcoin.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable {
constructor() ERC20("Weed", "WEED") {
_mint(0xCA88C5D43Bb11eDBcBC1436fEFA9d578d8D64489, 420 * 10 ** decimals());
}
@MarcoWorms
MarcoWorms / ftm.md
Last active October 19, 2021 19:53
Buying $FTM to use Fantom Opera network services
View ftm.md
View shufflin.js
const seed = 1234
const shuffledDeck = shuffle(seed, deck)
View shuffle.js
const { pipe, sortBy, prop, pluck } = require('ramda')
const shuffle = (seed, deck) => {
const routine = pipe(
deck => deck.map((card, index) => ({
rank: seededRandom(seed + index),
card,
})),
sortBy(prop('rank')),
pluck('card')
View seeded-random.js
const seededRandom = seed => Math.abs(Math.sin(seed))
View fiddling.js
// http://ramdajs.com/docs/#pipe
const { pipe, curry } = require('ramda')
const addToTop = curry((card, deck) => [card, ...deck])
const addToBottom = curry((card, deck) => [...deck, card])
const addBoth = pipe(
addToTop({ name: 'Ice Wall', damage: 3, cost: 1 }),
addToBottom({ name: 'Earth Strike', damage: 6, cost: 3 })