Type
CONTRACT
Validation date
2023-11-16 23:44:36 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.99991,
    end_time: 1700185440,
    secret_hash: 0xA89F08E955843E4003F5A8540E82509C457A6B1CDEC645962524806ACC68E76C,
    secret_hash_signature: [
      r: 0x459C7839EF72F980847FB417E2D910D42C2EC1E8F21861A7FE86A05A0AF28CFA,
      s: 0x56113BD2AA6838BB7DCA6E3E834225A64D404C81CA901AE96B9FB181CFDFAA33,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0D81402E4800E02595527461FF92386892677F90A79A343ECB89464FF41AF39E197E605FEFFA3A203E0033095A4A1EBC5D56CE251D376376404CE743

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00011F0D81372C426040E66F52E32E98F097845EC393F1CAF0C21110CDBCF3CE7737

Previous signature

1A4349BF9DA07A9B7E3B7554DC357BC4BAA34D8783A02780FDC318A560266EDDB4585E4956BF48BC19A340DA563071AE18AF2CAF8656D1CB08758C847C7EDF03

Origin signature

3044022047C77CF178A1E65E5EC9CD40039D907338128CC6F4273C29C1E5CD879185385502206D55DF8C417CF2EC3652BF720EDBB0D7B159E8A3ED491CF0350E67A18DD52A12

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00A8621ABF8F618816A8504C51B19CEE3AACEC41DDAF7BB6AAEC11AFB355214E5E

Coordinator signature

B32B50CB295ED495CDC51F8E71A3E22D7FA3D06A92422A9DBAB6E00B6B8A7547F38E32F14040D9131BD7EFA9A7F05627FB0D860B1CB11D3BDE824C45AA952805

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

F658C74AF7AEA44740228FF7AB8F85DA74B07F5EF107AC78E5D47DA871A207B563784A914C61EA545CAE5242F003B916BE51C495C37BB18541E1FB579990AD03

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

D2F6CBF22A041C7BE637CB20A55C8DECADC2E35FFA0622C53E675B038615BED3DCB1966D56564F0DA7FAF668AA8F6D91D21C647B99C187D833F2E347FC302401