How to contribute to Open-Cadence?

Contributing to Open Cadence is easy! And we’d love for you to share your work with the community so that we can keep on benefiting from each others work and keep creating amazing projects on Flow!

In order to contribute, we’ve tried to make it as easy as possible to add an example to the website. We provide you the format for submitting a pull-request to this GitHub repo so that your example can be added. We’ll go over the format for submitting your example in the following section!

https://github.com/onflow/open-cadence

Adding an Example to Open Cadence Format

In order to submit an example to the Open Cadence GitHub, you will need to submit a pull request in line with the following format in order to get it merged to the site. The format is as follows.

export const contract = `pub resource interface Provider {

    // withdraw
    //
    // Function that subtracts tokens from the owner's Vault
    // and returns a Vault resource (@Vault) with the removed tokens.
    //
    // The function's access level is public, but this isn't a problem
    // because even the public functions are not fully public at first.
    // anyone in the network can call them, but only if the owner grants
    // them access by publishing a resource that exposes the withdraw
    // function.
    //
    pub fun withdraw(amount: UFix64): @Vault {
        post {
            // 'result' 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"
        }
    }
}
`