Type
CONTRACT
Validation date
2024-11-13 14:24:19 UTC
Fee
0 UCO

Code (961 B)

@version 1

condition triggered_by: transaction, on: refund(secret, secret_signature), as: [
  previous_public_key: (
    previous_address = Chain.get_previous_address()
    Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
  ),
  timestamp: timestamp >= 1731515040
]

actions triggered_by: transaction, on: refund(secret, secret_signature) do
  Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_uco_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 1

  Contract.set_code """
  @version 1

  export fun info() do
    [
      evm_pool: 0xb361b5ac4eaeb918dced9d60417975c89556ddea,
      ae_pool: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801,
      status: 2 # REFUNDED
    ]
  end

  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
  """
end

condition triggered_by: transaction, on: reveal_secret(secret, secret_signature, _evm_contract), 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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
  ),
  timestamp: transaction.timestamp < 1731515040,
  content: Crypto.hash(String.to_hex(secret)) == 0x24153FA8A8A5587A1FA6380738A252CAE98CA2227E782386BC896A72DDAE4D5E
]

actions triggered_by: transaction, on: reveal_secret(secret, secret_signature, evm_contract) do
  Contract.set_type "transfer"
      Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.997
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003


  Contract.set_code """
  @version 1

  export fun info() do
    [
      evm_contract: #{evm_contract},
      evm_pool: 0xb361b5ac4eaeb918dced9d60417975c89556ddea,
      ae_pool: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801,
      status: 1 # WITHDRAWN
    ]
  end

  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
  """
end

export fun info() do
  [
    evm_pool: 0xb361b5ac4eaeb918dced9d60417975c89556ddea,
    ae_pool: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801,
    status: 0 # PENDING
  ]
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1731515040,
    secret_hash: 0x24153FA8A8A5587A1FA6380738A252CAE98CA2227E782386BC896A72DDAE4D5E,
    secret_hash_signature: [
      r: 0xD1F5121DD253D4424057425CE0D1F32C18FC01DF998BA6B69487C86238072ABB,
      s: 0x4A21F874628F8EC3294A391DA11F709B220AC34969648FE06696B9B3D615BC92,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D3FF00AB5A5DFAB71B8F3D2AAAD5F641133C7ABC830F068DA272B5F03E5E9B2615855FE41D6C09917242920A96EF13E6143DD393A2C9E9D509D9B085

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012175EA05613D609CB15749ED849BEBB8933A099FA8BA82CF119A2EDDA5BFAE7B

Previous signature

0DF6675D7806B192EA9281F48CD77819766699087256A9ABA2EBCC2A9C131EF53BCB5C208C1AB11632E960448EEEB7015055361D10C9EF6BB45CB77B4F93CD04

Origin signature

304402202360F1F594C2416FC315C387925A2FAB719EBB3A5D2167290AB6CE7DAD0E67DC02201315CF94933C78F90D755D51D777562A4502C59E11190D5CC204548678F8B6CD

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

001B9120D5F3BA0ACB45239007288DA6E47DD893822D804DC77F078CD904A8D91B

Coordinator signature

3636DB1009CEA3ED0F7F1E0D654CF82B73C968B066A0A6AF55D3B4C495F87D0488B01666F87F34A7FACBDB20F98CC3B5EC77B82EA2B630B97942FC931438A005

Validator #1 public key

00016204A6DD6BA17388994E74A6529F509D1479FEFB67D8D55D1E450E30A30982D2

Validator #1 signature

1D81E3A3B9E255E7D6D8EE5F9490E731A0F836D0751F15BBAC03BF4E4DAAFD3C98B7517871405C70335E7ED1FD5F22E488C6192BF3E2DAF9E414BD1C4C3FF302

Validator #2 public key

00012A70C3888F5CBD811F5E45AD85E660AFB4F6AA982C41433AE63814642DB3D283

Validator #2 signature

5E91049CB393CA5DFACE52DC4525F97F10A66A5ECA47F0F00AA813B52F0E5FA52CC717C73EC0A95CE87E618FC87165B862B2965122200ADA6246E9680601A904