Type
CONTRACT
Validation date
2024-01-27 16:13:01 UTC
Fee
0.21393509 UCO

Code (887 B)

@version 1

condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), as: [
  previous_public_key: (
  # Transaction is not yet validated so we need to use previous address
  # to get the genesis address
  previous_address = Chain.get_previous_address()
	Chain.get_genesis_address(previous_address) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
)
]

actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
  next_code = """
  @version 1
  # Automate the refunding after the given timestamp
  actions triggered_by: datetime, at: #{end_time} do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_token_transfer to: 0x00009350ED646798BBEEB8191967710ABB018B1D7D0CA7E3DD4BFC025372E1923AD8, amount: 0.004, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.set_code ""

  end

  condition triggered_by: transaction, on: refund(), as: [
    timestamp: timestamp >= #{end_time}
  ]

  actions triggered_by: transaction, on: refund() do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_token_transfer to: 0x00009350ED646798BBEEB8191967710ABB018B1D7D0CA7E3DD4BFC025372E1923AD8, amount: 0.004, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.set_code ""

  end

  condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [
    previous_public_key: (
    # Transaction is not yet validated so we need to use previous address
    # to get the genesis address
    previous_address = Chain.get_previous_address()
	  Chain.get_genesis_address(previous_address) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
  ),
    timestamp: transaction.timestamp < #{end_time},
    content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
  ]

  actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do
    next_code = """
    @version 1

    export fun get_secret() do
      [
        secret: 0x\#{secret},
        secret_signature: [
          r: 0x\#{secret_signature.r},
          s: 0x\#{secret_signature.s},
          v: \#{secret_signature.v}
        ]
      ]
    end

    \"""

    Contract.set_type "transfer"
    Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.003988, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.2e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 0.003988,
      end_time: #{end_time},
      secret_hash: 0x#{secret_hash},
      secret_hash_signature: [
        r: 0x#{secret_hash_signature.r},
        s: 0x#{secret_hash_signature.s},
        v: #{secret_hash_signature.v}
      ]
    ]
  end

  """

  Contract.set_code next_code
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    4637457C995FDB648AC40D5E4794FDB4EE84AA4984CF8F0E1BDA1978D8E4931847A3FDEC3D1DB613189C93D078FDB06182E8C0FA6E1B44DF7052A4CC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D9A27ECF4CCB7992ABDBB44F73EE82A13DF0E3A976AA636E2CF7CA838628F7E0

Previous signature

DE037849DFE996EE83B2FFB09DB91846FBEF8F7E466D5FD3330A287D0DE6A7519A8C53C0D7A70CDF5D793B8B28F46E686BC43589B96028F6FB3BFEBAFCC89909

Origin signature

3045022100C1C86EE3A971080CFCA17D5E62511A69200F099422D059EA0E0CD518DDE6CC6C02202FCD698EB11A28BD9BD84C09D1CB6AE7CF6BA4015E72D38ED033F40BE8876D29

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00CE70964824E6FD7B1318C9BD716FE7DBB83C5A84403EAAD694B069873ECD71A9

Coordinator signature

44FBF68CD91B0EB066D45DF036C94254F77D710A6CA5F36B9EEB1BC7767BA5C127CC691FAA8B610D447DA064CC9456C4554BD953A7726394BA6C619B7DB6A80B

Validator #1 public key

00010F2A0E4C424582A94BD90E05FE6931628F91988ABBE387D365994F1F3FCF5A12

Validator #1 signature

D1337446BB23972A747FDEB3373879CCDA025F5E1DEC9D3D661AF58535A03F5614C4A198F405F0414ACAB10C694E931C1E04AB69A1E1AC6BF9DC9DDAAB435408

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

09C8998780BF6C053FE989BEB3A9522DC154308C0FB43BB98B020613AC212AD537FCBABD0746FA1D5B154BF85A745ECE4AB8EAE677F3EBD5423687FA29293006