Skip to content
Open
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const hasTypesense =
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Cadence",
tagline: "The Best Programming Language for Smart Contracts",
tagline: "The Best Programming Language for Consumer DeFi",
favicon: "favicon.ico",

// Set the production url of your site here
Expand Down
169 changes: 86 additions & 83 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,57 @@ import learnAnimation from "./learn.json";
import styles from './index.module.css';
import Logo from '@site/static/img/logo.svg';

const example = `access(all)
resource NFT {

access(all)
fun greet(): String {
return "I'm NFT #"
.concat(self.uuid.toString())
const example = `import "DeFiActions"
import "FlowTransactionScheduler"

// Schedule recurring yield compounding
transaction(stakingPid: UInt64, intervalDays: UInt64) {
prepare(signer: auth(Storage) &Account) {
// Compose DeFi actions atomically:
// Claim rewards → Swap → Restake
let rewardsSource = StakingConnectors.PoolRewardsSource(
userCertificate: signer.capabilities
.get<&StakingPool>(publicPath),
pid: stakingPid
)

let swapper = SwapConnectors.TokenSwapper(
source: rewardsSource,
targetToken: "FLOW"
)

let stakeSink = StakingConnectors.PoolStakeSink(
pool: stakingPool,
source: swapper
)

// Schedule to run every N days
let future = getCurrentBlock().timestamp
+ (intervalDays * 86400.0)

FlowTransactionScheduler.schedule(
action: stakeSink,
timestamp: future,
recurring: true
)
}
}

access(all)
fun main(): String {
let nft <- create NFT()
let greeting = nft.greet()
destroy nft
return greeting
}`

function cadence(Prism) {
Prism.languages.cadence = {
comment: {
pattern: /\/\/.*/,
greedy: true
},
string: {
pattern: /"[^"]*"/,
greedy: true
},
keyword:
/\b(?:access|all|fun|resource|create|let|destroy|return|self)\b/,
/\b(?:access|all|fun|resource|create|let|destroy|return|self|var|init|from|import|transaction|prepare|auth|Storage|Account|true|false)\b/,
'class-name': /\b[A-Z][A-Za-z_\d]*\b/,
function: /\b[a-z_]\w*(?=\s*\()/i,
number: /\b\d+\.?\d*\b/,
}
}

Expand All @@ -73,8 +96,8 @@ export default function Home() {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Cadence is a resource-oriented programming language that introduces new features to smart contract programming that help developers ensure that their code is safe, secure, clear, and approachable.">
title={`${siteConfig.title} - Build the Future of Consumer DeFi`}
description="Ship Consumer DeFi products faster. Cadence delivers the security, automation, and tooling to build financial apps that millions trust.">
<main>

<div className="content-wrapper">
Expand All @@ -85,11 +108,11 @@ export default function Home() {
</Head>
<Logo title="Cadence" className="logo" width="18em" height="4em" />
<h2>
Forge the future of decentralized apps.
Build the future of Consumer DeFi.
<br/>
Unleash <strong>utility</strong>, <strong>composability</strong>,
The safest, most <strong>composable</strong> language
<br/>
and <strong>safety</strong> in smart contracts.
for <strong>financial applications</strong> that reach millions.
</h2>

<Link className="cta" href="/docs">
Expand All @@ -109,28 +132,28 @@ export default function Home() {

<div style={{maxWidth: "58rem", marginTop: "-1rem"}}>
<p>
Together, we are working to build a programming language to empower everyone to push the boundaries of smart contracts and on-chain logic.
Cadence is powering the next generation of Consumer DeFi, bringing institutional-grade security and consumer-friendly experiences to financial applications that serve millions.
</p>
<div style={{ position: 'relative', paddingBottom: '56.25%', height: 0, overflow: 'hidden', maxWidth: '100%' }}>
<iframe
<iframe
style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}
src="https://www.youtube.com/embed/6SE8bvTmmQc?si=DTMmGOHf3wyqIDTF"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
src="https://www.youtube.com/embed/6SE8bvTmmQc?si=DTMmGOHf3wyqIDTF"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
></iframe>
</div>
<p>
Announced in 2020, the Cadence programming language introduced a new paradigm of resource-oriented programming.
By leveraging the power of resources, Cadence brings exciting new ideas to the world of smart contracts.
Cadence makes it easy to write maximally on-chain smart contracts that are secure by design.
Our goals for Cadence are to enable ambitious developers to make daring & complex ideas possible while making them easy,
fun & developer-friendly, as well as safe and secure.
Cadence pioneers <a href="https://cadence-lang.org/docs/language/resources">resource-oriented programming</a>—a paradigm designed specifically for handling valuable digital assets.
Unlike traditional smart contract languages where assets are piled in centralized contract storage, Cadence ensures user assets stay in their own accounts. The result is dramatically reduced attack surfaces and the elimination of entire classes of DeFi vulnerabilities.
</p>
<p>
With features like <a href="https://developers.flow.com/blockchain-development-tutorials/forte/flow-actions">Flow Actions</a> and <a href="https://developers.flow.com/blockchain-development-tutorials/forte/scheduled-transactions/scheduled-transactions-introduction">Scheduled Transactions</a>, developers can build sophisticated DeFi experiences that feel native to their users.
</p>
<p>
Join us in shaping the future of blockchain, one line of code at a time. Get started today!
Ready to build the future of finance? <a href="https://developers.flow.com/blockchain-development-tutorials/cadence/getting-started">Get started today</a>.
</p>
</div>

Expand All @@ -139,103 +162,83 @@ export default function Home() {
<div className="features">
<div className="content-wrapper">

<div className="feature">
<div className="feature alternate">
<div>
<h3><FcLock/> Safety by design</h3>
<h3><FcChargeBattery/>Complex DeFi Operations, Simple User Experiences</h3>
<p>
Cadence provides security and safety guarantees that greatly simplify the development of secure smart contracts.
In Cadence, transactions are first-class citizens. Write detailed, customized transactions that interact with multiple contracts atomically, either all succeed or all fail. No need to deploy intermediary contracts or build complex multi-call patterns.
</p>
<p>
As smart contracts often deal with valuable assets, Cadence provides the <a href="https://cadence-lang.org/docs/language/resources">resource-oriented programming paradigm</a>,
which guarantees that assets can only exist in one location at a time, cannot be copied, and cannot be accidentally lost or deleted.
Want to check a user's staking position across three protocols, claim rewards from two pools, swap tokens, and restake—all in one operation? Write it as a transaction. This level of composability and customization simply isn't possible on other platforms where you're limited to pre-deployed contract functions.
</p>
<p>
Cadence includes several language features that prevent entire classes of bugs via a strong static type system, <a href="https://cadence-lang.org/docs/language/functions#function-preconditions-and-postconditions">design by contract</a>,
and <a href="https://cadence-lang.org/docs/language/capabilities">capability-based access control</a>.
Cadence scripts provide native data availability—query any on chain data directly from state without external indexers or APIs. Build sophisticated analytics and user experiences that other chains cannot offer.
</p>
<p>
These security and safety features allow smart contract developers to focus on the business logic of their contract,
instead of preventing security footguns and attacks.
This transactional flexibility is what makes Consumer DeFi possible. Complex financial operations that feel simple, all while maintaining security and atomicity.
</p>
</div>
<div>
<Lottie animationData={securityAnimation} />
<Lottie animationData={powerAnimation} />
</div>
</div>

<div className="feature alternate">
<div className="feature">
<div>
<h3><FcMindMap/>Built for permissionless composability</h3>
<h3><FcLock/> Built for DeFi Security</h3>
<p>
<a href="https://cadence-lang.org/docs/language/resources">Resources</a> are stored directly in users' accounts,
and can flow freely between contracts. They can be passed as arguments to functions, returned from functions, or even combined in arbitrary data structures.
This makes implementing business logic easier and promotes the reuse of existing logic.
In DeFi, security isn't optional. The <a href="https://cadence-lang.org/docs/language/resources">resource-oriented programming paradigm</a> in Cadence fundamentally changes how assets are stored and protected.
</p>
<p>
<a href="https://cadence-lang.org/docs/language/interfaces">Interfaces</a> enable interoperability of contracts and resources allowing
developers to integrate their applications into existing experiences easily.
<strong>User assets stay in user accounts, not in contract storage.</strong> This architectural decision dramatically reduces attack surfaces.
Unlike Solidity where exploits can drain entire protocols in one transaction, the Cadence model makes attacks exponentially harder. Attackers must target individual accounts one at a time, with no easy list of vulnerable targets.
</p>
<p>
In addition, the <a href="https://cadence-lang.org/docs/language/attachments">attachments</a> feature
of Cadence allows developers to extend existing types with new functionality and data,
without requiring the original author of the type to plan or account for the intended behavior.
Resources guarantee that assets can only exist in one location at a time, cannot be copied, and cannot be accidentally lost or deleted.
Combined with a strong static type system, <a href="https://cadence-lang.org/docs/language/functions#function-preconditions-and-postconditions">enforced business logic</a>,
and <a href="https://cadence-lang.org/docs/language/capabilities">capability-based access control</a>, Cadence eliminates entire classes of DeFi vulnerabilities including reentrancy attacks.
</p>
</div>
<div>
<Lottie animationData={composabilityAnimation} />
</div>
</div>

<div className="feature">
<div>
<h3><FcIdea/> Easy to learn, build and ship</h3>
<p>
Cadence's syntax is inspired by popular modern general-purpose programming languages like Swift, Kotlin, and Rust,
so developers will find the syntax and the semantics familiar.
Practical tooling, <a href="https://cadence-lang.org/docs/language">documentation</a>,
and examples enable developers to start creating programs quickly and effectively.
Build financial applications with confidence. Cadence provides safety guarantees that let you focus on creating value, not patching vulnerabilities.
</p>
</div>
<div>
<Lottie animationData={learnAnimation} />
<Lottie animationData={securityAnimation} />
</div>
</div>

<div className="feature alternate">
<div>
<h3><FcChargeBattery/>Powerful transactions for mainstream experiences</h3>
<h3><FcMindMap/>Composable DeFi Primitives</h3>
<p>
Build sophisticated financial products by composing powerful primitives. <a href="https://cadence-lang.org/docs/language/resources">Resources</a> stored in users' accounts can flow freely between contracts, enabling seamless integration of lending, staking, swapping, and yield strategies in a single user experience.
</p>
<p>
In Cadence, a transaction has a lot more flexibility and the power to perform multiple operations with a single transaction,
as opposed to multiple, separate smart contract calls like in other languages.
It allows complex, multi-step interactions to be one-click user experiences.
<a href="https://developers.flow.com/blockchain-development-tutorials/forte/flow-actions">Flow Actions</a> allow you to bundle complex multi-step DeFi operations into one-click experiences.
<a href="https://developers.flow.com/blockchain-development-tutorials/forte/scheduled-transactions/scheduled-transactions-introduction">{" "}Scheduled Transactions</a> enable native on-chain automation. Recurring payments, DCA strategies, and portfolio rebalancing execute directly from user wallets, no backend servers required.
</p>
<p>
Developers can easily batch multiple transactions, turning complicated user journeys into a few clicks.
For example, imagine approving and completing the listing of an NFT from a new collection in the same transaction,
or adding and sending funds with just one approval.
<a href="https://cadence-lang.org/docs/language/interfaces">Interfaces</a> and <a href="https://cadence-lang.org/docs/language/attachments">attachments</a> make protocols truly composable.
Build new DeFi functionality on top of any token standard, creating composable building blocks that work together seamlessly.
</p>
</div>
<div>
<Lottie animationData={powerAnimation} />
<Lottie animationData={composabilityAnimation} />
</div>
</div>

<div className="feature">
<div>
<h3>🧰 Best-in-class tooling</h3>
<h3><FcIdea/> Built for Scale: Fast, Cheap, and Ready for Millions</h3>
<p>
Cadence comes with great IDE support. Use your favorite editor,
like <a href="https://marketplace.visualstudio.com/items?itemName=onflow.cadence">Visual Studio Code</a>,
Vim or Emacs, to get diagnostics, code completion, refactoring support, and more.
Cadence is designed for speed. Intuitive syntax, comprehensive testing frameworks, and powerful abstractions mean you spend less time debugging and more time building. Development cycles that took months in Solidity take days in Cadence.
</p>
<p>
To further enhance the developer experience, there is also a
native testing framework, which allows developers to write
unit & integration tests using Cadence.
The development time has been reduced from months to days, enabling rapid iteration and faster time-to-market for DeFi products. Ship faster, test in production with confidence, and capture market opportunities before your competitors.
</p>
</div>
<div>
<Lottie animationData={debuggingAnimation} />
<Lottie animationData={learnAnimation} />
</div>
</div>

Expand Down