This is a brief workflow of creating a Pawn Plan.
To add the Cyan's Pawn feature to your application, follow these few steps.
1. Get pricer data
Pawn pricer accepts a NFT collection address (address) and Id (tokenId) as an input and calculates the data. Also, the parameters are identical to those mentioned in the PAWN API requests.
const signer = provider.getSigner();
await signer.signMessage("Your sign message");
const calculatedData = await cyan.getPawnPrice(
"mainnet",
"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // NFT Collection address
"3758", // NFT Id
{
term: 2678400,
totalNumOfPayments: 3,
weight: 20,
wallet: await signer.getAddress()
}
);
const signer = provider.getSigner();
await signer.signMessage("Your sign message");
const calculatedData = await cyan.getPawnPrice(
"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // NFT Collection address
"3758", // NFT Id
{
term: 2678400,
totalNumOfPayments: 3,
weight: 33,
wallet: await signer.getAddress()
}
);
const signer = provider.getSigner();
await signer.signMessage("Your sign message");
const calculatedData = await cyan.getPawnPrice(
"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // NFT Collection address
"3758", // NFT Id
{
term: 86400,
totalNumOfPayments: 1,
weight: 50,
wallet: await signer.getAddress()
}
);
PawnType | Description |
---|---|
Normal - 20 | Normal means a 3-month loan period. User will post their NFT to Cyan, and in return receive a loan in the form of ETH. The 20 signifies the user borrows up to 20% of the appraised NFT value. In other words, they receive a 20% LTV against their NFT. |
Normal - 33 | Normal means a 3-month loan period. User will post their NFT to Cyan, and in return receive a loan in the form of ETH. The 33 signifies the user borrows up to 33.33% (1/3) of the appraised NFT value. In other words, they receive a 33.33% LTV against their NFT. |
Flash | Flash means a 24-hour loan period. User will post their NFT to Cyan, and in return receive a loan in the form of ETH. All Flash Pawn plans are 50% LTV, meaning the user will borrow 50% of the appraised value of the NFT. |
2. Get Approval
Before creating a Pawn Plan, getting Approval is required. This is done by calling the getApproval method.
const approval = await cyan.getApproval(
address, // NFT address
calculatedData // from getPawnPrice
);
Also it is possible to check approval has given to the current token by checkApproval method.
When your users initiate a deal on Cyan, they automatically agree to the Terms & Conditions of Cyan. We have an optional signable step you may elect to implement on your front end to make it clear to the user what happens if they miss a payment.
3. Create Pawn Plan
Finally, create a Pawn Plan with the data returned from the getPawnPrice method.
const desiredNftToPawn = calculatedData
const result = await cyan.createPawn(desiredNftToPawn);
4. Make a payment
To make the next payment in a created Pawn Plan, please follow the steps in Plans.