Type
CONTRACT
Validation date
2023-12-01 12:57:27 UTC
Fee
0.21420941 UCO

Code (891 B)

@version 1

condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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
)
]

actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
  next_code = """
  @version 1
  # Automate the refunding after the given timestamp
  actions triggered_by: datetime, at: #{end_time} do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_token_transfer to: 0x00004D0AC7C11BC49690EEB0A16B3051A7BCD0E20A0ECE056852B59435CEBA359AEC, amount: 1.0e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.set_code ""

  end

  condition triggered_by: transaction, on: refund(), as: [
    timestamp: timestamp >= #{end_time}
  ]

  actions triggered_by: transaction, on: refund() do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_token_transfer to: 0x00004D0AC7C11BC49690EEB0A16B3051A7BCD0E20A0ECE056852B59435CEBA359AEC, amount: 1.0e-5, 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 < #{end_time},
    content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
  ]

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

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 9.97e-6,
      end_time: #{end_time},
      secret_hash: 0x#{secret_hash},
      secret_hash_signature: [
        r: 0x#{secret_hash_signature.r},
        s: 0x#{secret_hash_signature.s},
        v: #{secret_hash_signature.v}
      ]
    ]
  end

  """

  Contract.set_code next_code
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5D5164AAA585E70322FED81D161A4FF8F8951507B0A360C470B2ED472E1CB38E491D1B3DFDD546DC19FFD030A3D31E798E78820651760ACD07961045

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012CD420848BBF1086785B3DF810B5D20F6F616A38B8C6862C87C2138280257F6B

Previous signature

2FDF614E01EB9B76F005340273BF0C0EDFF71B47A4541142ACCC9D38EAB88A331D277DD9C3C326E06039AA728AF17604E079B50B9CD12A1006A8745093BFDA0D

Origin signature

304502210097935FFB69B5ABBA150AB09CA498222EF8ACE22EBEA811E40EC3A5902BBE66DC02200485896560E00E464991A5BB3E8D652B809C939C5965E03EFB65772B30FD3E6F

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00933905DC0EC16E28AF40B262C50FC2CC8C11898E84E6861E00110B2F9B1BD615

Coordinator signature

FC85890EFC630DC06D839DB1DC90E1D7C048EC280ED6EC3434476A2C4AFC12864575E307E6E630D575C3E4B183BCEC082EDE6A23A4AB314B9526D3EE9A25AD06

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

97B69BEF8AC4A974A6344B3C712318A0ED7935DA81DB234C398DEE7CB096BC239A570004D0739D668D30E3CA69A559FA29DDE205F3D75AD0B8D456F55DC23802

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

AB96BA28C55C23009B6423D01D924009B31E5705ED36B6907ECA2BAEDC2F437BFF23FB0E810BDD1A480E12B4D7EBCEDF94905E7550B92D3BDBBDDB1623A1DA01