Skip to content

Instantly share code, notes, and snippets.

@saibakatar
saibakatar / gist:8c96ec556143871cf0727fc4d8f9eeaf
Created October 18, 2018 06:59
Signed Integer declaration for Scilla
contract Int()
field a: Option Int32 = None {Int32} (*declaring variable a with no value*)
field b: Int32 = Int32 5 (*declaring variable b with a fixed value*)
transition update_value()
(*updating variable a*)
c = Int32 6; (*declaring variable c with fixed value in the transition*)
tmp = Some {Int32} c;
@saibakatar
saibakatar / gist:3a3959eca79709762ff286d5f9c2913e
Created October 18, 2018 07:01
Unsigned Integer declaration in Scilla
contract Uint()
field a: Option Uint32 = None {Uint32} (*declaring variable a with no value*)
field b: Uint32 = Uint32 5 (*declaring variable b with a fixed value*)
transition update_value()
(*updating variable a*)
c = Uint32 6; (*declaring variable c with fixed value in the transition*)
tmp = Some {Uint32} c;
@saibakatar
saibakatar / gist:8310754a24f6ca79535e14340516435b
Created October 18, 2018 07:03
String Declaration in Scilla
contract Strings()
field a : String = "" (*declaring variable a with no value*)
field b : String = "hello" (*declaring variable b with a fixed value*)
transition update_value()
(*updating variable a*)
c = "hi"; (*declaring variable c with fixed value in the transition*)
a:= c;
@saibakatar
saibakatar / gist:436c75df6da75c694245e70a23d4785b
Created October 18, 2018 07:04
Hash declaration in Scilla
contract Hash()
field a: Option ByStr32 = None {ByStr32} (*declaring variable a with no value*)
field b: ByStr32 = 0x123456789012345678901234567890123456789012345678901234567890abff
(*declaring variable b with some fixed value*)
transition update_value()
(*updating variable a*)
c = 0xabff567890123456789012345678901234567890123456789012345678901234; (*declaring variable c with fixed value in the transition*)
@saibakatar
saibakatar / gist:2dd3a8f3d048fa9ee5a70204129f7a49
Created October 18, 2018 07:07
Address declaration in Scilla
contract Address()
field a: Option ByStr20 = None {ByStr20} (*declaring variable a with no value*)
field b: ByStr20 = 0x1234567890123456789012345678901234567890
(*declaring variable b with some fixed value*)
transition update_value()
(*updating variable a*)
@saibakatar
saibakatar / gist:969321353d4b6116b5ccb04233e460c3
Created October 18, 2018 07:09
Block Number declaration in Scilla
contract Block()
field a: Option BNum = None {BNum} (*declaring variable a with no value*)
field b : BNum = BNum 5 (*declaring variable b with some fixed value*)
transition update_value()
(*updating variable a*)
c = BNum 6; (*declaring variable c with fixed value in the transition*)
tmp = Some {BNum} c;
@saibakatar
saibakatar / gist:77781635267fd5191cc564ae20e38e28
Created October 18, 2018 07:11
Boolean declaration in Scilla
contract Boolean()
field a : Option Bool = None {Bool} (*declaring variable a with no value*)
field b : Bool = True (*declaring variable b with some fixed value*)
transition update_value()
(*updating variable a*)
c = False; (*declaring variable c in the transition*)
tmp = Some {Bool} c;
@saibakatar
saibakatar / gist:daf7d07f210b288f6495a9e8cbc28803
Created October 18, 2018 07:13
List declaration in Scilla
contract Lists()
field a: List(Int32)= Nil {Int32} (*declaring variable a with no value*)
field b: List(Int32) = let c = Nil {Int32} in
let d = Int32 5 in
Cons{Int32} d c (*declaring variable b with fixed value*)
transition update_value()
(*updating variable a*)
@saibakatar
saibakatar / gist:86790f002a696e453f93ed625371ebdc
Created October 18, 2018 07:22
Map declaration in Scilla
contract Maps()
field a: Map ByStr20 String = Emp ByStr20 String (*declaring variable a with no value*)
field b: Map ByStr20 Int32 = let c = Emp ByStr20 Int32 in
let d = 0x1234567890123456789012345678901234567896 in
let e = Int32 5 in
builtin put c d e (*declaring variable b with fixed value*)
@saibakatar
saibakatar / Coinmarketcap API
Created March 4, 2021 10:41 — forked from erajanraja24/Coinmarketcap API
Configure Coinmarketcap API on Google sheets
function getCryptoPrice() {
var sh1=SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
var sh2=SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet2");
//Make sure that you got the API key from Coinmarketcap API dashboard and paste it in sheet_1 on cell B1
var apiKey=sh1.getRange(1, 2).getValue();
var url="https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=BTC"
var requestOptions = {
method: 'GET',