Skip to content

Instantly share code, notes, and snippets.

View smiled0g's full-sized avatar
🐻
Fighting bear market by BUIDLing great products

Paul N. smiled0g

🐻
Fighting bear market by BUIDLing great products
  • Band Protocol, TripAdvisor, Turfmapp
  • Bangkok, Thailand
  • X @PNattapatsiri
View GitHub Profile
@smiled0g
smiled0g / CoinGeckoVolumeDemo.sol
Last active November 21, 2019 12:45
Solidity example code for getting volume data from CoinGecko via Band Protocol's OpenAPI
pragma solidity ^0.5.0;
interface Oracle {
enum QueryStatus { INVALID, OK, NOT_AVAILABLE, DISAGREEMENT }
function query(bytes calldata input)
external payable returns (bytes32 output, uint256 updatedAt, QueryStatus status);
function queryPrice() external view returns (uint256);
}
contract CoinGeckoVolumeContract {
@smiled0g
smiled0g / CoinGecko-OpenAPI-Spec.json
Last active November 21, 2019 10:15
A CoinGecko token volume spec for Band Protocol's OpenAPI
{
"meta": {
"version": "1",
"info": {
"image": "https://www.coingecko.com/thumbnail.png",
"description": "CoinGecko: 24hr Trading Volume"
},
"aggregation": "MEDIAN",
"variables": [
"string"
function check(letterPool, word) {
// S1
const map = {}
for (let i=0; i<letterPool.length; i++) {
const character = letterPool[i]
if (map[character] === undefined) {
map[character] = 1
} else {
map[character] += 1
}
function anagram(lp, word) {
const m = lp.reduce((o, w) => Object.assign(o, {[w]: (o[w] || 0)+1}), {})
return !word.split('').some(c => !m[c]--)
}