Type
CONTRACT
Validation date
2023-12-07 14:11:06 UTC
Fee
0 UCO

Code (935 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000068155ADF3C147E5DF9132D7E481DFCF5AE665BCB6021CC9B1F21D7D86C2CCC7F, amount: 0.0595209, 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 < 1701965400,
  content: Crypto.hash(String.to_hex(secret)) == 0x69D9564E9FBB35E955BFDA66671D2D5191065A8E9F88F0ECD4A688337C281DCE
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.05934234,
    end_time: 1701965400,
    secret_hash: 0x69D9564E9FBB35E955BFDA66671D2D5191065A8E9F88F0ECD4A688337C281DCE,
    secret_hash_signature: [
      r: 0x9FA851A26D92C6843AFB2CC752DE0A326EE11448A02D635247A50E9E50AB8177,
      s: 0x3706F1A8110F780E4CBF7D40CF4DE412E6A0007819852A3F4086613F873BA860,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7FA8889E37C30CC409901BACC6FAE212817E3EB11D5D9B9575E90AB18E8DC0E442EBB3DDA26DF3C9F46445EF5127C5706CB4DAE4E231BF120B3023D0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00017B5831AB384FF347A8F8B093818F46660E9CD281E7FE7D2F843AC41F9D671E15

Previous signature

766124B3C351C99678D3AABBFE2DE32D78FA95A2B00F17A3DCCE38873E780D3FE0A678DB48A5A60FCDDDBBBA1A334477BFEA553E146C884CC4E9EC0287E7F405

Origin signature

3045022100892AC6E797207CBC01BEE7A1587D30EB6B150FD5DD01AA5569A74ADEF963231F02203824769576E9F61B78AA58BD709E34E2D32CB2F7F73183958645D6C2266E7B21

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

003CD435FE14260F2A20F6DCBD0D4DEDC2E56CC2EB64F39C98063DEDE99D650D19

Coordinator signature

E6D7F635CDD8E8F06993ACFEE70CFC8732F80877CDAEBF05ED59E40FE4D546E0C7AA5E203FA5A9A118CC0CF4BA1FDF84BBD83D020254EB19C487C831456CB20B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

8F7B18A3E3B7C7952E102A502B7285A238C5DC05089AE8F94A4968BB4B00F2D505AD193FE26943A78881E42498BB98BE98E703D326D867C7F6E56FA152A37D0C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

62E724AED578C0BBF7C6709F1208331BFF2978AFEC649AA9AA1361C85FFCA587F873FFFCF55CB4C9B9720F030CE8B52CE549CE1EF7DA642BC431A41E84ABDC06