Type
CONTRACT
Validation date
2023-11-23 00:10:27 UTC
Fee
0 UCO

Code (925 B)

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

end

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

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

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.0997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1700705400,
    secret_hash: 0x546B4BA579BE439BFDC1A99F179E8EF29605B27B73A6C6BDEA0DF08F1C3EAA91,
    secret_hash_signature: [
      r: 0xFA56C26C52552E6BC0DB664F07A6CB8C1F27ABC9908D8DF8E774072DA43DA8A5,
      s: 0x52A943AFD3C556488FC023A47B2CB27D2D2A348579E1A4FE29892A07994C0211,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0B3292CF01866231460EE095560E17C57EE26496C02B19F74B39F218495E60D476FDD43CFFBCA921C9C9C43382E3D1B0E08BBD8231A72642E52B4B10

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001698ABE9D31CB3AB886D69ADAF99EBB0F1B4DEE261EF934C50E385316DE772D65

Previous signature

52221460213936856464C951916D9C0FA772E96B4A2958D299DBCF325E3D56E4DD2CB00C8BEC579E86F12D85CB4E84785E03FDA5FC574ED2F89149043326550B

Origin signature

3045022100956E4E6C62FE015C388696146C0684487590DAA3D7B6B9489433EB98EB83F1A902203B4E2DF395870595C35481ED3753D14B2AE7FF87E4A3E219F23885BA5126084A

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

006C45F095E542295A5B6A359504A21A0D502B9D8482461AFBD7638A861EF2CEF0

Coordinator signature

E47B353CCCEE47AB18FF0625452FFEE073EDF0D6E3C4D28A5A419591F1606748FECED092FC28719850D19AAA5198F004F4A5939BE186C8330DBE00D88AFBE407

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

54084399BA124B0FE98898EB35FDF5070531AA4922643AA29F26C26149D165E60AB62A9F31ACCE45C52CC069480124A48C23F85CDB4309082A62DC63EE94AF0F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

1B73775629DCC97ADB46D84A58C32826A89AD13A42FAAF79A202DCB0CFA2E1001DDEB102BDB1DC410C27430E44E86ED4971C83045ED14CA7063CA54864F53E0C