Skip to content

Instantly share code, notes, and snippets.

View ngmachado's full-sized avatar
💭
in the æther

Axe ngmachado

💭
in the æther
View GitHub Profile
const API_BASE_URL = 'https://dev.alfafrens.com//api/trpc/';
async function fetchFromAPI(endpoint, queryParams = {}) {
const url = new URL(`${API_BASE_URL}/${endpoint}`);
Object.keys(queryParams).forEach(key => url.searchParams.append(key, queryParams[key]));
try {
const response = await fetch(url, { method: 'GET', headers: { 'Content-Type': 'application/json' } });
if (!response.ok) throw new Error('AlfaFrens is sick response was not ok');
const jsonResponse = await response.json();
return jsonResponse.result ? jsonResponse.result.data : null;
pragma solidity ^0.8.0;
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { Base64 } from "@openzeppelin/contracts/utils/Base64.sol";
import {IConstantFlowAgreementV1} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol";
import { ISuperfluid, ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
/*
Super721SVG - Generate NFT based on SF CFA Stream
*/
@ngmachado
ngmachado / Super721SVGOffChain.sol
Last active October 6, 2022 13:53
CFA Bassd NFT (offchain JSON)
pragma solidity ^0.8.0;
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { Counters } from "@openzeppelin/contracts/utils/Counters.sol";
import {IConstantFlowAgreementV1} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol";
import { ISuperfluid, ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
/*
Super721SVGOffchain - NFT that points to JSON Offchain
*/
@ngmachado
ngmachado / Super721SVGOnChain.sol
Last active October 6, 2022 14:32
CFA Based NFT (onchain SVG)
pragma solidity ^0.8.0;
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { Base64 } from "@openzeppelin/contracts/utils/Base64.sol";
import {IConstantFlowAgreementV1} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol";
import { ISuperfluid, ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
/*
Super721SVGOnChain - Generate NFT based on SF CFA Stream
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract SuperfluidETHAmsterdam22 is ERC721, ERC721URIStorage, AccessControl {
using Counters for Counters.Counter;
pragma solidity ^0.8.0;
/*
We can pack all players permissions in one variable. Not using different maps for each one.
*/
contract ExgrasiaPackPermissions {
//masks
// SPDX-License-Identifier: MIT //0xECd2f5870c6D2EE5Dc4441B1887585A760E227fc
pragma solidity ^0.8.4;
import "./TinyWorld.sol";
import "./TinyWorldRegistry.sol";
import "./TileContract.sol";
import "./Types.sol";
import {CFAv1Library} from "https://github.com/superfluid-finance/protocol-monorepo/blob/dev/packages/ethereum-contracts/contracts/apps/CFAv1Library.sol";
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
/*
Exemple of upgrader supertoken based on roles.
NOTICE: IS ONE EXAMPLE NOT PROD READY
*/
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
/*
Factory that can deploy any number of TradeableCashflow using registerAppByFactory from SF protocol
*/
import "./TradeableCashflow.sol";
import {ISuperfluid, ISuperToken, SuperAppDefinitions} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
contract TCFFactory {
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
library SafeCast96 {
/**
* @dev Returns the downcasted int96 from uint256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.