Type
CONTRACT
Validation date
2023-12-09 10:56:55 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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: 1702126560,
    secret_hash: 0x9A9BC84BE00593848F4F347CCC62348DD504B316C30A53EF35C30C9FD65FD295,
    secret_hash_signature: [
      r: 0x2D88CECD63AAA518BEE0BD9A0BE80F9FE8C703598ADB49A93274177E4109880F,
      s: 0x6D7584D291737EE5287136CB57E589FEAA4508E4C2DC6DADA716B5FC2D271CBF,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F3C5471F64EFEBC1472B76714D549057BDD74015F67378CFE23E83212AA394B93EE322266DDAF3618E37E5AEBB7BB360DBF71A7A8C435D96A37AE580

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000141ABD2E20807A80907C088A699BFB87A768ECA333AED5C86DE19B5DCAAECD8BF

Previous signature

E54B177C46BA20FD35F0B55D806711D7AFD4CB745CB4DD2ECFED43D41CEDF4C9664873EADD5CCA3F27EC9175CC2D38E7A3A360E9E65215B940284D03BC1EC204

Origin signature

3045022100B27B19CB9376853737C1D5FFB60F7058F45465E662A4ACCD57AF084F3DDBCF9302204DE1A3228DB6B0695F2C11B77DB022DE8967345CBE4CE2AE03B271E8F744E5DA

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00DFB7B4A7E4E17B2F582BA8DA741DD9DE7BBEAED994D4EC5B118A9870E47E0A3C

Coordinator signature

46E7C209DE26EC5F7E48F0287DFE13ABE0B1429C45E3332E1D5CDA4AF1C34FF7920ED4EDE3809699EE7F33DD6738E245FAA81928115DAA52B4B19EDA1C9C0D08

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

FE170CA165B81C0FB4CD008026DA74B076AB54489DB7A2C122A167D63E36FB8B2D0F1BE36ABED05F16B21BC048B5B41A018762D71CCBF93D3066076E1DFE450B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

4CA90B301AFE39EB1B9A04254C089CA9CFF7D352E53486856E32D7E136BCDB15A43FA428304F29A70815A0F6D5999070473A92D81F8CDFBD5D63DC0EA6BCBD0F