Type
CONTRACT
Validation date
2023-11-22 00:26:16 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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: 1700619960,
    secret_hash: 0xEE378F59287A2C4B80011E695690676E20D7CFDE5CE68B746DD439FFFC1DDEF4,
    secret_hash_signature: [
      r: 0x387D4412A4E2CCD2A8499442BE8B12DCB46AEC221FDBB9D2914FD183C4F7E99E,
      s: 0x374CE335177BE5BD593F6D8DEAB443418C09C46F694C5D781EED41308234BDDB,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    77F30EDC874AA77127196E08AD2BBDDD002EEA285AF6730830524FB710CC40FFD85A99D9215659787961D8B5E65F8CBA612025F2273CD6EAE3C43025

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001B39BF4ED100D3A970BE706F11CEBDC333905F3B4EF7CB5E9DD73BCD55EAE6D62

Previous signature

AC33793106AD8DF0C3E4BA6403FE2114FB73A1026F356BD4A0D323A294B59F0B06A1CE0E23AAE3E3823DEFADBECF2D4315101A4037598E85295EEB62A5AB530C

Origin signature

30440220050CAD0E270B725E42A0FC465FA85C79C2C12D8B649607A9E7311431201F82910220178BC83AFAF42F9B89EE578E807D9BB63C1FA69DDA21194F886D5F29416DCB3D

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00EED6439FF12F881034EBA9DA99C0BF8EEE01802D5A7EFC2429EB90310345F827

Coordinator signature

830739A18C00D06D7E61B4BC572A638C107A5ECAE24BA081609EDE59FF8D28094D5B875646B4350CD236E79B0B4AD610F3BFF732A5801F3176EC309B77E1F20F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

7C920564D651B161FD456165B15757249743FB43D05F87A435ADB30126AF0C9D69939BA86759E509E570BB0C7F6F5F9282350ECD718925FB3C6CF4178B0B0100

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

0BFA22541D92385FE808E0C5BB6C24ACB21143C8F03CC8FD6C9BEF837FFBCDA866F2A133D5C0C3FE5A8439090ABFAD82B7DB461349439FF53EE64C1D7CC24E09