Contract con_neversell


Contract Code


  
1 # LST001
2 balances = Hash(default_value=0)
3
4 # LST002
5 metadata = Hash()
6
7 contract = Variable()
8
9 @construct
10 def seed(supply=5_000_000_000, con_name='con_rocketswap_official_v1_1'):
11 # LST001 - MINT SUPPLY to wallet that submits the contract
12 balances[ctx.caller] = supply
13
14 # LST002
15 metadata['token_name'] = "NEVERSELL (50% SELL TAX)"
16 metadata['token_symbol'] = "NVR"
17 metadata['operator'] = ctx.caller
18
19 contract.set(con_name)
20
21 # LST002
22 @export
23 def change_metadata(key: str, value: Any):
24 assert ctx.caller == metadata['operator'], 'Only operator can set metadata!'
25 metadata[key] = value
26
27 # LST001
28 @export
29 def transfer(amount: float, to: str):
30 assert amount > 0, 'Cannot send negative balances!'
31 assert balances[ctx.caller] >= amount, 'Not enough coins to send!'
32
33 balances[ctx.caller] -= amount
34
35 if to == contract.get():
36 balances[to] += (amount / 2)
37 else:
38 balances[to] += amount
39
40 # LST001
41 @export
42 def approve(amount: float, to: str):
43 assert amount > 0, 'Cannot send negative balances!'
44 balances[ctx.caller, to] += amount
45
46 # LST001
47 @export
48 def transfer_from(amount: float, to: str, main_account: str):
49 assert amount > 0, 'Cannot send negative balances!'
50 assert balances[
51 main_account, ctx.caller] >= amount, 'Not enough coins approved to send! You have {} and are trying to spend {}' \
52 .format(balances[main_account, ctx.caller], amount)
53 assert balances[main_account] >= amount, 'Not enough coins to send!'
54
55 balances[main_account, ctx.caller] -= amount
56 balances[main_account] -= amount
57
58 if to == contract.get():
59 balances[to] += (amount / 2)
60 else:
61 balances[to] += amount

Byte Code

e300000000000000000000000005000000400000007396000000650064006401640264038d035a0165006401640464058d025a0265036401640664058d025a0464176409640a84015a0565066401830165076508640b9c02640c640d840483015a09650664018301650a6507640e9c02640f6410840483015a0b650664018301650a6507640e9c0264116412840483015a0c650664018301650a6507650764139c0364146415840483015a0d641653002918e900000000da0d636f6e5f6e6576657273656c6cda0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da086d657461646174612902720500000072060000007205000000ec0300000000720b540400da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f3163020000000000000002000000030000004300000073320000007c00740074016a023c006401740364023c006403740364043c0074016a02740364053c0074046a057c01830101006400530029064e7a184e4556455253454c4c20283530252053454c4c2054415829da0a746f6b656e5f6e616d65da034e5652da0c746f6b656e5f73796d626f6cda086f70657261746f722906da0a5f5f62616c616e636573da03637478da0663616c6c6572da0a5f5f6d65746164617461da0a5f5f636f6e7472616374da037365742902da06737570706c79da08636f6e5f6e616d65a9007216000000da00da045f5f5f5f06000000730a00000000010a01080108010a0172180000002902da036b6579da0576616c7565630200000000000000020000000300000043000000732200000074006a017402640119006b02731674036402830182017c0174027c003c006400530029034e720d0000007a1f4f6e6c79206f70657261746f722063616e20736574206d65746164617461212904720f00000072100000007211000000da0e417373657274696f6e4572726f7229027219000000721a000000721600000072160000007217000000da0f6368616e67655f6d657461646174610e0000007306000000000210010601721c0000002902da06616d6f756e74da02746f630200000000000000020000000500000043000000736e0000007c0064016b0473107400640283018201740174026a0319007c006b0573267400640383018201740174026a03050019007c00380003003c007c0174046a0583006b02725a74017c01050019007c0064041b00370003003c006e1074017c01050019007c00370003003c006400530029054e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e6421e9020000002906721b000000720e000000720f00000072100000007212000000da036765742902721d000000721e000000721600000072160000007217000000da087472616e7366657215000000730c00000000021001160112010c0116027221000000630200000000000000020000000400000043000000732a0000007c0064016b0473107400640283018201740174026a037c016602050019007c00370003003c006400530029034e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573212904721b000000720e000000720f00000072100000002902721d000000721e000000721600000072160000007217000000da07617070726f76652000000073040000000002100172220000002903721d000000721e000000da0c6d61696e5f6163636f756e7463030000000000000003000000050000004300000073ac0000007c0064016b047310740064028301820174017c0274026a03660219007c006b05733c740064036a0474017c0274026a03660219007c0083028301820174017c0219007c006b057350740064048301820174017c0274026a036602050019007c00380003003c0074017c02050019007c00380003003c007c0174056a0683006b02729874017c01050019007c0064051b00370003003c006e1074017c01050019007c00370003003c006400530029064e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a494e6f7420656e6f75676820636f696e7320617070726f76656420746f2073656e642120596f752068617665207b7d20616e642061726520747279696e6720746f207370656e64207b7d7a194e6f7420656e6f75676820636f696e7320746f2073656e6421721f0000002907721b000000720e000000720f0000007210000000da06666f726d6174721200000072200000002903721d000000721e0000007223000000721600000072160000007217000000da0d7472616e736665725f66726f6d260000007314000000000210010c010c0114011401160110010c01160272250000004e290272080000007209000000290eda0448617368720e0000007211000000da085661726961626c6572120000007218000000da085f5f6578706f7274da03737472da03416e79721c000000da05666c6f61747221000000722200000072250000007216000000721600000072160000007217000000da083c6d6f64756c653e0100000073160000000e010c010c030a08060112060601120a060112050601