App Data¶
In this section we will cover the AppCode functionality of the cowdao_cowpy
library.
App data is used for a number of purposes, including:
- Order Metadata: Encoding metadata for orders, such as the app that created the order.
- Partner Fees: Specifying partner fees for orders, which can be used to incentivize partners or solvers.
- Referrals: Including referral information in orders to track referrals and provide rewards.
- Custom Data: Adding custom data to orders for various purposes, such as tracking or analytics.
Once app data has been created, it must be submitted to the CoW Protocol's Services for each chain that the AppData is intended to be used on.
We provide a convenient method to both create and submit app data to the CoW Protocol's Services.
from cowdao_cowpy.app_data.utils import PartnerFee, build_all_app_codes
app_code = "exampleAppCode"
referrer_address = "0x..."
partner_fee_address = "0x..."
partner_fee = PartnerFee(bps=1, recipient=partner_fee_address)
env = "prod"
graffiti = "exampleGraffiti"
app_data_hash = build_all_app_codes(
env=env,
app_code=app_code,
referrer_address=referrer_address,
partner_fee=partner_fee,
graffiti=graffiti,
)
print("App data hash:", app_data_hash)
Variable Name | Description |
---|---|
app_code |
The code of the application that is creating the order. This is used to identify the application in the CoW Protocol. |
referrer_address |
The address of the referrer. This is used to track referrals and provide rewards. |
partner_fee_address |
The address of the partner fee recipient. This is used to specify the recipient of the partner fee. |
partner_fee |
An instance of PartnerFee that specifies the basis points (bps) and recipient address for the partner fee. This is used to incentivize partners or solvers. |
env |
The environment in which the app data is being created. This can be "prod" for production or "test" for testing. It determines the network and subgraph URL used for the app data. |
graffiti |
A string that can be used to include additional information or metadata in the app data. This can be useful for tracking or analytics purposes. |
app_data_hash |
The hash of the app data that is created by the build_all_app_codes function. This hash can be used in orders to reference the app data. It is a unique identifier for the app data and is used to identify the app data in the CoW Protocol. |
This code snippet demonstrates how to create app data for the CoW Protocol. The build_all_app_codes
function constructs the app data hash, which can then be used in your orders.