1 |
# Launchpad v1.0 without MOBGOV features |
2 |
# Token Creator creates a token and puts amount of token up for sale. |
3 |
# He will need to set a token contract, start, end time, hardcap, tokens for sale and maximum buy. |
4 |
# People can invest TAU |
5 |
# If end time reached and softcap reached - Make tokens available to claim |
6 |
# If hardcap reached - Make tokens available to claim |
7 |
# If endtime reached and softcap not reached - Refund TAU, Refund Tokens to Creator |
8 |
# |
9 |
# |
10 |
|
11 |
I = importlib |
12 |
random.seed() # To generate somewhat unique token sale id |
13 |
|
14 |
token_sales = Hash(default_value=0) |
15 |
investments = Hash(default_value=0) |
16 |
|
17 |
sales = Variable() # IDs of all sales for listing on website |
18 |
|
19 |
end_fee = Variable() # Only if sale is successful then fee of raised money |
20 |
operator = Variable() # DEV can help while the sale is running if its a scam or something |
21 |
|
22 |
|
23 |
@construct |
24 |
def seed(): |
25 |
end_fee.set(5) |
26 |
operator.set( |
27 |
"ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89") |
28 |
sales.set("") |
29 |
|
30 |
|
31 |
@export |
32 |
def create_sale(start_date_day: int, start_date_month: int, start_date_year: int, start_date_hour: int, start_date_minute: int, softcap: float, hardcap: float, max_buy: float, tokens_for_sale: float, token_contract: str, end_date_day: int, end_date_month: int, end_date_year: int, end_date_hour: int, end_date_minute: int): |
33 |
token_sale_id = random.randint(0, 100000000) |
34 |
if(token_sale_id not in sales.get().split(',')): |
35 |
I.import_module(token_contract).transfer_from( |
36 |
main_account=ctx.caller, |
37 |
amount=tokens_for_sale, |
38 |
to=ctx.this) |
39 |
token_sales[token_sale_id] = {"start_date": datetime.datetime(start_date_year, start_date_month, start_date_day, start_date_hour, start_date_minute), "end_date": datetime.datetime( |
40 |
end_date_year, end_date_month, end_date_day, end_date_hour, end_date_minute), "softcap": softcap, "hardcap": hardcap, "max_buy": max_buy, "raised": 0, "tokens_for_sale": tokens_for_sale, "token_contract": token_contract, "seller": ctx.caller} |
41 |
sales.set(sales.get() + "," + token_sale_id) |
42 |
return "Try again" |
43 |
|
e30000000000000000000000001100000040000000738a00000065005a0165026a0383000100650464006401640264038d035a05650464006401640464038d035a0665076401640564068d025a0865076401640764068d025a0965076401640864068d025a0a6409640a84005a0b650c64018301650d650d650d650d650d650e650e650e650e650f650d650d650d650d650d640b9c0f640c640d840483015a10640e5300290fe900000000da0f636f6e5f6c61756e63687061645f30da0b746f6b656e5f73616c65732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da0b696e766573746d656e7473da0573616c6573290272050000007206000000da07656e645f666565da086f70657261746f72630000000000000000000000000200000043000000732200000074006a0164018301010074026a0164028301010074036a016403830101006400530029044ee905000000da4066663631353434656139346561616562356466303865643836336334613933386539313239616261366365656535663331623636383162646564653131623839da002904da095f5f656e645f666565da03736574da0a5f5f6f70657261746f72da075f5f73616c6573a90072120000007212000000720d000000da045f5f5f5f0c000000730800000000010a01040106017213000000290fda0e73746172745f646174655f646179da1073746172745f646174655f6d6f6e7468da0f73746172745f646174655f79656172da0f73746172745f646174655f686f7572da1173746172745f646174655f6d696e757465da07736f6674636170da0768617264636170da076d61785f627579da0f746f6b656e735f666f725f73616c65da0e746f6b656e5f636f6e7472616374da0c656e645f646174655f646179da0e656e645f646174655f6d6f6e7468da0d656e645f646174655f79656172da0d656e645f646174655f686f7572da0f656e645f646174655f6d696e757465630f00000000000000100000000a00000043000000738c00000074006a016401640283027d0f7c0f74026a0383006a04640383016b07728874056a067c0983016a0774086a097c0874086a0a64048d030100740b6a0b7c027c017c007c037c048305740b6a0b7c0c7c0b7c0a7c0d7c0e83057c057c067c0764017c087c0974086a0964059c09740c7c0f3c0074026a0d74026a038300640317007c0f1700830101006406530029074e72010000006900e1f505fa012c2903da0c6d61696e5f6163636f756e74da06616d6f756e74da02746f2909da0a73746172745f64617465da08656e645f646174657219000000721a000000721b000000da06726169736564721c000000721d000000da0673656c6c65727a0954727920616761696e290eda0672616e646f6dda0772616e64696e747211000000da03676574da0573706c6974da0149da0d696d706f72745f6d6f64756c65da0d7472616e736665725f66726f6dda03637478da0663616c6c6572da0474686973da086461746574696d65da0d5f5f746f6b656e5f73616c6573720f0000002910721400000072150000007216000000721700000072180000007219000000721a000000721b000000721c000000721d000000721e000000721f000000722000000072210000007222000000da0d746f6b656e5f73616c655f696472120000007212000000720d000000da0b6372656174655f73616c6513000000731c00000000060c0112010e010c01040106010a0106010801060104010e01160172380000004e2911da09696d706f72746c6962722f000000722b000000da0473656564da04486173687236000000da0d5f5f696e766573746d656e7473da085661726961626c657211000000720e00000072100000007213000000da085f5f6578706f7274da03696e74da05666c6f6174da037374727238000000721200000072120000007212000000720d000000da083c6d6f64756c653e01000000731e0000000401080106010801060108010c010c010c03080706010401080106010801