Skip to content

Instantly share code, notes, and snippets.

@Dobrokhvalov
Last active November 4, 2019 07:36
Show Gist options
  • Save Dobrokhvalov/54ba59d1f065ad8fe67ae964a1a1c37b to your computer and use it in GitHub Desktop.
Save Dobrokhvalov/54ba59d1f065ad8fe67ae964a1a1c37b to your computer and use it in GitHub Desktop.

Linkdrop V2 Spec

To unify all linkdrop types (campaigns, p2p, modules, on-ramps) we need common interface.
This will allow to utilize the same claim code (claim web apps, API, SDK, URI) for all kinds of the linkdrops,
reducing the need to repeat ourselves again and again.

The idea is to allow different ways to generate linkdrops (dashboard, sdk, wallets), but interoperable way to claim all kind of linkdrops.

Linkdrop Escrow Contract Interface:

interface Ilinkdrop { 
    
    // common functions
    function isClaimedLink(address _linkId) external view returns (bool);
    function isCanceledLink(address _linkId) external view returns (bool);
    function cancel(address _linkId) external  returns (bool);
    function withdraw() external returns (bool);
    function addSigner(address _linkdropSigner) external payable returns (bool);
    function removeSigner(address _linkdropSigner) external returns (bool);
    
    
    // claim fungible tokens / eth
    function claim
    (
        uint _weiAmount,
        address _tokenAddress,
        uint _tokenAmount,
        uint _expiration,
        address _linkId,
        bytes calldata _signerSignature,
        address payable _receiver,
        bytes calldata _receiverSignature,
        address payable _feeReceiver,
        uint _feeAmount,
        uint _feeToken
    )
    external returns (bool);
}

API endpoints

POST /linkdrops/claim
Params:

  • linkdropContract
  • weiAmount
  • tokenAmount
  • expiration
  • linkId
  • signerSig
  • receiver
  • receiverSig
  • feeReceiver
  • feeAmount
  • feeToken
  • chainId
  • version

URI

/#/receive?weiAmount=10000000000&tokenAddress=0x0000000000000000000000000000000000000000&tokenAmount=0&expirationTime=1900000000000&chainId=100&linkKey=0x3a0c6e592f65a9172fb5928aa487e79dd6c9e2a8a3f731e302aa32260273ff63&linkdropSignerSignature=0x123210c51ced0d2070bba72e1d1df620d342a620a4f29a65a3a5809a4190eba80d4491aff3003f01be65c0fa414a55e6ba2f7a44ed1e5232e9f06cb7947d72dc1b&linkdropContract=0x0000000000000000000000000000000000000111

Changes V1 -> V2

Renaming

  • LinkdropMasterAddress -> sender
  • linkdropSignerSignature -> signerSignature

URI

  • Remove campaignId from the URI, use direct linkdrop address instead

Common claim flow

  • Sender generates a link and deploys Linkdrop Contract if needed
  • Sender registers the link with relayer
  • Sender shares the link with Receiver
  • Receiver's browser grabs ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment