Type
CONTRACT
Validation date
2023-11-30 20:29:03 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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: 1701383280,
    secret_hash: 0xDB941D56D9D24A367D006B43ACF758FBF60D9C7D9EF09774771AF9A1FF59E73A,
    secret_hash_signature: [
      r: 0x2FD8A9CEBA6FA929F8406952841E1317AE21245DDFAA56204A2F800B79A080ED,
      s: 0x6941682F7D62FB05E0716AB4CAC16F82AA1008852AC5CBE220832552F3483278,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    BBF82E644F177F067421EA3A827F8D1B5DA5B9C898B5BE87A1AE873B5B50DDE7AFE5C65B703D39A6AD65822F3E62F643F244487F3B783D7952C46747

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EC2C1CCFC071AC46D7BCC559A383320BF02E016F93D48138CC219FD2607EFE9B

Previous signature

6665BDD16CED3FB682DB2CBF0877E5C7A4D21B43237FCB4F05475C52DC35E8DCAC28070C7A13D4B164AC8C75D8312905BB2931A9AACDE50019D22ABBACBD5508

Origin signature

304502201E4FF3DB425F814E429604EBF78C695FB0F616637202BDE4E2357B3ADA936FA6022100E880AAAB191E07C33BD4314253E2E7C33D77359AA3CD8DB8642A9E0416FE1A3B

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

003E02E35D046B508E28F4AA32B69F545BFFD62CDFF38CB2ED24A64171ADB5690B

Coordinator signature

E822E96EEF48B3494F30163F77574246CBC9864F4F10A06B272BC2A727E490432863B726681D250B25DD31B2A016644AD6CB01B7D7A969BC5176AAAA9C800C0F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

795F914B84E59794CCF14749FAC4F6BE9284BF9E8C2E66379F4981BED729DE2E64E63D5E3AC85D639D9E98906CD28BD0BB43C5D081BB58FCE743FCD6691AB40B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F2E0EA6618E0025D13FE34F63D466EC80AF4ECCB34685F58F96B3F9159D189CBD05C556F3E3DEBD8C957422C5E9B951821DD91092DBB43BA6CFEFDD35F660D01