Type
CONTRACT
Validation date
2023-11-16 11:06:20 UTC
Fee
0.17580592 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: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.008
  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: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.008
  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: 0.007976
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.4e-5

    Contract.set_code next_code
  end

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

    439BF30745993BA428BB0830C1F1D992FA742CB9072BB048295AD9F7DBD491D792509D5EEE2F7A9E1BAF913B75F3D5B5487D1590A7A4B4549EE76E8A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000105124765A9EE698F43E5ADBFC54246E417EB826A9CFFCF3201E51881AB5C8498

Previous signature

D5FABE65458FF762D7D7B5F5AB309A47F6E1D7CD01C9DB3B2323674E42BE62EB18A8CB34FA298ACC4949D3139A08F75AD3D09ED27483DF9BF2D84C28A1357D0A

Origin signature

3045022100A5D5C699BB4B0CE559395570FBD439E57EAD91D031EFA639D7DC62E8DCBB8F820220264B5EF04B4491DC8B92B0988A72F03C23C3BC8B60EA1B122445EFE544D46723

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00C654E7454F76244E96A8DA28DE3CA3D00637ADE1FD380648CDC1DB3974227E61

Coordinator signature

508BBCBEE23056AB39F0A192220F21FBAAFEBBAF3D92E30F355067A2AED2A6BF930D3ADD0168DEEC929C4D869EB956DBF9ABCE5F597E746F94DB811271E73B08

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

36D69A767A5257C4A34AD3754B6D046FA87246870EEBED88EA37458BF02B1FE50B0052580A62E961C6B3A0546E13C7287EC1C145ED32B5E59BA2CB6B9117FD0F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

59637D6B5073774E5C486DDD0A904721B5ECB6F5BE82ECC3DF35B6C204ECC01833CEE677F8FBE3AC7A06EE24328E71BD5A23B47D1F3474BE82ADB5DA57C3A308