Type
CONTRACT
Validation date
2023-11-15 16:14:19 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1700072040,
    secret_hash: 0x2A9909CD15609A6E77234A687B7267F0F4F0120487F3765353DDB311895B36A2,
    secret_hash_signature: [
      r: 0x9DA51E16119C43D78F2FD99E569531C13EC4B29DAC1707019F8F4EB12C066332,
      s: 0x0738EB87E39E745CBD72393FBB8D0C3BDA1C84CC75A2E2A7C40060F2C8E9A8C3,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5C3F6BD65E2649B642D81173F1814896D741E9169BE83A30AA76803FCFF22A6DF797BD8C46800890AF1358D8E4BB74C939F5EDEEEBD65D098A06E1EB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000108B290303D065C87B0DDB1B1C6A6D99979DF45D44B6C31C8DD3D65736CB2AB73

Previous signature

32E458DE9F0811E8CB3D2A0E9F6D9AE2ADDD9E997B7266FA6A67A8576306A5CF9CEAD8267EC119C2BCF8DE5D2179A9B0BDC04DBE0245B4ECE4D9C25D5E85130D

Origin signature

304502210094D946C245267281726FD4BDE10618DC273704DB99036EA539AAD55C38C45D190220595423010EF0C6E5801949A4E47DB9170ACA524294D1843151EDD9D901330004

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00608411B53D58E2803A6DD0C0731F74AC9106966CA76ABA45574023CD9C50E198

Coordinator signature

CDF4B0BA262FF554E867DCDA2AD5BFBB2DFEDDD77C8868D07F70207DC9613C3E7B709C19DCE41809E81C29F3321C184F092AC601667AF4B30A44E9D060694200

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

F59C211BA65B439F8DBDE47B22820A27C4BD5513CD32949AF0E441FDCB3AAC8F7E44181784C73F87257999E927F641A08D1FB9D140331A318E196F2242689E0E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

2A8CB02C1844B45162A6A557D0A45EC17AA82F35D6ED8CBF3E68140D2499749CC0CE83CF60012B02D8E910289E759979112E6C62F929719B3E99744CD0333F07