From f29717527622158825f430dec9f39a2e84c598a8 Mon Sep 17 00:00:00 2001 From: youssefea Date: Wed, 17 Dec 2025 15:05:48 +0000 Subject: [PATCH 1/5] update builder codes --- docs/base-chain/quickstart/builder-codes.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/base-chain/quickstart/builder-codes.mdx b/docs/base-chain/quickstart/builder-codes.mdx index 2b701d28..8454326e 100644 --- a/docs/base-chain/quickstart/builder-codes.mdx +++ b/docs/base-chain/quickstart/builder-codes.mdx @@ -216,7 +216,7 @@ Wallet providers need to support the `dataSuffix` capability to enable attributi Onchain Builder codes are currently still not live on mainnet. -Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-solana-bridge) via the `hookData` mechanism. Currently available for **Solana → Base** flows only. +Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-solana-bridge) via the [`hookData`](https://github.com/base/flywheel/blob/30266bba4649b0eb161e55bfa4755651049a5d1f/src/hooks/BridgeReferralFees.sol#L75) mechanism. Currently available for **Solana → Base** flows only. @@ -229,7 +229,7 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol ```solidity bytes memory hookData = abi.encode( 0xUSER, // destination address on Base (NOT the Twin) - 0xBUILDER_CODE, // your bytes32 code + 0xBUILDER_CODE, // your builder code in type string memory 100 // feeBps (100 = 1%) ); ``` @@ -270,7 +270,7 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol data: abi.encodeWithSelector( Flywheel.send.selector, , - , // 0x311935Cd80B76769bF2ecC9D8Ab7635b2139cf82 on Base Mainnet + , // 0x311935Cd80B76769bF2ecC9D8Ab7635b2139cf82 on Base Mainnet hookData ) }); @@ -301,7 +301,7 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol ## Give feedback! -We're constantly working to improve the Builder Codes experience. If you have any feedback, please let us know [here](https://t.co/zwvtmXXzGz). +Base is constantly working to improve the Builder Codes experience. If you have any feedback, please let the team know [here](https://t.co/zwvtmXXzGz). From b2bc45068bb0bbdc507f07db64aeef45ee2d9c25 Mon Sep 17 00:00:00 2001 From: youssefea Date: Thu, 18 Dec 2025 17:54:26 +0000 Subject: [PATCH 2/5] add builder code example --- docs/base-chain/quickstart/base-solana-bridge.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/base-chain/quickstart/base-solana-bridge.mdx b/docs/base-chain/quickstart/base-solana-bridge.mdx index 77f74ace..e926b12b 100644 --- a/docs/base-chain/quickstart/base-solana-bridge.mdx +++ b/docs/base-chain/quickstart/base-solana-bridge.mdx @@ -304,6 +304,8 @@ Set `CDP_API_KEY` in your `.env` file to get access to the faucet. "BridgeValidator": "0xa80C07DF38fB1A5b3E6a4f4FAAB71E7a056a4EC7", "CrossChainERC20Factory": "0x488EB7F7cb2568e31595D48cb26F63963Cc7565D", "SOL": "0xCace0c896714DaF7098FFD8CC54aFCFe0338b4BC" + "FLYWHEEL_ADDRESS": "0x00000f14ad09382841db481403d1775adee1179f" + "BRIDGE_CAMPAIGN_ADDRESS": "0xb61A842E4361C53C3f3c376DF3758b330BD6201c" } ``` From 360f63239e165cea82169beafb409f5057865d65 Mon Sep 17 00:00:00 2001 From: youssefea Date: Thu, 18 Dec 2025 17:54:52 +0000 Subject: [PATCH 3/5] update addresses on sepolia --- .../quickstart/base-solana-bridge.mdx | 4 +- docs/base-chain/quickstart/builder-codes.mdx | 142 ++++++++++++++---- 2 files changed, 115 insertions(+), 31 deletions(-) diff --git a/docs/base-chain/quickstart/base-solana-bridge.mdx b/docs/base-chain/quickstart/base-solana-bridge.mdx index e926b12b..f8a3ae2a 100644 --- a/docs/base-chain/quickstart/base-solana-bridge.mdx +++ b/docs/base-chain/quickstart/base-solana-bridge.mdx @@ -303,8 +303,8 @@ Set `CDP_API_KEY` in your `.env` file to get access to the faucet. "Bridge": "0x01824a90d32A69022DdAEcC6C5C14Ed08dB4EB9B", "BridgeValidator": "0xa80C07DF38fB1A5b3E6a4f4FAAB71E7a056a4EC7", "CrossChainERC20Factory": "0x488EB7F7cb2568e31595D48cb26F63963Cc7565D", - "SOL": "0xCace0c896714DaF7098FFD8CC54aFCFe0338b4BC" - "FLYWHEEL_ADDRESS": "0x00000f14ad09382841db481403d1775adee1179f" + "SOL": "0xCace0c896714DaF7098FFD8CC54aFCFe0338b4BC", + "FLYWHEEL_ADDRESS": "0x00000f14ad09382841db481403d1775adee1179f", "BRIDGE_CAMPAIGN_ADDRESS": "0xb61A842E4361C53C3f3c376DF3758b330BD6201c" } ``` diff --git a/docs/base-chain/quickstart/builder-codes.mdx b/docs/base-chain/quickstart/builder-codes.mdx index 8454326e..be08383e 100644 --- a/docs/base-chain/quickstart/builder-codes.mdx +++ b/docs/base-chain/quickstart/builder-codes.mdx @@ -1,5 +1,5 @@ --- -title: "Base Builder Codes" +title: "Base Builder Codes" description: "Integrate Builder Codes to attribute onchain activity to your app or wallet." --- @@ -14,16 +14,16 @@ Each code has associated metadata. Onchain metadata primarily includes a “payo Once your app is registered on [Base.dev](http://base.dev/), the Base App will auto-append your Base Builder Code to transactions its users make in your app (e.g. via your mini app, or the Base App's browser). This powers your onchain analytics in [Base.dev](http://base.dev/) and qualifies you for potential future rewards. -**Builder Code analytics currently only support Smart Account (AA) transactions.** EOA support is coming soon. Your attribution data is preserved and will appear once EOA support is activated. + **Builder Code analytics currently only support Smart Account (AA) + transactions.** EOA support is coming soon. Your attribution data is preserved + and will appear once EOA support is activated. - - ## For App Developers -Mini Apps in the Base app will have their builder codes auto-appended to their transactions. -Be sure to [register for Base.dev](https://base.dev/) + Mini Apps in the Base app will have their builder codes auto-appended to their + transactions. Be sure to [register for Base.dev](https://base.dev/) Integrating Builder Codes requires appending a suffix—provided by Base—to your transaction data. @@ -31,10 +31,10 @@ Integrating Builder Codes requires appending a suffix—provided by Base—to yo -When you register on [base.dev](https://base.dev/), you will receive a **Builder Code**—a random string (e.g., `k3p9da`) that you'll use to generate your attribution suffix. +When you register on [base.dev](https://base.dev/), you will receive a **Builder Code**—a random string (e.g., `k3p9da`) that you'll use to generate your attribution suffix. You can find your code anytime under **Settings** → **Builder Code**. - + @@ -47,9 +47,9 @@ You can find your code anytime under **Settings** → **Builder Code**. ```typescript lines highlight={14-16} import { useSendCalls } from 'wagmi' import { Attribution } from 'ox/erc8021' - + // Your builder code provided by base.dev - const builderCode = "abcd1234" + const builderCode = "abcd1234" const dataSuffix = Attribution.toDataSuffix({ codes: [builderCode] }) @@ -81,9 +81,9 @@ You can find your code anytime under **Settings** → **Builder Code**. ```typescript lines highlight={11-13} import { walletClient } from './client' import { Attribution } from 'ox/erc8021' - + // Your builder code provided by base.dev - const builderCode = "abcd1234" + const builderCode = "abcd1234" const dataSuffix = Attribution.toDataSuffix({ codes: [builderCode] }) @@ -107,9 +107,9 @@ You can find your code anytime under **Settings** → **Builder Code**. ```typescript lines highlight={15} import { encodeFunctionData } from 'viem' import { Attribution } from 'ox/erc8021' - + // Your builder code provided by base.dev - const builderCode = "abcd1234" + const builderCode = "abcd1234" const dataSuffix = Attribution.toDataSuffix({ codes: [builderCode] }) @@ -132,6 +132,7 @@ You can find your code anytime under **Settings** → **Builder Code**. ``` + @@ -152,6 +153,7 @@ Wallet providers need to support the `dataSuffix` capability to enable attributi dataSuffix: string; // hex-encoded bytes provided by the app } ``` + @@ -170,7 +172,7 @@ Wallet providers need to support the `dataSuffix` capability to enable attributi return { ...tx, // Append suffix bytes (remove 0x prefix from suffix if tx.data has it) - data: tx.data + suffix.slice(2) + data: tx.data + suffix.slice(2) } } ``` @@ -193,6 +195,7 @@ Wallet providers need to support the `dataSuffix` capability to enable attributi ``` + Wallets may also include their own attribution code (their own ERC-8021 suffix) by simply prepending the wallet’s own suffix before the app’s. @@ -207,20 +210,21 @@ Wallet providers need to support the `dataSuffix` capability to enable attributi ``` This ensures both the app and the wallet receive onchain attribution. + ## For Base-Solana Bridge Developers -Onchain Builder codes are currently still not live on mainnet. + Onchain Builder codes are currently still not live on mainnet. Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-solana-bridge) via the [`hookData`](https://github.com/base/flywheel/blob/30266bba4649b0eb161e55bfa4755651049a5d1f/src/hooks/BridgeReferralFees.sol#L75) mechanism. Currently available for **Solana → Base** flows only. - When you register on base.dev, you will receive a Builder Code. This is a random string (e.g., k3p9da) that you will use to generate your attribution suffix. + When you register on base.dev, you will find a Builder Code under your app's settings. This is a random string (e.g., k3p9da) that you will use to generate your attribution suffix. @@ -233,6 +237,7 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol 100 // feeBps (100 = 1%) ); ``` + @@ -243,15 +248,15 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol For a bridge with no follow-up call: ``` - to: + to: // 0xb61A842E4361C53C3f3c376DF3758b330BD6201c on Base Sepolia amount: 100 call: ty: Call - to: + to: // 0x00000f14ad09382841db481403d1775adee1179f on Base Sepolia value: 0 data: abi.encodeWithSelector( Flywheel.send.selector, - , + , // 0xb61A842E4361C53C3f3c376DF3758b330BD6201c on Base Sepolia , hookData ) @@ -265,12 +270,12 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol // 1) Flywheel attribution (must be first) calls[0] = Call({ - to: , + to: , // 0x00000f14ad09382841db481403d1775adee1179f on Base Sepolia value: 0, data: abi.encodeWithSelector( Flywheel.send.selector, - , - , // 0x311935Cd80B76769bF2ecC9D8Ab7635b2139cf82 on Base Mainnet + , // 0xb61A842E4361C53C3f3c376DF3758b330BD6201c on Base Sepolia + , // e.g. For SOL on Base Sepolia, use 0xCace0c896714DaF7098FFD8CC54aFCFe0338b4BC hookData ) }); @@ -293,16 +298,95 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol ``` + - + + [Terminally Onchain](https://terminallyonchain.com/) is a production Next.js app that exposes the bridge via a command terminal UI. Users connect a Solana wallet, type commands such as to bridge and call a contract on Base: ---- + You can use [Terminally Onchain](https://terminallyonchain.com/) to test bridge transactions with Builder Codes like so: -## Give feedback! + ```bash + bridge 0.0001 sol 0xYOUR_DESTINATION_ADDRESS --with-bc YOUR_BUILDER_CODE --bc-fee YOUR_FEE_BPS + ``` - -Base is constantly working to improve the Builder Codes experience. If you have any feedback, please let the team know [here](https://t.co/zwvtmXXzGz). - + To see how this is implemented, you can take a look at the [Github repo](https://github.com/base/sol2base/blob/e0c283035be1e3e345d329e2d77b05e29a1d38b3/src/components/MainContent.tsx#L667): + + ```typescript sol2base/MainContent.tsx expandable + // Constants + const BRIDGE_CAMPAIGN_ADDRESS = "0xb61A842E4361C53C3f3c376DF3758b330BD6201c"; + const FLYWHEEL_ADDRESS = "0x00000f14ad09382841db481403d1775adee1179f"; + const MULTICALL_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11"; + + // Encode hookData: (address user, string code, uint8 feeBps) + const buildBuilderHookData = ( + destination: string, + builderCode: string, + feeBps: number + ) => { + const coder = new AbiCoder(); + return coder.encode( + ["address", "string", "uint8"], + [destination, builderCode, feeBps] + ); + }; + + // Build Flywheel.send call + const buildBuilderCall = ( + destination: string, + builderCode: string, + feeBps: number, + tokenAddress: string + ): BaseContractCall => { + const hookData = buildBuilderHookData(destination, builderCode, feeBps); + const data = encodeFunctionData({ + abi: FLYWHEEL_ABI, + functionName: "send", + args: [BRIDGE_CAMPAIGN_ADDRESS, tokenAddress, hookData], + }); + return { type: "call", target: FLYWHEEL_ADDRESS, value: "0", data }; + }; + + // Wrap builder + user calls in Multicall (for chained calls) + const buildMulticall = ( + builder: BaseContractCall, + userCall: BaseContractCall + ): BaseContractCall => { + const data = encodeFunctionData({ + abi: MULTICALL_ABI, + functionName: "multicall", + args: [ + [ + { target: builder.target, callData: builder.data }, + { target: userCall.target, callData: userCall.data }, + ], + ], + }); + return { type: "delegatecall", target: MULTICALL_ADDRESS, value: "0", data }; + }; + + // Usage: attach builder code to bridge + if (payload.flags.withBc) { + const builderCall = buildBuilderCall( + destination, + builderCode, + feeBps, + remoteToken + ); + callOption = userCall ? buildMulticall(builderCall, userCall) : builderCall; + } + // Set destination to campaign address when using builder codes + const destinationForBridge = builderCode + ? BRIDGE_CAMPAIGN_ADDRESS + : payload.destination; + ``` + + + +## Give feedback! + + Base is constantly working to improve the Builder Codes experience. If you + have any feedback, please let the team know [here](https://t.co/zwvtmXXzGz). + From 634ed3169ddeb8ccab830d275857d9c5523426a3 Mon Sep 17 00:00:00 2001 From: youssefea Date: Thu, 18 Dec 2025 20:05:10 +0000 Subject: [PATCH 4/5] add callout --- docs/base-chain/quickstart/builder-codes.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/base-chain/quickstart/builder-codes.mdx b/docs/base-chain/quickstart/builder-codes.mdx index 51465206..b830a0e4 100644 --- a/docs/base-chain/quickstart/builder-codes.mdx +++ b/docs/base-chain/quickstart/builder-codes.mdx @@ -271,6 +271,10 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol + +Mainnet support for builder codes is not open to all builders yet. If you are interested in getting access, please contact the team on [discord](https://discord.gg/buildonbase). + + ## Give feedback! From 3f0f50fef9be77c542bc41e9a6ee3eb536433fe4 Mon Sep 17 00:00:00 2001 From: youssefea Date: Thu, 18 Dec 2025 20:06:13 +0000 Subject: [PATCH 5/5] maj bc --- docs/base-chain/quickstart/builder-codes.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/base-chain/quickstart/builder-codes.mdx b/docs/base-chain/quickstart/builder-codes.mdx index b830a0e4..2e81d9ad 100644 --- a/docs/base-chain/quickstart/builder-codes.mdx +++ b/docs/base-chain/quickstart/builder-codes.mdx @@ -272,7 +272,7 @@ Builder codes work with the [Base-Solana bridge](/base-chain/quickstart/base-sol -Mainnet support for builder codes is not open to all builders yet. If you are interested in getting access, please contact the team on [discord](https://discord.gg/buildonbase). +Mainnet support for Builder Codes is not open to all builders yet. If you are interested in getting access, please contact the team on [discord](https://discord.gg/buildonbase). ## Give feedback!