Type
CONTRACT
Validation date
2023-11-30 21:47:17 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 110.667,
    end_time: 1701388020,
    secret_hash: 0xCD7291784CFA296F3BD66313BC17C434081079B5142A0C1FD6976659951C62E8,
    secret_hash_signature: [
      r: 0xC31433545597E852D6A352073BD420B30A7A788D9295B77D5ED17D59305CA8C9,
      s: 0x16AC282706E7E089001C83D56D4D2179277434069132200ADF85B029BD32ADB9,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E618880AE5D99DB489A4EB30BC3C1DF15D199564EF074CB61FE819027B38A07DBE0ECA6AA55D1AE16FF3448F288BD4B8DF1D8A972F477D4D1F8D5A70

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001BAF23CF50A2102CC92DA2578E2D776A757268EDE470BC1088190D4202D960DBB

Previous signature

0E3337472BE75A27732BED86AE2803A94FD0929137BBB7CB8B17DB62D6EE1D71B62FECB9FF9E2FF49D73EF17CD3CF73F8F918D557A109B298606F0644E704F02

Origin signature

3045022014E08FC3B0D902CD0C8728D6CA51FA76F483D6FF837DB0323CB521FCFDC2E0AE022100F8FD2870340932456BB8919E064FC5E3FC627E2FFAEBF89412141676865DD27F

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00D3A8CA136A04987A223C28CE697363B7B946BAEA5D7471F05480E21904296889

Coordinator signature

7A76F43B4E88060D546E34EF15FEBFA183CA2B62E728A6BB9D6E19EE16CF228E1CAD2E478E8FD708AD9BC377529AB0C56861562B6987B11149A919D83EDD7D07

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

A063A762C997F86FB0602B86A7212C78594E6B3A6032BC6770E40F243CC184D1C4D107FC63BBC6B63F4DB58C48DA60758AEF08C43ACF97C0DB6598C7C676AE08

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D008240E5F90183DF58C7A8A2696D01FBF1D9CD180424FD229F9EFEE69083CF6B39C89DAECA3E87A511BC9F930E49E55A8B4197A962964BAE2C9B7C256C5D807