Type
CONTRACT
Validation date
2023-11-15 09:56:13 UTC
Fee
0 UCO

Code (863 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1700049360,
    secret_hash: 0x2D0872A281AAE50881AE8E668F7079C87DBD541A0CE9078ACD5AF591848C256F,
    secret_hash_signature: [
      r: 0xD35199789433668D470C0C1F98F8AC19AEECB6554145099B4A4D979AD1950A5A,
      s: 0x2507B9173D41720A5787A3F81C51ACC6B9C8EF7E9CE6E648D2D05B8107546AC4,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3241E01A67E823FBD5296FF742FE8A46DAB4C6D750462A1FEFC5E39925B073F2638AA4AEC184921978CAEF9077F4A8634D729CB204DF2339FD9FE459

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D6515FC138D3C18FCBCDBDCAB8889FD7F8F9C7794FC26E6A723D85C1AB2E2741

Previous signature

647844A58009CC72EB19594BB50358DE9F5E4E6CDA4415DDE82597E8FE5822CEF3078CCD3FC5DACA31F4A98D3F8046F6B8528A2D61D76FDD61D6BEC2CC2ABA0B

Origin signature

3046022100AD0094A75680653F32CB62EAC7C430EC3C7371FFB2570F741165DF47BB455FF6022100F8978293142689D351EBE4B32FCAD6DFFF2BE8FA450396FEB408765626DEB763

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

005CC3EF217DE26750DAE3388F88BEA8E1D574C190887F5E8D5EFA23800C708EE7

Coordinator signature

B20830EDEE7CFA0BC791BA3E8ADC7D5B82B36BEDDB2D1471B537D1087425E6C536D7CF2DB53EB15782B68C5A3BC9EB512D55B4F847E429D96BABE5DF8A61870C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

84FA0D516C8E28B95A212DADC399D667E814267C6F17FFA92F5A173052D8497928D3952DA3B165CD6B5E3BF34C3203204EC681EF0E07C511B5A06B3EEEF33C08

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

774924BC029ACA9C167BFCF58DCBFDD64F19BD99D42D4D02D45850987127F6C45BAED0D0E4B2A0859176BA25398A75E9253E875B3237098EB65FB9C5F9CE8B0D