Cadence

1 program Added 2025-10-28T09:16:53Z Model: google/gemini-2.5-proTemp: 0.4 Evidence Report issue View issues
Aliases: —
Provenance: commit d8dffdbf85 · authored 2025-10-28T10:16:53+01:00 · model google/gemini-2.5-pro

Sources mentioning this language

2 sources · pl_id: pl/cadence
LLM (this repo) · 1Linguist

Extensions claimed by this language

1 claim. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.cdclinguistprimary41.1K files

Related languages

Cadence SKILL (0.40)SKILL (0.32)Essence (0.29)CDuce (0.23)Scade (0.21)

LLM-contributed programs

Fungible Token Standard Contract

Provenance: commit d8dffdbf85 · authored 2025-10-28T10:16:53+01:00 · model google/gemini-2.5-pro · Temp 0.4
code.cdc · license: Apache-2.0 · added: 2025-10-28T09:16:53Z
/*
    Description: The Fungible Token standard's smart contract.
    This contract is a template for a basic fungible token.
    It is not meant to be deployed as-is, but to be imported by other contracts
    that wish to conform to the fungible token standard.
    License: Apache-2.0
*/
pub contract FungibleToken {

    // Event that is emitted when the total supply of a token increases
    pub event TokensInitialized(initialSupply: UFix64)

    // Event that is emitted when tokens are withdrawn from a Vault
    pub event TokensWithdrawn(amount: UFix64, from: Address?)

    // Event that is emitted when tokens are deposited to a Vault
    pub event TokensDeposited(amount: UFix64, to: Address?)

    // The total supply of the token in existence
    pub var totalSupply: UFix64

    // The interface that all Vaults are required to implement
    //
    pub resource interface Provider {

        // withdraw removes tokens from the implementing vault
        // and returns a vault with the removed tokens.
        //
        // The function's access level is public, but it is still constrained
        // by the access level of the variable that the resource is stored in.
        //
        pub fun withdraw(amount: UFix64): @Vault {
            post {
                // `result` is a keyword that refers to the return value of the function
                result.balance == UFix64(amount):
                    "Withdrawal amount must be the same as the balance of the withdrawn Vault"
            }
        }
    }

    // The interface that all Vaults are required to implement
    // in order to receive tokens.
    //
    pub resource interface Receiver {

        // deposit takes a Vault and adds its balance to the implementing vault
        pub fun deposit(from: @Vault) {
            pre {
                // `from` is a keyword that refers to the argument of the function
                from.balance > 0.0:
                    "Deposit balance must be positive"
            }
        }

        // The balance of the account.
        // The access level for this field is public,
        // but it is still constrained by the access level of the variable
        // that the resource is stored in.
        pub var balance: UFix64
    }

    // The interface that provides a read-only view of the Vault's balance
    //
    pub resource interface Balance {
        pub var balance: UFix64
    }

    // A Vault is a resource that stores a fungible token.
    // It is required to implement the Provider, Receiver, and Balance interfaces
    //
    pub resource Vault: Provider, Receiver, Balance {

        // The balance of the Vault
        pub var balance: UFix64

        // initialize the balance at resource creation time
        init(balance: UFix64) {
            self.balance = balance
        }

        // withdraw removes tokens from the vault and returns a new vault
        // with the removed tokens
        pub fun withdraw(amount: UFix64): @Vault {
            self.balance = self.balance - amount
            emit TokensWithdrawn(amount: amount, from: self.owner?.address)
            return <-create Vault(balance: amount)
        }

        // deposit takes a vault and adds its balance to this vault
        pub fun deposit(from: @Vault) {
            self.balance = self.balance + from.balance
            emit TokensDeposited(amount: from.balance, to: self.owner?.address)
            destroy from
        }

        destroy() {
            FungibleToken.totalSupply = FungibleToken.totalSupply - self.balance
        }
    }

    // createEmptyVault creates a new Vault with a balance of zero
    // and returns it to the calling context.
    pub fun createEmptyVault(): @Vault {
        return <-create Vault(balance: 0.0)
    }

    init() {
        self.totalSupply = 0.0
        emit TokensInitialized(initialSupply: self.totalSupply)
    }
}

Real programs from Software Heritage

1 sample mined from derived_datasets/<date>/contents/*.parquet, byte-verified against the SWH archive. Citation-grade qualified SWHIDs preserved.
invite_agent_minter.cdc · 1115 B · ext .cdc · seen 9× in SWH
via unique-primary
swh:1:cnt:f0593bb24133223e5beb0de733136ed3148967f1;origin=https://github.com/DAAM-Agency/DAAM;anchor=swh:1:rev:b412721cb7736ff4ada80c5ec25f04c051c011e7;path=/transactions/admin/invite_agent_minter.cdc
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source
// invite_admin_minter.cdc
// Used for Admin to invite another Admin.
// Used for Admin to give Minter access.
// The invitee Must have a Profile before receiving or accepting this Invitation

import DAAM from 0x7db4d10c78bad30a

transaction(newAgent: Address, minterAccess: Bool)
{
    let admin    : &DAAM.Admin
    let newAgent : Address 

    prepare(admin: AuthAccount) {
        self.admin    = admin.borrow<&DAAM.Admin>(from: DAAM.adminStoragePath)!
        self.newAgent = newAgent
    }

    pre {
        DAAM.isAdmin(newAgent)   == nil : newAgent.toString().concat(" is already an Admin.")
        DAAM.isAgent(newAgent)   == nil : newAgent.toString().concat(" is already an Agent.")
        DAAM.isCreator(newAgent) == nil : newAgent.toString().concat(" is already a Creator.")
        DAAM.isMinter(newAgent)  == nil : newAgent.toString().concat(" is already a Minter.")
    }
    
    execute {
        self.admin.inviteAgent(self.newAgent)
        log("Agent Invited")

        if(minterAccess) {
            self.admin.inviteMinter(self.newAgent)
            log("Minter Invited")
        }
    }
}

Contribute — propose a file extension

Tell us where to find evidence about Cadence (mapped to pl/cadence). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Cadence/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Caddyfile Cadence SKILL →