Type
CONTRACT
Validation date
2023-11-15 20:20:54 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1700086800,
    secret_hash: 0xD2C6C46829AE6D29885D7A3EEFA254AF332356C9DF7BA7111F59EDF8F24DF3FF,
    secret_hash_signature: [
      r: 0x23772D48D9BC4D6F7F33DF3DCA8BCFDAC95A42C242751521C72E26864E847164,
      s: 0x36FDDB039E482B0E3A94FFA12007A010A1633291F7930E9ECC2262A6ABEBE133,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EE31672A969640F2500DCC26E839C802985F799221CDDF14821C77CED521D660728BC13FDE5CF39EB4D5DF99B35ADC189ABB53F15AA8C2ED5921696A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012B871B51FB3011CA0CB9C74E19970C6951614EB25DD8377272F3FECEA6EB7F48

Previous signature

D9E7DAB06C6CF323FBB2782A08177D884A366A58B1A668FABF7FB8E35330363D07F9B16BFFD4618AAF1031C48AD52B32679187FCDF1E1D742B37CD6572859807

Origin signature

3046022100D5D5030F7F4B04BA529A6268DA21A0B58289477863D794B5B7040FD1802B4691022100848127913A68577DB0A9130549049A29F5A9B1626AC28E6320542D7A39320C2A

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

0059A524A528CF76E9E39C57B310C0B63AA749F7CBBCAC5E75C02270B4B288951F

Coordinator signature

6D0F1F3DF729E278C815442E18BB407A4285678D881C1774DB3A15D40A70D8CA3E4A22BF31E9742B23351588B9B9F397193BCC95803C6C7303B563B438AFB204

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

7A1435CC5BAC74AB3F586FA358A4044713290DD41AA2EF79080FFA5613CA86273CC009E26EDF1F76064398EB8B2CB0EAB67ED9FCA72BB93E70A085E0D03BDF09

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2F3C997A8F3BB0644E1D47749A15CEFAE776FBF8E9FE28AD45D4547C0FB7E2B98DC80799E9214957B4DA02C4C82ECFA453D8A9483775F3C8A71B2566BC51A306