Deploy Wrapper
Learn how to deploy the CrossChainVRFWrapper contract to handle cross-chain VRF requests.
Once you have set up your Chainlink VRF subscription and have your LINK tokens ready, the next step is to deploy the CrossChainVRFWrapper contract. This contract will act as the bridge between your unsupported L1 and the Chainlink VRF network on a supported L1, enabling cross-chain requests for random words.
Prerequisites
Before deployment, make sure you have:
- A valid Chainlink VRF Subscription ID (see previous section for details).
- The
TeleporterMessenger
contract address on your supported L1 (e.g., Avalanche Fuji).
Deploy the Contract
Using the forge create
command, deploy the CrossChainVRFWrapper
contract to the supported L1 (e.g., Avalanche Fuji).
Replace the following:
<RPC_URL>
: The RPC URL for the L1.<PRIVATE_KEY>
: The private key for the account used to deploy the contract.<TELEPORTER_MESSENGER_ADDRESS>
: The address of the deployedTeleporterMessenger
contract.
After deployment, save the Deployed to
address in an environment variable for future use.
Verify the Deployment
After deploying the contract, verify that the CrossChainVRFWrapper
has been successfully deployed by checking its address on a block explorer.
Configure Authorized Subscriptions
Once deployed, the CrossChainVRFWrapper
contract needs to be configured with authorized subscriptions to process requests for random words.
- Call the
addAuthorizedAddress
function to authorize a specific address with a given subscription ID. - This ensures that only authorized addresses can request random words via the wrapper.
Replace the following:
<CALLER_ADDRESS>
: The address that will be authorized to request random words.<SUBSCRIPTION_ID>
: The ID of your Chainlink VRF subscription.