Variables & Constants & Collection Overview
Variables and Constants How to declare let represents a constant, and var represents a variable. pub fun main { var a: Int = 2 // Regular types cannot contain nil (null). var a: Int? = nil // To
Search for a command to run...
Variables and Constants How to declare let represents a constant, and var represents a variable. pub fun main { var a: Int = 2 // Regular types cannot contain nil (null). var a: Int? = nil // To
Cadence is the smart contract language written in Go. There are only four concepts to learn: variables, collection types (arrays and dictionaries), structs, and resources. Yet, once a smart contract i
Capabilityを委任する 通常のCapabilityはsigner.capabilitiesに対して公開しますが、Capabilityの委任時はsigner.inboxに対して公開します。 通常のCapabilityの公開 /* Create a Thief resource */ signer.storage .save(<- MMORPG.createThiefResource(
乱数生成 access(all) fun rollDice(): UInt64 { // modulo: 6 returns 0, 1, 2, 3, 4, or 5 let rawRoll: UInt64 = revertibleRandom(modulo: 6) return rawRoll + 1 } 現在時刻の取得 self.execTime = getCurre
Struct の宣言方法 access(all) struct Info { access(contract) var orderQueue: [Order] /* setter */ access(contract) fun setOrder(execTime: UFix64) { var order = Order(execTime: execTim
トランザクションの概要 トランザクションコード transactionから始まるCadence言語で書かれた実行メソッドです。スマートコントラクトをimportしそのスマートコントラクトのメソッドを実行することができます。スマートコントラクトのメソッドはaccess(all)メソッドであれば誰でも呼び出せます。 例 const txId = await fcl.mutate({ c
変数・定数 宣言方法 letは定数を、varは変数を表します。 pub fun main { var a: Int = 2 // 通常の型はnil(ヌル)を含むことができません。 var a: Int? = nil // 変数にnilを入れられるようにするには、Optional Typeを使用します。 var b: Int = a! // Optional Typeをから通常の
Go言語で書かれたスマートコントラクト用言語です。この言語では変数、Collection型(配列・ディクショナリ)、Struct(構造体)、リソースの4種類しか覚える事はありません。しかし、スマートコントラクトをデプロイしておけば、お金の管理が出来るだけでなく、その情報を更新したり参照することで、無人野菜販売所やライドシェアの金融取引システム等が数十行で書けます。また、ゲーム向けのランキングシステ
これは日本らしさとメタバースについての考察です。 日本らしさには、えっこんな方法があったの?というちょっと裏ワザっぽいけど丁寧に作り込まれた奥の深さと、誰も見放さない万人に優しく接する設計が伺えます。 前者には才能が必要ですが、何故か日本の作品はこれができるものが多いですね。 というのが日本らしさの特徴ですが、メタバースのゲームには没入感を売りにしたものであっても(金銭面の臭いがする独特の雰囲気も