Type
CONTRACT
Validation date
2023-11-13 19:08:37 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1699909680,
    secret_hash: 0x1069EEBDA0CBFD3A95FD1051C18C5FB3007CF18AF74367624AD359068B474125,
    secret_hash_signature: [
      r: 0x1D9AEDFC1505A44D1CCBA95349D40E613B0FD0C07E2C82227EA9AE20CC7466DD,
      s: 0x2A8E7A89E81FE8E06728CC6CA8477C26AB953C6BD5EF938D6909E187567BF4C2,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6BF289AAF8CF4B98D21BB8772573A99FA28D757A6FD805FBC4D147C623550E32A452A0A05DCD3BA9835C3DD9F582A90E9C48C9D1AD30E2A964BCD7FB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C8153A7585369B2A65B34D9FD5A234417BCF6923576614071854F87D8E3E5599

Previous signature

65CC64D439C4D96F31062F98C71CC43FC19664C7EC226070CF150BD6D445DBA986B80FDD4BFFD131D19FB005B5569532A703BF38D312884DD663E617F8B22607

Origin signature

3045022028FE24C972B93B6CA88FD0C6E4CAE434BFDF2300C9FBA585608DDD7412E1AED402210086C0E24DDEF1E1FF65BA47BE64E6E0F6554892CE3FB10A3667AE1D9CB6802477

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00EE331EB31E1E6105F3D3296FA66323BBCEDA650DD6A51E65E837ABA6AE75236F

Coordinator signature

D6D9753AF2DB00087C0268F902DC4D1E8C9759A940B55F4575624C5523C5ADCABE3553019CE1C21E56FEECCBCA79B7A71C37611C6AB3A3ED322B4873930B8509

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

6F6E8ED6A6340AB28193D7E1A09E55A3A77D5D6DE713D74169F57AC86D93EFE5F80D00E58BE01D4C0CC0FD76E16198B268EF4A11B8F850F5E34474486F7DDB03

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

71876C0FC162D91F5D1094F82C61A5351A3D77A91F1779B3995B97B52DBC59608848B3EED3B296499EECFEEA6A842DB6EFE30FEC5EE3D758C9635269A7CF110D