smart-chain-fr / tokenomia

Tokenomia is built for the Cardashift ICO, it aims to simplify the use of Native Tokens and Smart Contracts above the Cardano Platform. Cardashift is a community-driven startup platform that raises funds, builds and accelerates startups that solve social and environmental problems.
Apache License 2.0
77 stars 27 forks source link

Mlabs: Airdrop + database input file generation #68

Open samuelWilliams99 opened 2 years ago

samuelWilliams99 commented 2 years ago

Following the Sendings module created to verify Sendings onchain, this task is to generate the input files for the airdrop and database from the PrivateSale type defined below:

type Amount = Natural

-- Invariants
-- Σ percentages = 100%
-- Description : Represent Vesting Tranches (Time Sequential and contiguous)
newtype Tranches = Tranches (NonEmpty Tranche)

data Tranche 
  = Tranche
    { percentage :: Integer -- out of 10,000
    , duration :: Integer -- number of slots
    }

data PrivateSale
  = PrivateSale
    { start :: POSIXTime
    , tranches :: Tranches
    , assetClass :: AssetClass
    , investors :: NonEmpty PrivateInvestor
    }

data PrivateInvestor
  = PrivateInvestor
    { address :: Address
    , allocation :: Amount
    }

This task is the following:

Create your branch and PR from mlabs/private-sale-staging

Luis-omega commented 2 years ago

Should I be worried about the sequence of PrivateInvestors ?

For example, if we have :

[PrivateInvestor 2 23 , PrivateInvestor 3 14 , PrivateInvestor 2 99]

With the described approach the PrivateInvestor with address 2 would pay its part for every currency of it in the list, is this intended or should I reject such a list? If this is intended, should I merge all the occurrences or just leave them as is (this would impact the Airdrop table output)?

samuelWilliams99 commented 2 years ago

Let's merge, probably as a first pass to have them unique by address. You could even convert it to a Map Address Amount to be correct at a type level.