Type
CONTRACT
Validation date
2023-12-14 05:18:25 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 3.988,
    end_time: 1702538220,
    secret_hash: 0x395361555ECCC4CD4808A77751A412C275540D196904DD19A730ED6C4B08E21F,
    secret_hash_signature: [
      r: 0xFFD6CE5F221FFCEE5BD43E34329598220B8B3D6C4C66C8EBE83A5F54FAE5E531,
      s: 0x63B984EFE93CC918CA32AA6AF4C093358A739C41628FAC5037DB976EC771E29D,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5D9EC1C569BDC99694BD1CE4012A010B3A584113D32901F0AE0558468A023D3C4577B8C8202B913CCCDFA59B4D35E7A7B1B34CEA27E6BC0506774E71

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013370E8364741F9B7613F37CA206585D5CE8A5EB6013D8F67B279EA27511A522E

Previous signature

85DDB1E32DEA2878C47B49D8958B65A795C6DF82D21E4CFF26245FBAA853B27FA752D71C11E261A890908B1DE101F4ABCADF892CE8B7CC8CCB95085854654B0F

Origin signature

30460221008E2CDB6AB17A5EE45A73601DCD937D8BFDE58D285EB0DBDC92A06E5A7C5FE01E022100A54E3420F8EE0DAB38298F5F6E25EEF7AF110EEE6CCAE80F2BFF002C28298B68

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

001139435855828DBAC483F12768A2727B5B4772B1DABFBA7E3E97F7FF3EC68ED2

Coordinator signature

2D011F3A4794061A20841C0ED1455D7500F9A8B8160976CF1006A195ABBD58EEAF138E672CBAD5B85205ACA58F7EFFF5B46D4E0E5D16267702C9E6D23C3D510C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9458205A8840A67C50022A4683DD54AD7E490615D001C9B02465BFB7A54A062D19CBB094D7A3204292B2983AA985C50DF9AD35317E269405E7C8242BDE93CA0E

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

07AE335CF6F8EEB921E037431789C58588BE52011665D36E46DA622549EB12A2209D21ECAD96269AE23468D74BD1CA0DCEFDFEC2FC54C710E9585A7802FB9900