Type
CONTRACT
Validation date
2023-11-14 19:23:05 UTC
Fee
0 UCO

Code (925 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.01, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
  timestamp: transaction.timestamp < 1699996920,
  content: Crypto.hash(String.to_hex(secret)) == 0xCC03F7CCCB41620FD68BFC999EE2EA415F85E756E03BD7B0BA6FF031241359A9
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1699996920,
    secret_hash: 0xCC03F7CCCB41620FD68BFC999EE2EA415F85E756E03BD7B0BA6FF031241359A9,
    secret_hash_signature: [
      r: 0x94FE71F0493BEE576AA2B821B95FADA264E5889400D7967E5F8940BE7ED021B9,
      s: 0x67BF4F5D039F0246B761C91D8B71E053EBEA7AF34382B35551DC74219ED0ECB9,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    402642B8E8235B05B7D44439130D32F58B7060B4AB4AEEF2E8E0EDC52A47A75D3B869CAD3CC0DFB3AB859EF69468A0F37161F1CB7869B58F86766D2C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000116C6E5ECEE9E2C24D38A0E99C1B242A7B100179EAB10BF19617CCC93A1E6E873

Previous signature

C7745538ABFEB823E8E8FCFE5E488334F5772F39FC3A0F0249BCAB733831746C6FE3B8DC6405407ED018ABC69677912F6FFD39717D639A728DA501A81E59E702

Origin signature

3045022100FE2A958F4F2DB1A5BF0720EE6F642D99CB969152147F93DC46E70D37E0FAD0C602206C9DB7494366122FF3954F1353E21CE9214FAB86315429F7BB7EC236F8397DA6

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0048A9630B2F238FAAB015E48A8B4150641BC08A03E2E56F134130C6B89CC07E4F

Coordinator signature

C729BC9336647A13B87228CD52E59EE748D08A885241E635CE19D01796D1EB04A8DE5CCFB6A18FEE7D53879E0969954EC0B28346D28713D5D77F2C0DBA882B01

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

8D3F439DB5FF9B05D40C976E6C006E263EC69169E6475D7A7C2EB3A5FB30EC1FE3E1477225AA230C3DD777655D89FAA0C8525E0CC7CC36BB73C4A50D37F34E07

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

3176FE3CB1F9BB414AF299130C460530074433D5B1225AAC49FD4020FFA6DD6BDCB2C35C5A4024EA4D844B7305030035757CE32336FEBD435B4092153212D20B