Type
CONTRACT
Validation date
2023-12-27 20:34:38 UTC
Fee
0 UCO

Code (866 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1703716440 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00005D06DB725180EF960E71D5F2F6A6442D96FC89197F64C3589F0A1ADB22430ECF, amount: 100
Contract.set_code ""

end

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

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

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: 99.7
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1703716440,
    secret_hash: 0x2F93D872E6D3CE276BEB948B30202836371B48CD29ADD7DB0C723251A4959253,
    secret_hash_signature: [
      r: 0xC6DF2DA65B96D1B40D0A9373DBFFDFA5F43CFB8DF1B1A130002B003D7AEC5B23,
      s: 0x5EA2EA0B65B98903FA5B4D9BF9EB5FF188BB109A622B06743E22C8A7EB72B4F5,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    73A88652FA91C6345712F524FE4E0AEBB921021D2E965C1B4EAE122BFDF2F94456A9A002D66F4CA57BE3B98697735F8C41004B1ECB0342D74E3B5997

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D871BDFD2D8EFFCAEBACF598E7C903C7944ACE342B249F76334761C850569A9F

Previous signature

F14582B818EC94DDA13CD5B0619472123B21E33517368D076D9AB1C2BA7E8A3999CB8A5BF38A9401D446DCA71E8458B34A71CAF3D9CB4B055B3DE1CA11E57F0B

Origin signature

3045022100FACE40B501EA560C8F77B5D9124032B520C52EF62568EDFE241F610A1B777CF902201AB731FE52D04B35E520D71C5956E2237606859DD04F9FE0390A13B84DAB4E31

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00BEDA6722AE8C569139CC7B5C9BB8BECCA946441D21A85637A2921661BFB97583

Coordinator signature

3310A3BE0FF5C16476758C8B64B6FE00AD3F46286931EE7B6F36DF505E15A40107D8CACA0A85A04E6B31EA175812BC0FDD9A08FDA730B8C100BA57ACA733F204

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

D41FB8CD0DC9D55F1240DA491D6C9C314057A62680B040EA9AEF251E4D6B9A51258C4742DC61ADC596A8C353896FCBFD979D1D9F77D542F730BD9D7717275108

Validator #2 public key

00010F2A0E4C424582A94BD90E05FE6931628F91988ABBE387D365994F1F3FCF5A12

Validator #2 signature

699D890B2462FC61239B8EB1A7DE9613EAF9460C6640E8AE77354C832AB59F4236AD2B8588AF129FF59BCEEFCF8BDC3D164669381D516AAA17A1329A0DAEBA0F