Type
CONTRACT
Validation date
2023-11-21 13:34:04 UTC
Fee
0 UCO

Code (930 B)

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

end

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

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.001, 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 < 1700580780,
  content: Crypto.hash(String.to_hex(secret)) == 0x1AB7B547F39F34CEECCE290230CE4FD9EDB81A7AE294FFDBD5A13C246A4F0CB4
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700580780,
    secret_hash: 0x1AB7B547F39F34CEECCE290230CE4FD9EDB81A7AE294FFDBD5A13C246A4F0CB4,
    secret_hash_signature: [
      r: 0x5E255B70B074AE83636DF7DAAD661683C060D83B9EE5CB786142A42130F13773,
      s: 0x2EC3687940C76BFB8B877B4690FC4ACE6060D376312D83E75313C555FCD53874,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    BCF9A4AA6669A80948FFCE84C71BD8014B6F51C11E1419C90B9F94323E3163CE8245969890B2625CD736D5B434883034F7FDE7AA631DFD7E3BA1C10A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016D869ED545A6ACE84B8E9BD1405034418A5131A39C55FB6F2ED57E0850E32D17

Previous signature

2B19C493A16DF3D00FDAC60984EB44BD617B65471D7016E0D791F4BDC506C891C48A861B933029D3B2BB841E456741BEA218D9F43E25CE2DDA23FD74C1550601

Origin signature

304402204347D067AECEA028CB8D8DEFF4F3EB2B51FF35CECE1A2F47622A68CB036D6311022007EADD21038B2E8CE96748E4153CF454951985A84E23BCE972239A8022FBCB7C

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00E164C94116E70B2DFDFE4F436A61F62D0552AC04E7DE91F4F590F98710A8C2CA

Coordinator signature

8A83F57B83D03BD9208E2EAF57591210E8ABEE7B5DB8CE63CA3A137DD98FB8494067053113A0DB86EF90DB8ABBECEAD43723EFFC7D2C5CA2D527493CA9CB5A07

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

620245F1D6CAAAC1A8146E999917FBE988B45E103934AD3B93F61410079C025DF4E08FB7F1F1E6F896BCACE4CC1285821D79DA0B41C705989ECB8A1A05BAE00B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F6F0E79528762EF63F4A7EF3AFA95542CD7F2003C192C96C2A564BC5C8431514E18F05E12CB76F4C902002767F6326B9435FFD2E707694708B95040BD43E4D0F