Type
CONTRACT
Validation date
2023-11-18 10:55:32 UTC
Fee
0.18688648 UCO

Code (825 B)

@version 1

condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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
)
]

actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
  next_code = """
  @version 1
  # Automate the refunding after the given timestamp
  actions triggered_by: datetime, at: #{end_time} do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_uco_transfer to: 0x0000AC85636947ADF7293D3F72AA2DFA8D3363AC74EE6688E83891CF810541658047, amount: 0.00139
  Contract.set_code ""

  end

  condition triggered_by: transaction, on: refund(), as: [
    timestamp: timestamp >= #{end_time}
  ]

  actions triggered_by: transaction, on: refund() do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_uco_transfer to: 0x0000AC85636947ADF7293D3F72AA2DFA8D3363AC74EE6688E83891CF810541658047, amount: 0.00139
  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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
  ),
    timestamp: transaction.timestamp < #{end_time},
    content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
  ]

  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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.00138583
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 4.17e-6

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 0.00138583,
      end_time: #{end_time},
      secret_hash: 0x#{secret_hash},
      secret_hash_signature: [
        r: 0x#{secret_hash_signature.r},
        s: 0x#{secret_hash_signature.s},
        v: #{secret_hash_signature.v}
      ]
    ]
  end

  """

  Contract.set_code next_code
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CC9F64A1057A288A810FE41D916D25F240E1FC28F5FE20D8F4519A56EF47B391FA55322C4CEEBC2D32B6D3999C11B68A6E36E2AB2B74A42A7946D61B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001AEB711C9DCC836C33F1728F29EDE4504AD4073FA283074DAD1494DE7532C9EC4

Previous signature

00A1FF9AA662D7A3A401F3BEEC76C5878B75223046991EE30C8942EF69800283FE5886BF082F14600194CE115E3A2D27617EBBCEA0391DCCA8769C55829B6B05

Origin signature

3045022100E0CD75CDC77289B02E24B56B4E4A17A4E5023DE59470B0E98E216A4528D3EB7402205469A4D358EABBC3BCC137BE94637EA262CF2F892310686115C08F1EF3BB7622

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00D181C6CF93BD427535FA9BEF72E7BA293544C8362A70B7D12FB9981360EE5BDF

Coordinator signature

716C8BFE25997E480FEE64869FD14A8C3CD98100731C93FB83423553A992BD2E9C2944D0D3B5E543BE58386A2CC94A000AD3D1AB7C9CD79EC1B8B594E070E906

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

24D3EB646FC3852087B2118C41F8E1BC57113A293D0C8CA9EB9123C3E579D5A7CC84A3469E3053C907445230F1C90482AEBA97B009E07AF5CB6FF1BBF762920F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

EB7458F594164E920A2A7A73848F6A58E8032128FCE417E29C7CAEF37A13C7596851320AB6FC58D3454F5DC549E2F8361C092A05D029648283BD0DB46064650A