Type
CONTRACT
Validation date
2023-12-09 16:09:19 UTC
Fee
0 UCO

Code (926 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1702145280,
    secret_hash: 0xFC54BACCE1CB32E51C2818C6FECEC60F8E552FF0ECC66E71013BE21D7E0C3903,
    secret_hash_signature: [
      r: 0xC31F72BD1766D5A1A16BBA5928FA53CF57769A567385690F5639482136A54EC6,
      s: 0x79334EA08FBF387A12DE7226330F589103D6507350B6666418FFF4713563FBF1,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C6230405975266A66F978E14A215222EEB56424A66E750464E162D6E6EE46CD50BE95AE2C7D67E798D719648C1AAE12D49551EAF59A6DB157C871922

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010532416F6E19B24A022CC1CC87138892B1DC608C95D440482B625F786C458FCC

Previous signature

852186BB806EA2D0DCC82270B8C659B3156ED17EF5E1270D32CFFCE5CBBC4FD197F9685841F6C1E74C9AE7EFBA4259E71B3F45E4F1FE64D9EC13FAF8E5DEB40D

Origin signature

304502210099E026F958A3D151955F405BC53599A2140747DD98F2AD16645CEEEF82FBB763022007DDB393CA2375157B342815B0521A9DEEC0558E23C60F46998D1862C63BFFB7

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00624697AD8AB52AD78B3984F6F21F7E9131A54D5C8EC261F550E8ADB0D4E39AF5

Coordinator signature

04C568422FC1B9C92A4BB090CB237AFBE6ABD5FDBE2EEFC278A1F5ED87D523675B709E5B41545996E348CA52F3CB104EF0F66725CC72941A7EF5B1A40F3DC70D

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

1679848F0E8A3A2053A69376EC9E2DB58250D51560F4AB20432AFCEF21617604C0BA23223F619A201CD1E608976D75B20CACC923E0115998FBBC21F14E1ED704

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

AB46E71E417E25E08AC8464BA84ED66B322B0AA69BD9907F174D3678A887439A28FF9D539279CCA8F5CDA1FA9113E11221E1390C2F1500078C1D3908CFCF0E03