Type
CONTRACT
Validation date
2023-12-11 07:13:49 UTC
Fee
0.22553983 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: 0x0000C350C6CD84AD1FCD2D58E51AD56A1E468A7C38DFE8D88A3E433AF20E85C68A51, amount: 4.8
  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: 0x0000C350C6CD84AD1FCD2D58E51AD56A1E468A7C38DFE8D88A3E433AF20E85C68A51, amount: 4.8
  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: 4.7856
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0144

    Contract.set_code next_code
  end

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

    94A623F318344444ACD11F3591E6DB198CD5BE6269B63EF3A9387F879BF2C801D1F203149274A3DEE0FB137A74ECC4019A41B2291F16E099570EE5E8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00016EDE706CF1B26E3BA5305C9DF7D953F22F03589AC0E1D716BFFAE4AA22AFAEE1

Previous signature

1E8E300A5906B75BC7D7937D378ADCD9A7461DD553EFAFBDD509D55183940CF2489B312DE5673F65B5CF0C474C376307342F36C0D3979DECACBDAD3D88ADFB05

Origin signature

3045022100DA8481F9176DD578C003578C9AFF9289B332BAE291A98632F336F6B3EB38AFBC022023049A59D60B0651016039ABCA395307B187D00C131F6018E64429184920A094

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

009DFA7C2C46B593548AE8AE111851F256F03DB66F4551670169D49713CB422706

Coordinator signature

2AFF3B82FBE35381E201DC2E91371B1697822FD649BB4C68BC30E7A2C49D4A13EE2E9B98298CA22A3E6E2055D2D6A067598762C69EA2A403F782598A6153C80B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

F7D1F2D0C2FCF4BCD5DB1267589D09F218DD4A010FDECEC052050151AB1D200940D8AF086E3EA64BE5A0B3CB2CD4455C4F7670B2F3176BDA1B8B6377868AB600

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

8F84EE98E1EF51AFCCD61A154846B0BC2BB3D056B583134CA8DF8960CE7306BCA1967DA73C0861CF245D29BAD572DEC16493150917479F6167030E3C3392720D