Type
CONTRACT
Validation date
2023-12-01 00:24:18 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1701397440,
    secret_hash: 0xDD2FEEA2122563B4BBEA0280993D8889A5D82AA5DCB888959654400833CBA743,
    secret_hash_signature: [
      r: 0x7501E8BFC478DCCDB4CF264D490654D3A01B032DF864979D8B2063D080EDA07D,
      s: 0x74812E6B1288B44733DA17360683ABD3EE54DADBFB1EF236DB4379FD311DEA33,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1CE084A265693ED658368D3E03078EEFE53B78801A833CA73D459EE4597B8F1464562F844379026BE8CAC09F47187930D61E5C24576475237031535B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000118702656DBD0BBC8D199A7C851F841BE8D1DA125EF7730D083F24589DB3BFB8A

Previous signature

56967F720475F1EE8A0355BE6362D656E09E350C816C7CD4A165CACBA4140D013A514A1683B26E2A31FB755077DF1B25461DDB392BD3A41B40C5B0A1740AE403

Origin signature

3045022100CBB3D68C2DC23D82722BBCC935B9E85CD764B2EFACA9AB06748F10405630A28902204BBC49D27A3E06A268C7449BB22EBFF8CEB6B8F283196457343B1C3BB017D99B

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00C2BE75D8759F0FF596046E0EC1EDA9B14C5F84AD0DA75F903984A6BDBAC171FF

Coordinator signature

9268F9D7FEED68EC1967EDA766E5FF505D9F9BAE8F3AAE5065F489838D7AD8AB10981E87008D9DE5F6FC6C7219579E31A583E237F16D42E8FAF2A17021F2C801

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

EFE793F3FD73A47F1712E9BD6EFD418B0EE78ED31C9C7EA3A30796E7F9B3E0FE34446B2249E6AA96536FD9C2B76FFE4F17E917D5B334B483C3A7D37050B2810B

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

2402D51B49EA8FDCB157B6DB3E976156BDC7C474594B13D66E8CFD5D16A9874C378FE2C24C27F2F5E99A7DDBD7F6B6846842DE0E7761CBA781EF3DA1DFD4B00C