😸CryptoKitties AMB bridge extension Demo

A demonstration of Arbitrary Message Bridging using CryptoKitties

An AMB bridge extension is a pair of mediator contracts associated with a specific pair of Arbitrary Message Bridge contracts.

The CryptoKitties bridge extension allows users to transfer a NFT representing a cat from one chain to another. It demonstrates the ability to perform operations with NFTs through the Arbitrary Message Bridge (AMB), which is part of the TokenBridge project.

In the demos, we deploy contracts and then transfer an NFT between 2 testnets, Sokol and Kovan.

  • Deployed on Kovan:

    • CryptoKitties contract (KittyCore) similar to the original CryptoKitties

    • A mediator contract (ForeignMediator). Kovan is called the foreign bridge in this scenario

  • Deployed on Sokol:

    • A modified version of CryptoKitties which can mint a new cat with the same specified metadata (SimpleBridgeKitty)

    • A mediator contract (HomeMediator). Sokol is called the home bridge. Only the mediator contract communicating with the AMB is allowed to mint a cat.

It is possible to deploy the contracts in the opposite direction as well (where KittyCore & ForeignMediator are deployed on Sokol & SimpleBridgeKitty & HomeMediator on Kovan). For demo purposes, we arbitrarily chose Kovan as the foreign network.

Getting Started

In the following example we deploy contracts enable test CryptoKitty creation. If you choose to deploy your own contracts, you can also create additional test cats using this instruction.

If you would like to try bridging without creating your own test cat, please contact us on Discord or the TokenBridge forum with your wallet address, and we will send you a kitty to play with 😻. With a test cat, you can start from step 4 below.

Example Instructions

  1. Use one of these methods to initiate and complete an NFT transfer between networks:

Additional Information

Example Contracts in the Kovan (foreign) testnet:

  • KittyCore: ERC721 Token Contract for CryptoKitties (approximate replica of original CryptoKitty contract). Includes all functions that create a Kitty with unique attributes including ID, ownership, and metadata.

  • ForeignMediator: Token management contract that confirms transaction correctness, locks/unlocks transferred Kitties, and sends requests to mint Kitties on Sokol side.

Example Contracts in the Sokol (home) testnet:

  • HomeMediator: Token management contract that confirms transaction accuracy, processes and sends token mint and burn requests, and sends requests to unlock cats on Kovan side.

  • SimpleBridgeKitty: Contract that creates a cat with identical attributes (id, ownership, & metadata) to the cat locked in the Kovan mediator contract. Cats can only be minted through a request from the Sokol mediator contract.

Contracts source:

Deployed AMB bridge contracts:

Last updated