hey icon indicating copy to clipboard operation
hey copied to clipboard

Support "Pay What You Want" Collects

Open iPaulPro opened this issue 10 months ago • 15 comments

Summary

I have created a new type of Collect Module that allows users to "pay what you want". This affords collectors the ability to use any denomination of any ERC-20 token to collect a publication.

Mainnet: 0x7fbD7496CaE2DAcad7a62350DA8488E31eC026eA

Testnet: 0x3d06AA6ca4FC7eE0D5581B85CB52CA7714175e43

Notes

  • This is a Collect Module, NOT a standalone Open Action Module. It is meant to be used with the core CollectPublicationAction module.
  • The publication author can optionally specify a desired currency and price floor.

Implement

The init calldata is almost identical to MultirecipientFeeCollectModule :

[
  { type: "uint160", name: "amountFloor" },
  { type: "uint96", name: "collectLimit" },
  { type: "address", name: "currency" },
  { type: "uint16", name: "referralFee" },
  { type: "bool", name: "followerOnly" },
  { type: "uint72", name: "endTimestamp" },
  {
    type: "tuple(address,uint16)[5]",
    name: "recipients",
    components: [
      { type: "address", name: "recipient" },
      { type: "uint16", name: "split" },
    ],
  },
]

and the process calldata:

[
  { type: "address", name: "currency" },
  { type: "uint256", name: "amount" },
]

CollectPublicationAction

This Collect Module is registered with the CollectPublicationAction (the same module used with SimpleFeeCollectModule and MultirecipientFeeCollectModule). The init calldata is just the Collect Module address and the encoded collect init calldata (above):

[
    { type: 'address', name: 'collectModule' },
    { type: 'bytes', name: 'collectModuleInitData' },
]

And to process:

[
  { type: "address", name: "collectNftRecipient" },
  { type: "bytes", name: "collectData" },
]

Testnet

I have completed a successful act call with the PWYW module: https://amoy.polygonscan.com/tx/0xceff77ea12000814d07d3e8bc2b0218ae6ff91e286a08d91872e97b817f4a259

iPaulPro avatar Apr 24 '24 10:04 iPaulPro