Type
CONTRACT
Validation date
2023-11-30 22:10:58 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 111.664,
    end_time: 1701389400,
    secret_hash: 0x91DDECA03BD76F198D66A24DCC06E9EC4494D0A1CEB1BBCE249A2901655FABF5,
    secret_hash_signature: [
      r: 0xAD3EA15F68171C9C4B145F41D5DE527D0010899222BE1D149C0C03569042414D,
      s: 0x7BE9E18A9B8A4F1BD77538E9A09D0791E7C0F3A25934C82EDA05C42347E9808D,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    04E18081E235F4C52BB63DCF09B49A410381C1388A38F935CA271054A587866F5B9555A72B3941C02A83F85BE729FC7C657D71E4C34061960800D950

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00018BBDF7994A464082A0CC2A769855960867219DC1841DF4788C0B7D0AF3FD53B7

Previous signature

4FD33162D8DA29E7BF22CE8C70379A986314FF05D927108453086704815FE45A5724FF8AFC5C8064B20480AB4391CD9F86CE0126295086CAE9B889EC4FB8D804

Origin signature

304502205C46A61D2B4ADF69D6F8DB16D2E7FF4968148D4B328CB0553B9D815CC60907C2022100FC0D0AD9798612298A3C34AA5A751B4489FA2643C65CF1441D129720C186E540

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

005D87C8D72BA92A6ECE7D0BCDB9B00A07771D53B829F7D3D925ED5613CD2561AA

Coordinator signature

2CAD4015022D131D75C892154B02633E5E58D9644F9210C4385E1EC1064C297611F8307F7401BB1735389197877D3EE39943084F99339EB4206CF9C7DF58070A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

5472990656EFC9C39A713C06CDAB417D967CC049ABA48FA6AFFD8E099869B68FB1541EFCB1BEC66470C822AFA11DD184D3A0EB1A52025FAC69B0DA618327090B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

15C4DAD957282ADB73054A30B7197BEDEA45785B25867C749FF7006B5397BB1241D4C3F191DA1B196CC348128EE5E10200EFBF9284BB3908013725501834800D