Type
CONTRACT
Validation date
2023-11-22 02:37:05 UTC
Fee
0 UCO

Code (928 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.002, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1700627760,
  content: Crypto.hash(String.to_hex(secret)) == 0xE625DBA9C68C63BE3A58F46EE1D7FAE41AE21B9116DB869DE41A64DF6D0CB60B
]

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.001994, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 6.0e-6, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.001994,
    end_time: 1700627760,
    secret_hash: 0xE625DBA9C68C63BE3A58F46EE1D7FAE41AE21B9116DB869DE41A64DF6D0CB60B,
    secret_hash_signature: [
      r: 0xE168252F8CC00A9A828B674751BDD0AC1ECBE676C1D4D7AB463C163F5DBE3D6C,
      s: 0x201BF6DB96E6DC4933A7A37FD9577657A53EB136DEF2913A129757EA416C1A92,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6F82E03A7B686703F09A4A0A368E96E562CCB0927090869C2D447F5E326B0A32B5071FEC3473B2F2EE9D55D641813D64F0544813449A23B666B5771F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016BABCAEF4C0D591864CEDAF3F126321DD3F5AA6AE447DF470CB281C70D935BFC

Previous signature

928387A8BB81B12E463A1363C73B6700A8E8C6CB8C0A5BB0EBC60D3C3AD387F45FFD7A8DE37B142F841B37BF5F15D2C9EED845B58641DFEF1881D795B293C80F

Origin signature

304502200B681D5D87C1C8F1BAA47C0062B26373D1B657723D1C6D5454D32D23905B169C022100C6386A52AFF36644B4ABB04A959112722206716A19B3B6BF99838E6B99063432

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00E9D32A9634859F296A34DD1C136239CE0124F99D76D17379E0A06BCF65C10B68

Coordinator signature

83952052BB3810F78B0E449E70BDC8977922D1E7E89282516B71EF2E12798119B2FB5BBA3C32ABD62790588A977172DABAB0874847B5F7AF3E64B20EABE18E08

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

ECC1AAAF6024409084F7C069442A3C5875924858F270E06A8D576586325E226C95E674064C87BFBF3B71A40A1FD90D5288D7AB5CF9B3313C2FC3701BF025F100

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

A9145F88078BA05B3FFEF4B5F1CF12BCC8714F578ED6C36247BD545CA28B21B59CA18ABA47DBB49A580478687E54F8321DE983A59D514B6D21B61198B06AE002