Type
CONTRACT
Validation date
2023-12-01 13:17:25 UTC
Fee
0.21430512 UCO

Code (821 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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
)
]

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_uco_transfer to: 0x0000688E442D31334D99315F7B71269CD1EE80A8FF55EB30D008E99F618B0D8AF0B5, amount: 76
  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_uco_transfer to: 0x0000688E442D31334D99315F7B71269CD1EE80A8FF55EB30D008E99F618B0D8AF0B5, amount: 76
  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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
  ),
    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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 75.772
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.228

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 75.772,
      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

    3B6D61C90E60E8EE64BE53A72AE11AB1B2A3BDC0A94E73286ADD227C0763445A3F1299D4A1E534B3087197CAFBD1CD14C6673A12A6335211FA47F449

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001E79EF7A7596FD6C58064CB7CFE95710F5B14B5C8952589E565DB8787B9C45E24

Previous signature

F7D150F2837BEDFE45ABFA76B2538368D39E02CF5791B45A2B412133C5C099FB43AEDA7727B84EDA53624935CACDF9EEA7CB6F36CF78826B1F7204801F1ECE09

Origin signature

3045022100CFAF4E7B8D799CC4682F7E7BDF4A995B18A7165D036BDBA8596FF8FB2C40806102205222FEE79C852C540C8AD62CDA3F430207528C5FD39AD349DA293493AAA7C8C9

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00FFB0E5856ABD072639402ED20EA699F961B72B58AE1EF88385900B1511A73D61

Coordinator signature

1A9EE1CC08AA9EC167153763858FFF9004016D85180667F1D082BDDAABAF21B3F8901AB908320C1DEA218517EDAD2EA65313E507DED77B4D08F161F61136EB05

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

7C763758B1A02080FC14CA42B03AD6CF2ADD54E3C628F229D4C669F9AAC23CA8D14EA7F8D06CEF90FC88264B036799150D57EF0EB3A7EFE2550DAA7A653F5B0B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D8194E18A4701C9DF3D355473D2F0147E02015FB2B5D7126C542B9B4EB9308A6A19FF23235C29B19C29F6A2F3992700BC575B05392682E4F10E5317DE892910B