Parabol Partnership Program (createPartnership)
The createPartnership
method allows you to create a partnership within the Parabol protocol. This operation sets up a partner account with a specified vault address and fee structure.
Usage
import { ParabolAccount, SupportedChainIds } from "@parabolfi/core";
async function createParabolPartnership() {
const privateKey = "0x..."; // Your private key
const chainId = SupportedChainIds.ZKSYNC;
const account = await ParabolAccount.fromPrivateKey({
privateKey,
chainId,
});
const partnerVault = "0x..."; // Partner vault address
const partnerFeeBPS = 100n; // Partner fee in basis points (1% = 100)
try {
const partnerId = await account.createPartnership(
partnerVault,
partnerFeeBPS
);
console.log("Partnership created with partnerId:", partnerId);
} catch (error) {
console.error("Error creating partnership:", error);
}
}
Parameters
partnerVault
:Address
- The address of the partner vault where fees will be collected.partnerFeeBPS
:bigint
- The partner fee in basis points (BPS). 100 BPS = 1%.
Returns
bytes32
- A promise that resolves to the partnerId.
Important Notes
- The partner vault address must be a valid Ethereum address.
- The partner fee BPS must be a non-negative integer, typically not exceeding 10000 (100%).
- You can then use your partnerId in the configuration of your
partnerConfig
to collect fees.
The usage of partnerId
and partnerFeeBPS
parameters will vary depending on
how you interact with Parabol. If you’re interacting with ParabolAccount
,
simply defining the partnerConfig
information in the instance will suffice.
If you’re enabling your users to perform lend operations via Calldata, please
visit Calldata Utilities. If you’re interacting through
a web-based app, you can directly define them within the LendParams
of the
lend
or permitLend
functions. Note: Our React-supported SDK will be
launched soon!
Related Structure
struct LendParams {
address beneficiary;
bytes32 partnerId;
uint256 partnerFeeBPS;
uint256 principal;
}
Errors
This method may throw a ParabolSDKError
in the following cases:
- If the partner vault address is invalid.
- If the partner fee BPS is out of the acceptable range.
- If the transaction fails for any reason (e.g., network issues, insufficient gas).
Always wrap the call in a try-catch block to handle potential errors.
Related Methods
getPartnerConfigById
: Retrieve partnership information by partner ID.getPartnerConfigByOwner
: Retrieve partnership information by owner address.