Type
CONTRACT
Validation date
2023-10-30 15:31:40 UTC
Fee
0 UCO

Code (866 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698687060 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001C6353CF7015A1BEB7096B1ADE63CB30508CBDF143A84818B53029BA13910199, amount: 1
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1698687060
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001C6353CF7015A1BEB7096B1ADE63CB30508CBDF143A84818B53029BA13910199, amount: 1
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 < 1698687060,
  content: Crypto.hash(String.to_hex(secret)) == 0xAEEF40478C934181BE9E37A7460516278DDBE4289C27E9802B5E47DD9B57FADF
]

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.997
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1698687060,
    secret_hash: 0xAEEF40478C934181BE9E37A7460516278DDBE4289C27E9802B5E47DD9B57FADF,
    secret_hash_signature: [
      r: 0x1E608530E6BD4B74A22E30A45C02B93A31D81A82A84C39AFD8DC85F2F5AF1238,
      s: 0x3222AD6866B2FED3CD9E8C644DA35A9B45771CD670378EC3CDF641FFD72F3100,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    879F69A568CA98ED1F30D25C72A642BEF098AE7DDD19D91E2E5A149CE15867F688E89E614882E5EEDB1549257D5B65D283A743726DFCCB6F8F798E4B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012F4CDC8C5EA7EB2F33CB77122A28DC5E551D8F64BE25677D12627C72D9FAC92B

Previous signature

F1038206A2E5DA738B2E6EAF3DB22F23276C214D03B3A695A46808AC15E77311F99D992E72E547443A20DDF60AD51B8B1F22333364F933F026682D696E54FC09

Origin signature

3045022100D2DB0D43A83FF6F27AD5E38C7263FA9E229FB38B40D2A07B07FFA1B37852840F02205870322CB3D8642793F44FF8E1C779D578B1691726CBD6180DE398626AFF65E6

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00AF245C3C4AC624364E9A6CE01C8B552CFB6EF032CEF7B73786711670EAE92367

Coordinator signature

E1F94370A0B7CE2E6D9642B78584E522885744BA5FCAE5AC409DDADBDAF2103499A319214D212881F22B88BC948B26974769C79D45CF27E8EBF08A7161013D0C

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

FC05E32327C07CD85D775E9144B5C22BEBEA76F835BB4F889610E246DDE9C73714BD5FECFC1FA632CDEBEF88EDAE2B22A7B2EC5777E429C41551D44D32489109

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

63A3693A5601E685364CAC3E9E0D640CB46210FBF6A548706DB97AF86DADAADC6F26979880CE5726476A76769596789ABFFD4AF58AFB1A57E8487B957385BC0F