Type
CONTRACT
Validation date
2023-11-21 07:23:42 UTC
Fee
0 UCO

Code (933 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700558580,
    secret_hash: 0xBF123F6E2A859F08665DC1DE6B91AEF7CD3219A772644EC1059BC14189AF6B7F,
    secret_hash_signature: [
      r: 0x8EAB463D3C04500837EF6B1B905476E7D600031C25F98A3244A9EC7F6430BB4F,
      s: 0x6A7F64808B8E2AAA3324287ECEF40B9119C60DF982403F0E3DCEE518FA746E5C,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    831E3421034189C95819B1125B145CBEBF3237BD218EFA70873F24A54BBB336D30C5EC6432ED2826557B292AF57005D2AF6D78A04E4AA2F2820BB577

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001356A4EB3800129F12DE27F96B65BFE4F78A3801BAFBBC03AE8772816A65C1B26

Previous signature

95396793FA497295AD9F241B70918CCDDF902411DCE237E33D894A2E8303DE485254A1A7E1D12BFD4B06BB98C014E2024FA2A6E7F210B3C0A38B220AA04FE10E

Origin signature

3044022018B5A0E8696485055336908060DD30B35B8AFBD2FC14305284FD0112332BDBED022031C671C3D75D77337C4E77A3C467410BAF65DA7AA5DEAA71CAEAEF90853ADB39

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00D3C1B67793AA9EBE86E92FB2DE39FCAFAE93B165E917BFCA912E82015601CA36

Coordinator signature

A692E9A89A2CFDE8804FE508A6F08F3D8EB33A8C875F9B286E07BD0126AC5F70C14AB9498B5D93C60990FD03174EF12C58FB55D38EBC63D3084B2BB06132890A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9B261AEB807A1EDD1687881BB3AA06B4B0B3FC3B8BB7D26612DCB1B9AD7C4D920B654B975D1BE8A7469BE2397DE05263A691C0932435846F668F132B6CCDDE05

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

C2BBA7CAEF3B5EE76DFC3C629C9A3D83ED14400013B3790DE654FEA5B3A7DDF4D4E3F52F0E0C41DD6FC3E7DE377F9AC88D6C6254B7908B7CC26B09AE536E2102