Type
CONTRACT
Validation date
2023-12-11 16:58:26 UTC
Fee
0 UCO

Code (879 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 98.201459,
    end_time: 1702321080,
    secret_hash: 0xDFB2E0066134C8F3210054D4BB02495304DE4A5541CD00434500E4DC69EF5DE4,
    secret_hash_signature: [
      r: 0x3A843ED8DCAB864984D210552A2E71516F4D0D0E2E24633CF14288117063D0BD,
      s: 0x2E944130E8CB01BE16E298C9C99B2774DBFEC96DD7ABC0C26EA5642E316B8C09,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    74371C2BAC2D72E8A2919703EA8CDD7C8E69B94A4D91B394D80CB3DDE246EE493EFF6CDC8AB3C96D1DDCEA23EB4ABD6BFAAAE98259C00D15F1DE141D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012E2355661C85CA36E9E2E95E85BF16E639EA1985DA658DF07D8E1C98235F6280

Previous signature

6658CD7458C5AAE56FDCD44DA135264F1CA386D02E65969B4586380BE3E3D638053DF61757553FBAB7CA8A723A944CF94A7B0D2E1367537467FC263DDEFC600D

Origin signature

3045022100DEE7708300BE990CBD9F9FC5E25A1CE76EE8CCEBF98F350A11EEB5065D5F71C4022005724B5D0A1C2D2D6E0725D83AAE80B5F3FE4D7774BB3D063F5D2838FEC90676

Proof of work

01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704

Proof of integrity

008934ADC204A6E0B24DDBC47610BF78EB68B37B75B87DCA366432021BB9C171A5

Coordinator signature

3D82C52DFC7DA3A12819C7EBB68595383117D8951057985556E46B5919837FCDED977A22F4B626405A126C6321DB32FA5B93E38F8E79CE410B32FD32F8FA1001

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

5E3DE7A340A80AD8852C26D876CC7FD309BF5C7687300491BCE890FBDFA4D1604B30693A8C80E874D5B5BCE756B209CAB77D81ECEE6DCEEAFFD04B05EAEDB90B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

77999481584496247BCBF6A1B828416E1CB0B577790C26AEC76232CA192FD09D97576B1EB60F045F08A843FAA3F68F6755F586F55BDA52E6792AA7E36A188F01