Type
CONTRACT
Validation date
2023-11-30 15:43:32 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1701366180,
    secret_hash: 0xD24FDB4D98084BDB7EFB98912C93849C3EBBA2D9E7382EE235C661C129B2C4DE,
    secret_hash_signature: [
      r: 0x30D95CFB7BBF998A6D48BFACC856D8810BE8E5C6806B89B25ADA4DB4ACE52598,
      s: 0x5E528FEDE66BAEA407930B72A166179EF46B6BD4B77108023BFFFBB746DD385E,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B286F782A8A77DA5A7A6E7E5E335AC960F9EF911CE49900AD502DBC0AD3362B2C56ED9E38F6CD0CB8F0074BDC7AAB551315F7B7313DFDB0E18CAC9E9

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013C11E750061F46AD8F9342B671336A7C38B791230796252D7E65EAB5B1C47737

Previous signature

1D9AE64987A45679CE61E8D3CB93251918BC75917150F7F85807233F265043707987F75C1E1B0E587D8915F4B6BA2C81A0C49DAFE4400C2A5FC748A6CD2CEE0B

Origin signature

3046022100B313D87FA8AC62608722611092221409154C262A7696FE665EFB78AC1F2DE616022100CA9458352B45E04F8E19F2BD1FA408EF0A590133BCEF7FCBA3D4CFF78310B4C3

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

004A7BD6DE2F1B6D404AE09D6E1896ACE333D3E0EA7FAD7A96571609BB2FCDE436

Coordinator signature

74CC5FE0BCD7C681528870B20819C663F6AAE9A119E4FCF9B935608D1F1532FD3E79EE095B5C11AF6E667016294E533CAC9D8F3FAEA89C5AB24CE3EA05686707

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9EFCFDC9E81AEFE130AA97A7047F09212E78112568C55FB419FA2153751521219E4B61D4417EDD06920871EDA82015BC29AAAADF529AD1F831713D863259840F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

A939B10EA968AD0ACB715E3BE92F9057958F469B2E28CFB0F6B2643E43199F515E41D243A3226B01C5B1178FEEC39A25AA99A0E2C2A836E8ABA5F02B4558FF04