Transaction #1225

Hash 63a99640f90447c7c5547e9e489c87771ae5107a3848327243bb9dc7a45d7c33
Status Success
Timestamp 803 days ago - 9/25/2020, 1:01:20 PM UTC+0
Block 1187
Stamps Used 371
Burned Fee 0.03710000 TAU
From 4a035ff604ffb0a44e5235e2fed8f69666b6df6ff11cbfa347d154d1a5453bba 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 1
Nonce 6
Processor a2ce0217d08e0cf5718d36fc3b7b59d7bb5e4c6e3140a04e02da1d28a6fea56f
Signature 9d998646e27d7f16b76c1f4909f366875633afbbe103497cdc0451c8eaff70923b89e3e29ea89e64995e19aac939911f4ece03a78878178416b1414edc63dc0a
Stamps Supplied 1000
Stamps per TAU 100

Kwargs

code # This is an experiment in creating a completely decentralized system with no premine and no genesis blocks, as well as no upfront cost requirement. This only thing you need to mine coins with on this contract is gas. # This experiment also includes a built in AMM # This experiment is completely unaudited and likely bug-ridden. tokenName = "mintedTAU" import currency S = Hash(default_value=0) approved = Hash(default_value=0) liquidityTokenBalance = Hash(default_value=0) lastBlockMined = Hash(default_value=0) totalMined = block_num totalLiquidityTokens = 100 @export def mine(): assert block_num > (lastBlockMined + 100) # Maximum 1 TX per 100 blocks miner = ctx.caller amount = (block_num - totalMined) / 100 # Transfer 1% of the pool to the "miner" address totalMined += amount S[miner] += amount @export def approve(amount: float, to: str): assert amount > 0, 'Cannot approve negative balance' sender = ctx.caller approved[sender, to] += amount @export def transfer_from(amount: float, to: str, fromAddress: str): assert amount > 0, 'Cannot send negative balance' sender = ctx.caller assert approved[fromAddress, sender] >= amount, 'Transfer amount exceeds approved balance' assert S[fromAddress] >= amount, 'Transfer amount exceeds available balance' approved[fromAddress, sender] -= amount S[fromAddress] -= amount S[to] += amount @export def transfer(amount: int, receiver: str): assert amount > 0, 'Cannot send negative balance' sender = ctx.caller balance = S[sender] assert balance >= amount, "Transfer amount exceeds available balance" S[sender] -= amount S[receiver] += amount @export def tradeTAUForToken(amount: int, fromAddress: str): assert amount > 0, 'Cannot send negative balance' currency.transfer_from(amount, ctx.this, fromAddress) inputReserve = currency.balance_of(ctx.this) outputReserve = S[ctx.this] assert input_reserve > 0 and output_reserve > 0 numerator = amount * outputReserve denominator = (inputReserve * 1000) + amount amount = numerator / denominator S[ctx.this] -= amount S[fromAddress] += amount @export def tradeTokenForTAU(amount: int, fromAddress: str): assert amount > 0, 'Cannot send negative balance' assert S[fromAddress] >= amount inputReserve = S[ctx.this] outputReserve = currency.balance_of(ctx.this) assert input_reserve > 0 and output_reserve > 0 numerator = amount * outputReserve denominator = (inputReserve * 1000) + amount amount = numerator / denominator S[fromAddress] -= amount S[ctx.this] += amount currency.transfer(amount, fromAddress) @export def addLiquidity(amountInTAU:int): assert amountInTAU > 0, 'Cannot add negative liquidity' assert S[ctx.caller] >= amountInTau * S[ctx.this] / currency.balance_of(ctx.this) tokenReserve = S[ctx.this] TAUReserve = currency.balance_of(ctx.this) currency.transfer_from(amountInTau, ctx.this, ctx.caller) S[ctx.caller] -= (amountInTau * S[ctx.this] / currency.balance_of(ctx.this)) assert S[ctx.caller] >= 0 tokenWorthInTAU = TAUReserve / totalLiquidityTokens tokenAmount = amountInTAU / tokenWorthInTAU liquidityTokenBalance[ctx.caller] += tokenAmount totalLiquidityTokens += tokenAmount return tokenAmount @export def removeLiquidity(amount:int): assert amountInTAU > 0, 'Cannot add negative liquidity' assert totalLiquidityTokens > 0 assert liquidityTokenBalance > 0 liquidityTokenBalance[ctx.caller] -= amount totalLiquidityTokens -= amount send(msg.sender, eth_amount) percentOfPool = amount / totalLiquidityTokens tokenPayout = S[ctx.this] * percentOfPool TAUPayout = currency.balance_of(ctx.this) * percentOfPool currency.transfer(TAUPayout, ctx.caller) S[ctx.this] -= tokenPayout S[ctx.caller] += tokenPayout return TAUPayout, tokenPayout @export def transferLiquidityToken(amount: int, receiver: str): assert amount > 0, 'Cannot send negative balance' sender = ctx.caller balance = liquidityTokenBalance[sender] assert balance >= amount, "Transfer amount exceeds available balance" liquidityTokenBalance[sender] -= amount liquidityTokenBalance[receiver] += amount @export def allowance(owner: str, spender: str): return approved[owner, spender] @export def liquidityRatio(): tokenReserve = S[ctx.this] TAUReserve = currency.balance_of(ctx.this) return TAUReserve / tokenReserve
name con_mint

State Changes

Contract con_mint
Variable __code__
New Value tokenName = 'mintedTAU' import currency __S = Hash(default_value=0, contract='con_mint', name='S') __approved = Hash(default_value=0, contract='con_mint', name='approved') __liquidityTokenBalance = Hash(default_value=0, contract='con_mint', name= 'liquidityTokenBalance') __lastBlockMined = Hash(default_value=0, contract='con_mint', name= 'lastBlockMined') totalMined = block_num totalLiquidityTokens = 100 @__export('con_mint') def mine(): assert block_num > __lastBlockMined + 100 miner = ctx.caller amount = (block_num - totalMined) / 100 totalMined += amount __S[miner] += amount @__export('con_mint') def approve(amount: float, to: str): assert amount > 0, 'Cannot approve negative balance' sender = ctx.caller __approved[sender, to] += amount @__export('con_mint') def transfer_from(amount: float, to: str, fromAddress: str): assert amount > 0, 'Cannot send negative balance' sender = ctx.caller assert __approved[fromAddress, sender ] >= amount, 'Transfer amount exceeds approved balance' assert __S[fromAddress ] >= amount, 'Transfer amount exceeds available balance' __approved[fromAddress, sender] -= amount __S[fromAddress] -= amount __S[to] += amount @__export('con_mint') def transfer(amount: int, receiver: str): assert amount > 0, 'Cannot send negative balance' sender = ctx.caller balance = __S[sender] assert balance >= amount, 'Transfer amount exceeds available balance' __S[sender] -= amount __S[receiver] += amount @__export('con_mint') def tradeTAUForToken(amount: int, fromAddress: str): assert amount > 0, 'Cannot send negative balance' currency.transfer_from(amount, ctx.this, fromAddress) inputReserve = currency.balance_of(ctx.this) outputReserve = __S[ctx.this] assert input_reserve > 0 and output_reserve > 0 numerator = amount * outputReserve denominator = inputReserve * 1000 + amount amount = numerator / denominator __S[ctx.this] -= amount __S[fromAddress] += amount @__export('con_mint') def tradeTokenForTAU(amount: int, fromAddress: str): assert amount > 0, 'Cannot send negative balance' assert __S[fromAddress] >= amount inputReserve = __S[ctx.this] outputReserve = currency.balance_of(ctx.this) assert input_reserve > 0 and output_reserve > 0 numerator = amount * outputReserve denominator = inputReserve * 1000 + amount amount = numerator / denominator __S[fromAddress] -= amount __S[ctx.this] += amount currency.transfer(amount, fromAddress) @__export('con_mint') def addLiquidity(amountInTAU: int): assert amountInTAU > 0, 'Cannot add negative liquidity' assert __S[ctx.caller] >= amountInTau * __S[ctx.this ] / currency.balance_of(ctx.this) tokenReserve = __S[ctx.this] TAUReserve = currency.balance_of(ctx.this) currency.transfer_from(amountInTau, ctx.this, ctx.caller) __S[ctx.caller] -= amountInTau * __S[ctx.this] / currency.balance_of(ctx .this) assert __S[ctx.caller] >= 0 tokenWorthInTAU = TAUReserve / totalLiquidityTokens tokenAmount = amountInTAU / tokenWorthInTAU __liquidityTokenBalance[ctx.caller] += tokenAmount totalLiquidityTokens += tokenAmount return tokenAmount @__export('con_mint') def removeLiquidity(amount: int): assert amountInTAU > 0, 'Cannot add negative liquidity' assert totalLiquidityTokens > 0 assert __liquidityTokenBalance > 0 __liquidityTokenBalance[ctx.caller] -= amount totalLiquidityTokens -= amount send(msg.sender, eth_amount) percentOfPool = amount / totalLiquidityTokens tokenPayout = __S[ctx.this] * percentOfPool TAUPayout = currency.balance_of(ctx.this) * percentOfPool currency.transfer(TAUPayout, ctx.caller) __S[ctx.this] -= tokenPayout __S[ctx.caller] += tokenPayout return TAUPayout, tokenPayout @__export('con_mint') def transferLiquidityToken(amount: int, receiver: str): assert amount > 0, 'Cannot send negative balance' sender = ctx.caller balance = __liquidityTokenBalance[sender] assert balance >= amount, 'Transfer amount exceeds available balance' __liquidityTokenBalance[sender] -= amount __liquidityTokenBalance[receiver] += amount @__export('con_mint') def allowance(owner: str, spender: str): return __approved[owner, spender] @__export('con_mint') def liquidityRatio(): tokenReserve = __S[ctx.this] TAUReserve = currency.balance_of(ctx.this) return TAUReserve / tokenReserve
 
Contract con_mint
Variable __compiled__
New Value e30000000000000000000000000500000040000000734601000064005a00640164026c015a01650264016403640464058d035a03650264016403640664058d035a04650264016403640764058d035a05650264016403640864058d035a0665075a0864095a09650a64038301640a640b840083015a0b650a64038301650c650d640c9c02640d640e840483015a0e650a64038301650c650d650d640f9c0364106411840483015a0f650a640383016510650d64129c0264136414840483015a11650a640383016510650d64159c0264166417840483015a12650a640383016510650d64159c0264186419840483015a13650a640383016510641a9c01641b641c840483015a14650a640383016510641d9c01641e641f840483015a15650a640383016510650d64129c0264206421840483015a16650a64038301650d650d64229c0264236424840483015a17650a6403830164256426840083015a18640253002927da096d696e746564544155e9000000004eda08636f6e5f6d696e74da01532903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da08617070726f766564da156c6971756964697479546f6b656e42616c616e6365da0e6c617374426c6f636b4d696e6564e964000000630000000000000000030000000400000043000000733e00000074007401640117006b0473107402820174036a047d0074007c01180064011b007d027c017c0237007d0174057c00050019007c02370003003c006400530029024e720b0000002906da09626c6f636b5f6e756dda105f5f6c617374426c6f636b4d696e6564da0e417373657274696f6e4572726f72da03637478da0663616c6c6572da035f5f532903da056d696e6572da0a746f74616c4d696e6564da06616d6f756e74a9007215000000da00da046d696e650d000000730a0000000002100106010c010801721700000029027214000000da02746f630200000000000000030000000400000043000000732e0000007c0064016b047310740064028301820174016a027d0274037c027c016602050019007c00370003003c006400530029034e72020000007a1f43616e6e6f7420617070726f7665206e656761746976652062616c616e63652904720e000000720f0000007210000000da0a5f5f617070726f766564290372140000007218000000da0673656e646572721500000072150000007216000000da07617070726f7665160000007306000000000210010601721b000000290372140000007218000000da0b66726f6d41646472657373630300000000000000040000000400000043000000737a0000007c0064016b047310740064028301820174016a027d0374037c027c03660219007c006b05732e740064038301820174047c0219007c006b057342740064048301820174037c027c036602050019007c00380003003c0074047c02050019007c00380003003c0074047c01050019007c00370003003c006400530029054e72020000007a1c43616e6e6f742073656e64206e656761746976652062616c616e63657a285472616e7366657220616d6f756e74206578636565647320617070726f7665642062616c616e63657a295472616e7366657220616d6f756e74206578636565647320617661696c61626c652062616c616e63652905720e000000720f000000721000000072190000007211000000290472140000007218000000721c000000721a000000721500000072150000007216000000da0d7472616e736665725f66726f6d1d00000073120000000002100106010a010e0106010e0114011001721d00000029027214000000da08726563656976657263020000000000000004000000040000004300000073520000007c0064016b047310740064028301820174016a027d0274037c0219007d037c037c006b05732e740064038301820174037c02050019007c00380003003c0074037c01050019007c00370003003c006400530029044e72020000007a1c43616e6e6f742073656e64206e656761746976652062616c616e63657a295472616e7366657220616d6f756e74206578636565647320617661696c61626c652062616c616e63652904720e000000720f0000007210000000721100000029047214000000721e000000721a000000da0762616c616e6365721500000072150000007216000000da087472616e736665722a000000730c000000000210010601080110011001722000000029027214000000721c000000630200000000000000060000000400000043000000738c0000007c0064016b047310740064028301820174016a027c0074036a047c018303010074016a0574036a0483017d02740674036a0419007d03740764016b047246740864016b04734a740082017c007c0314007d047c02640314007c0017007d057c047c051b007d00740674036a04050019007c00380003003c0074067c01050019007c00370003003c006400530029044e72020000007a1c43616e6e6f742073656e64206e656761746976652062616c616e636569e80300002909720e000000da0863757272656e6379721d000000720f000000da0474686973da0a62616c616e63655f6f667211000000da0d696e7075745f72657365727665da0e6f75747075745f7265736572766529067214000000721c000000da0c696e70757452657365727665da0d6f757470757452657365727665da096e756d657261746f72da0b64656e6f6d696e61746f72721500000072150000007216000000da107472616465544155466f72546f6b656e3400000073140000000002100110010c010a01140108010c0108011201722a00000063020000000000000006000000040000004300000073980000007c0064016b047310740064028301820174017c0119007c006b05732074008201740174026a0319007d0274046a0574026a0383017d03740664016b047246740764016b04734a740082017c007c0314007d047c02640314007c0017007d057c047c051b007d0074017c01050019007c00380003003c00740174026a03050019007c00370003003c0074046a087c007c01830201006400530029044e72020000007a1c43616e6e6f742073656e64206e656761746976652062616c616e636569e80300002909720e0000007211000000720f00000072220000007221000000722300000072240000007225000000722000000029067214000000721c0000007226000000722700000072280000007229000000721500000072150000007216000000da107472616465546f6b656e466f725441554200000073160000000002100110010a010c01140108010c01080110011201722b0000002901da0b616d6f756e74496e54415563010000000000000006000000060000004300000073c80000007c0064016b0473107400640283018201740174026a0319007404740174026a051900140074066a0774026a0583011b006b05733874008201740174026a0519007d0174066a0774026a0583017d0274066a08740474026a0574026a0383030100740174026a03050019007404740174026a051900140074066a0774026a0583011b00380003003c00740174026a03190064016b05739a740082017c027c031b007d047c007c041b007d05740974026a03050019007c05370003003c007c037c0537007d037c05530029034e72020000007a1d43616e6e6f7420616464206e65676174697665206c6971756964697479290a720e0000007211000000720f0000007210000000da0b616d6f756e74496e546175722200000072210000007223000000721d000000da175f5f6c6971756964697479546f6b656e42616c616e63652906722c000000da0c746f6b656e52657365727665da0a54415552657365727665da14746f74616c4c6971756964697479546f6b656e73da0f746f6b656e576f727468496e544155da0b746f6b656e416d6f756e74721500000072150000007216000000da0c6164644c697175696469747951000000731a00000000021001080120010a010c01120128021201080108011201080172340000002901721400000063010000000000000005000000040000004300000073ae000000740064016b04731074016402830182017c0164016b04731c74018201740264016b04732874018201740274036a04050019007c00380003003c007c017c0038007d01740574066a077408830201007c007c011b007d02740974036a0a19007c0214007d03740b6a0c74036a0a83017c0214007d04740b6a0d7c0474036a0483020100740974036a0a050019007c03380003003c00740974036a04050019007c03370003003c007c047c036602530029034e72020000007a1d43616e6e6f7420616464206e65676174697665206c6971756964697479290e722c000000720e000000722e000000720f0000007210000000da0473656e64da036d7367721a000000da0a6574685f616d6f756e7472110000007222000000722100000072230000007220000000290572140000007231000000da0d70657263656e744f66506f6f6cda0b746f6b656e5061796f7574da095441555061796f7574721500000072150000007216000000da0f72656d6f76654c697175696469747963000000731a000000000210010c010c01120108010c0108010e0110010e0112011201723b00000063020000000000000004000000040000004300000073520000007c0064016b047310740064028301820174016a027d0274037c0219007d037c037c006b05732e740064038301820174037c02050019007c00380003003c0074037c01050019007c00370003003c006400530029044e72020000007a1c43616e6e6f742073656e64206e656761746976652062616c616e63657a295472616e7366657220616d6f756e74206578636565647320617661696c61626c652062616c616e63652904720e000000720f0000007210000000722e00000029047214000000721e000000721a000000721f000000721500000072150000007216000000da167472616e736665724c6971756964697479546f6b656e74000000730c000000000210010601080110011001723c0000002902da056f776e6572da077370656e646572630200000000000000020000000300000043000000730c00000074007c007c0166021900530029014e290172190000002902723d000000723e000000721500000072150000007216000000da09616c6c6f77616e63657e00000073020000000002723f000000630000000000000000020000000200000043000000731e000000740074016a0219007d0074036a0474016a0283017d017c017c001b00530029014e29057211000000720f0000007222000000722100000072230000002902722f0000007230000000721500000072150000007216000000da0e6c6971756964697479526174696f83000000730600000000020a010c0172400000002919da09746f6b656e4e616d657221000000da044861736872110000007219000000722e000000720d000000720c00000072130000007231000000da085f5f6578706f72747217000000da05666c6f6174da03737472721b000000721d000000da03696e747220000000722a000000722b0000007234000000723b000000723c000000723f00000072400000007215000000721500000072150000007216000000da083c6d6f64756c653e01000000733a000000040108010e010e010601080106010801040104031009060112060601140c060112090601120d0601120e06011011060110100601120906011204
 
Contract con_mint
Variable __owner__
New Value null
 
Contract con_mint
Variable __submitted__
New Value 2020,9,25,13,1,22,0
 
Contract currency
Variable balances
Key 4a035ff604ffb0a44e5235e2fed8f69666b6df6ff11cbfa347d154d1a5453bba
New Value 1347.822948100000000000