As the interaction is directly on-chain, this is not an endpoint. Steps to create a PAWN plan are detailed below!

📘

For the best experience, please refer to the SDK documentation. You'll be able to install our library and get started in not only creating PAWN plans but interacting with the Cyan Protocol as well.

🚧

Prior to creating a PAWN Plan, the user must grant Cyan the approval to move the NFT. To receive the user's approval, please call the approve function of the NFT or when using the SDK, just call the Get Approval method.

In order to create a new PAWN Plan, call the createPAWNPaymentPlan function from the smart contract with data retrieved from the endpoint Retrieve a calculated PAWN plan

📘

  • The PaymentPlan contract is available on Etherscan.
  • Cyan ABI is available on: Github

createPAWNPaymentPlan function accepts the following parameters:

FieldsDescription
wNFTContractCyan Wrapper address of the collection
wNFTTokenIdNFT id
amountBorrowed amount of ETH (BigNumber) for Pawning
interestRateInterest rate by pricer calculation
signedBlockNumLast block number
termInterval between payments
serviceFeeRateFee rate of the service.
totalNumberOfPaymentsTotal number of payments to be made
signatureSignature created and provided by Cyan

Example:

const signer = this.provider.getSigner();
const appraisal = { .... } // from Retrieve calculated Pawn plan

const contract = new Contract(
      paymentContractAddress, // Cyan payment contract address
      abi // Cyan ABI
      signer // signer from Web3
);

const transaction = await contract.createPAWNPaymentPlan(
      appraisal.wrapperAddress,
      appraisal.tokenId,
      appraisal.unlockAmount,
      appraisal.interestRate,
      appraisal.lastBlockNum,
      appraisal.term,
      appraisal.serviceFeeRate,
      appraisal.totalNumOfPayments,
      appraisal.signature
);