Type
CONTRACT
Validation date
2023-11-21 10:26:22 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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: 2
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 < 1700569560,
  content: Crypto.hash(String.to_hex(secret)) == 0x611A5BC69972734E431CC8C11513EB9120E052E137FE04AE931E6269D0DA02A5
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.994,
    end_time: 1700569560,
    secret_hash: 0x611A5BC69972734E431CC8C11513EB9120E052E137FE04AE931E6269D0DA02A5,
    secret_hash_signature: [
      r: 0xC355CC7CBEA9F862D896A0FA796CFBC50B54CE1C0EB108498C27A44B324B2272,
      s: 0x1B9FEA2BDA56A7591E7FCA95E79549A4F3E9AE2EAA021480404F34B6000A5619,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C9BB0E84EF44F348BAB0E5D1F03E1F0A5D784CD9EEEE7DEA849008EA92433FFFB54DF1720D19EAD424C0D1F40DD1CA4E50DE24E1BA5BF06C9CA6327A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EF0A36D3D50EC220030F39C8DB7FC9DB29D1BF08AC765373420A4B0A3F9D877D

Previous signature

77522D1A18C71384C1387B8862119C34B5AE7B3BCF8F1AAE5C074BB6C632F7C3CA03B2C11AAD95B527DCB155A69168B783C729656EB607E0370C23773D36320B

Origin signature

3046022100DEE4B5377968F6C01897B786D3A4053AD818091D80FDB2579629581BAE7280EF022100B15B8BEF4BE34A9055E7E53EBF35D29690DC360BE8F45D826C22D276F9E7480B

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00FFF465FA52D9D33B670E1736366A74841F709C3DAE8E87ED6323020D09AF98A4

Coordinator signature

97720302204A400AF5546F8BDED24F7C40A09FF45DA6F4DC3331D1E03FAA5911F91EA52F85F4F4FD7D58EC2D2C31FEED3E3DA08AFF24A055C9DB167C758F9B0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B587536BD2CABB694DB2C0EC33ADFAB5B831E6B946FB79775249BE9E078E087F4E969F5E156746B7A51D76E2CA1741BEE711521488EDEAF89D95821C3058460A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

D96BA29AA00F13A68806EBF9669A5EF65D3F126F274FAF304BC99007762110F7603A3324DED52E1F6F27D987E2DA09898F6692C36FA13E48A319834D2BC7E20E