Type
CONTRACT
Validation date
2023-12-09 14:35:06 UTC
Fee
0.20504028 UCO

Code (822 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: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, amount: 5.6
  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: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, amount: 5.6
  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: 5.5832
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0168

    Contract.set_code next_code
  end

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

    0C25A4A39A209F1983EF2D81C49DA17B39ECBD79881FDCE293C830DD68689B7E407C97310684E47AE12790D4366AA5E0F7F1DBDED03DAA32446B0897

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012D09896D867B3E1F9EDE85A6EA0EE17C66567A6FBC4DC72DA6A5735EC220E41C

Previous signature

0AB0B330B850893584B4DB01D5F462F9F2F5BC31F1011B20872756097F6D68D1AB4F6D37B04A5695D87B70F8B9DB66D5EB4E857EB2D3E3D4732C63E669599B09

Origin signature

30440220419EF459BFEDD332F17243E72EEBD87C7CEF271B6D4FBE18B4CF2A0598ED4227022075560159E58D96A14DFBEF80569054C275B1B9FD4EBE8D1E7668AF668927B2B3

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00680B565892DA1E76E090C3C50D10016F94918DE0A73B644E1CE645270ABC3598

Coordinator signature

B6E1C192798B83A800300605E37A1F3C5AE2FA2A71F68B439D04B9B7A0A263F20369C588641F7AEE64C01A445E79BCAB2CF6CFD7FF6F6B0BB1D078EDA7CB5C0B

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

EA20B3B3C50D720093A1FBB353D7D3DCBEF2025299CC9252966030990CDE5965D834F0A1B21E34E4F2EBFCF0ED7677B62D92A4F1893AA37988FF64683F536C09

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

81BA60B8FB6384276D6D6B0F4661D7A27D5F834E52FB51AED738C9E665A0EB71510148524EEEEE683A45EA309D517ECD1883BCBF94F3D9D7CAC14C9036914700