Skip to content

Instantly share code, notes, and snippets.

View daniel-farina's full-sized avatar
🎯
Focused

Daniel Farina daniel-farina

🎯
Focused
View GitHub Profile
@daniel-farina
daniel-farina / BADCOIN.md
Last active January 9, 2024 20:50
BadCoin - Veryfing the contract

TWAP (Time Weighted Average Price)

Serving TWAPs for every AMM pool.

A time weighted average price is a function that takes a sequence of (time, price) pairs and returns a price representing an 'average' over the entire time period. Currently, only the arithmetic mean method is implemented.

Example to query TWAP via the LCD API

URL: https://lcd-osmosis.blockapsis.com/osmosis/twap/v1beta1/ArithmeticTwap

{"pools":[{"@type":"/osmosis.gamm.v1beta1.Pool","address":"osmo1mw0ac6rwlp5r8wapwk3zs6g29h8fcscxqakdzw9emkne6c8wjp9q0t3v8t","id":"1","pool_params":{"swap_fee":"0.002000000000000000","exit_fee":"0.000000000000000000","smooth_weight_change_params":null},"future_pool_governor":"24h","total_shares":{"denom":"gamm/pool/1","amount":"276337765129834441908053295"},"pool_assets":[{"token":{"denom":"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2","amount":"3403611909429"},"weight":"536870912000000"},{"token":{"denom":"uosmo","amount":"31441747711316"},"weight":"536870912000000"}],"total_weight":"1073741824000000"},{"@type":"/osmosis.gamm.v1beta1.Pool","address":"osmo1500hy75krs9e8t50aav6fahk8sxhajn9ctp40qwvvn8tcprkk6wszun4a5","id":"2","pool_params":{"swap_fee":"0.005000000000000000","exit_fee":"0.000000000000000000","smooth_weight_change_params":null},"future_pool_governor":"24h","total_shares":{"denom":"gamm/pool/2","amount":"431625679217796465901905449"},"pool_assets":[{"token":{"denom":"uion","
@daniel-farina
daniel-farina / circle.yml
Last active April 16, 2017 05:24 — forked from rap2hpoutre/circle.yml
Circle CI example for Laravel
machine:
timezone:
Europe/Paris
php:
version: 7.0.3
environment:
ENVIRONMENT: testing
DB_URL: 127.0.0.1
@daniel-farina
daniel-farina / circle.yml
Created April 16, 2017 05:22 — forked from rap2hpoutre/circle.yml
Circle CI example for Laravel
machine:
timezone:
Europe/Paris
php:
version: 7.0.3
environment:
ENVIRONMENT: testing
DB_URL: 127.0.0.1
@daniel-farina
daniel-farina / fileName
Created September 23, 2016 00:16
created with LaravelDBDesigner
[{"name":"Bears","color":"Blue","position":{"x":320,"y":138},"modelclass":"Bear","increment":false,"timestamp":false,"softdelete":false,"column":[{"colid":"c217","name":"id","type":"increments","length":"0","order":0,"defaultvalue":"","enumvalue":""},{"colid":"c218","name":"name","type":"string","length":"200","order":1,"defaultvalue":"","enumvalue":""},{"colid":"c219","name":"danger_level","type":"string","length":"200","order":2,"defaultvalue":"","enumvalue":""}],"relation":[{"extramethods":"","foreignkeys":"","name":"fish","relatedmodel":"Fish","relationtype":"hasOne","usenamespace":""},{"extramethods":"","foreignkeys":"","name":"trees","relatedmodel":"Trees","relationtype":"hasMany","usenamespace":""},{"extramethods":"","foreignkeys":"bear_id, picnic_id","name":"picnics","relatedmodel":"Picnics","relationtype":"belongsToMany","usenamespace":""}],"seeding":[]},{"name":"Fish","color":"Yellow","position":{"x":1063,"y":14},"modelclass":"Fish","increment":false,"timestamp":false,"softdelete":false,"column":[{"