Transaction #18574

Hash 996c9cf959a06fbde1b6569ca518c67226ea1c8132c5b215ea0d53687c503897
Status Success
Timestamp 285 days ago - 8/13/2023, 8:32:17 PM UTC+0
Block 18574
Stamps Used 165
Burned Fee 0.00976331 TAU
From 340d48d4f5123b3a6a98b11d12ba7b10643adf10d47fe672965e558bf188b501 
Contract Name submission
Function Name submit_contract

Additional Info
Nonce 77
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature faef9c5db896c2a0b9856d608b748449c50520d3bba3448ca2038b7b6499122d67e2eb4bc6281675b8498f637e1769638ead43397cc155a367cd99958714b103
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code # Importante si se quiere que el propietario pague al jugador debe aprobar la cantidad que esta dispuesto a pagar desde su billetera # Tambien importante si se quiere jugar se debe aprobar que cantidad de monedas desea jugar random.seed() # Importo ramdon para que la maquina pueda jugar import currency # Import Currency para hacer trasacciones en la blockchain movement = Hash(default_value=0) # Declaro la variable de movimientos winner = Variable() # Para tener guardado el ganador propietario = Variable() # El propietario del contrato inteligente jugador = Variable() # El jugador externo computadora = Variable() # La computadora premio = Variable() # La cantidad de premio que se piensa dar @construct def seed(): # Creo los movimientos por defecto movement['piedra'] = 1 movement['papel'] = 2 movement['tijera'] = 3 # Y les declaro un movimiento por defecto a cada jugador jugador.set(movement['piedra']) computadora.set(movement['piedra']) # El propietario propietario.set(ctx.caller) # Variable para declarar que premio se quiere entrega premio.set(5.0) @export def Jugar(movimiento: int, precio: float): # Validaciones de movimiento y precio del tiket si pierde assert movimiento < 4, 'No puedes hacer ese movimiento!' assert precio == 3, 'El precio es 3 TAU' # Los movimientos de cada jugador jugador.set(movimiento) computadora.set(random.randint(1, 3)) # La logica de quien gana if jugador.get() == computadora.get(): # Si se ejecuta un empate no se genera ninguna trasaccion return 'Empate' elif (jugador.get() == movement['piedra'] and computadora.get() == movement['tijera']) or (jugador.get() == movement['papel'] and computadora.get() == movement['piedra']) or (jugador.get() == movement['tijera'] and computadora.get() == movement['papel']): # La trasaccion si gana el jugador currency.transfer_from(amount=premio.get(), to=ctx.caller, main_account=propietario.get()) winner.set(ctx.caller) return str(winner.get()) else: # La trasaccion si pierde el jugador se le envia al creador del contrato currency.transfer_from(amount=precio, to=propietario.get(), main_account=ctx.caller) winner.set(propietario.get()) return str(winner.get()) @export def computadora(): # Funcion si se quiere saber que movimiento hizo la computadora return str(computadora.get())
name con_rock_paper_scissor

State Changes

Contract con_rock_paper_scissor
Variable __code__
New Value random.seed() import currency __movement = Hash(default_value=0, contract='con_rock_paper_scissor', name= 'movement') __winner = Variable(contract='con_rock_paper_scissor', name='winner') __propietario = Variable(contract='con_rock_paper_scissor', name='propietario') __jugador = Variable(contract='con_rock_paper_scissor', name='jugador') __computadora = Variable(contract='con_rock_paper_scissor', name='computadora') __premio = Variable(contract='con_rock_paper_scissor', name='premio') def ____(): __movement['piedra'] = 1 __movement['papel'] = 2 __movement['tijera'] = 3 __jugador.set(__movement['piedra']) __computadora.set(__movement['piedra']) __propietario.set(ctx.caller) __premio.set(decimal('5.0')) @__export('con_rock_paper_scissor') def Jugar(movimiento: int, precio: float): assert movimiento < 4, 'No puedes hacer ese movimiento!' assert precio == 3, 'El precio es 3 TAU' __jugador.set(movimiento) __computadora.set(random.randint(1, 3)) if __jugador.get() == __computadora.get(): return 'Empate' elif __jugador.get() == __movement['piedra'] and __computadora.get( ) == __movement['tijera'] or __jugador.get() == __movement['papel' ] and __computadora.get() == __movement['piedra'] or __jugador.get( ) == __movement['tijera'] and __computadora.get() == __movement['papel' ]: currency.transfer_from(amount=__premio.get(), to=ctx.caller, main_account=__propietario.get()) __winner.set(ctx.caller) return str(__winner.get()) else: currency.transfer_from(amount=precio, to=__propietario.get(), main_account=ctx.caller) __winner.set(__propietario.get()) return str(__winner.get()) @__export('con_rock_paper_scissor') def computadora(): return str(__computadora.get())
 
Contract con_rock_paper_scissor
Variable __compiled__
New Value e30000000000000000000000000500000040000000738e00000065006a0183000100640064016c025a02650364006402640364048d035a0465056402640564068d025a0665056402640764068d025a0765056402640864068d025a0865056402640964068d025a0965056402640a64068d025a0a640b640c84005a0b650c64028301650d650e640d9c02640e640f840483015a0f650c6402830164106409840083015a10640153002911e9000000004eda16636f6e5f726f636b5f70617065725f73636973736f72da086d6f76656d656e742903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da0677696e6e6572290272050000007206000000da0b70726f706965746172696fda076a756761646f72da0b636f6d70757461646f7261da067072656d696f63000000000000000000000000030000004300000073520000006401740064023c006403740064043c006405740064063c0074016a027400640219008301010074036a027400640219008301010074046a0274056a068301010074076a02740864078301830101006400530029084ee901000000da06706965647261e902000000da05706170656ce903000000da0674696a6572617a03352e302909da0a5f5f6d6f76656d656e74da095f5f6a756761646f72da03736574da0d5f5f636f6d70757461646f7261da0d5f5f70726f706965746172696fda03637478da0663616c6c6572da085f5f7072656d696fda07646563696d616ca900721b000000721b000000da00da045f5f5f5f0c000000730e00000000010801080108010e010e010c01721d0000002902da0a6d6f76696d69656e746fda0670726563696f63020000000000000002000000050000004300000073160100007c0064016b00731074006402830182017c0164036b027320740064048301820174016a027c008301010074036a0274046a056405640383028301010074016a06830074036a0683006b0272506406530074016a0683007407640719006b02727074036a0683007407640819006b0273b074016a0683007407640919006b02729074036a0683007407640719006b0273b074016a0683007407640819006b0272e274036a0683007407640919006b0272e274086a09740a6a068300740b6a0c740d6a068300640a8d030100740e6a02740b6a0c83010100740f740e6a0683008301530074086a097c01740d6a068300740b6a0c640a8d030100740e6a02740d6a06830083010100740f740e6a0683008301530064005300290b4ee9040000007a1f4e6f2070756564657320686163657220657365206d6f76696d69656e746f2172100000007a12456c2070726563696f206573203320544155720c000000da06456d70617465720d0000007211000000720f0000002903da06616d6f756e74da02746fda0c6d61696e5f6163636f756e742910da0e417373657274696f6e4572726f72721300000072140000007215000000da0672616e646f6dda0772616e64696e74da036765747212000000da0863757272656e6379da0d7472616e736665725f66726f6d7219000000721700000072180000007216000000da085f5f77696e6e6572da037374722902721e000000721f000000721b000000721b000000721c000000da054a756761721600000073240000000002100110010a0112011001040116011a0116011a020e010c010c010c020c010a010e01722d000000630000000000000000000000000200000043000000730c000000740074016a0283008301530029014e2903722c00000072150000007228000000721b000000721b000000721b000000721c000000720a0000002e0000007302000000000229117226000000da04736565647229000000da04486173687212000000da085661726961626c65722b0000007216000000721300000072150000007219000000721d000000da085f5f6578706f7274da03696e74da05666c6f6174722d000000720a000000721b000000721b000000721b000000721c000000da083c6d6f64756c653e01000000731800000008010801060108010c010c010c010c010c03080a06011217
 
Contract con_rock_paper_scissor
Variable __developer__
New Value 340d48d4f5123b3a6a98b11d12ba7b10643adf10d47fe672965e558bf188b501
 
Contract con_rock_paper_scissor
Variable __owner__
New Value null
 
Contract con_rock_paper_scissor
Variable __submitted__
New Value 2023,8,13,20,32,18,0
 
Contract con_rock_paper_scissor
Variable computadora
New Value 1
 
Contract con_rock_paper_scissor
Variable jugador
New Value 1
 
Contract con_rock_paper_scissor
Variable movement
Key papel
New Value 2
 
Contract con_rock_paper_scissor
Variable movement
Key piedra
New Value 1
 
Contract con_rock_paper_scissor
Variable movement
Key tijera
New Value 3
 
Contract con_rock_paper_scissor
Variable premio
New Value 5.0
 
Contract con_rock_paper_scissor
Variable propietario
New Value 340d48d4f5123b3a6a98b11d12ba7b10643adf10d47fe672965e558bf188b501
 
Contract currency
Variable balances
Key 340d48d4f5123b3a6a98b11d12ba7b10643adf10d47fe672965e558bf188b501
New Value 36.057396147278106359