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

Code (928 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700226360 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008D5D4054C44E2D545884BD557D7E1CEA9B3669EB223C11CDADD6D99A1334F9F8, amount: 0.05, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008D5D4054C44E2D545884BD557D7E1CEA9B3669EB223C11CDADD6D99A1334F9F8, amount: 0.05, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
  timestamp: transaction.timestamp < 1700226360,
  content: Crypto.hash(String.to_hex(secret)) == 0xCFBE6AEC17DB0E030173D9EA251C714FCA7EAE26FC9779CAC4882F72667E743E
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.04985, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.04985,
    end_time: 1700226360,
    secret_hash: 0xCFBE6AEC17DB0E030173D9EA251C714FCA7EAE26FC9779CAC4882F72667E743E,
    secret_hash_signature: [
      r: 0xA24A2665041248F77576A768E063E942A5C7087639DDB88E96B5C86A9FB567B6,
      s: 0x64D1F9EF496D9BD7A3F376EB8C2E7CECF4C6CB07DF057B94BC2F800257C6F76C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    140EC9EF0983D87037853CB7D393C1133D6246B73C88B29EB3A4DA75FDB7303D58FE7B8CA8955F991A0CCD8CC0A829C56FF0FFFEC4E017640D6F8959

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001738498F1ED76E142F71C6A80F1B9599346A63593365322C5BE51172B0A2D6EB7

Previous signature

167EF9B22740D9B921DE8F352347FA684DF99FE9350E6775408891B7A88D33A62C82766B5AC7A6FAAC3FF2229285F8458A5D01CFE7E6B6CFE2B3B6997D2CAA07

Origin signature

304602210087AB5ACD5B6661EF1BA421F30EBBA1EA6AC27DD5C2296C24216C042AAA8C2B7B0221009BD52E5195942D21B6B5334C15082E46A877ED5DC5112BBCC238B549EF378CFD

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00CED21326A20DE7C8C746CC34E2137BA4362074FDE2C9EA2FEB9F13DB30AC2794

Coordinator signature

2EC0DD62170D9A517942A0B11955F34E7B1CC77DE10DA739A56573F1EFC6D0DFD90A379DFE8629FE590C0C6E1A182F7F37A38FF5ACD038BD119477EC92CC0E03

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

9C64B514DFAC37A276704725BF255B2462BBCD5432E780CB79EB7AF4F775A0C9554E5EA7221DFF2DEC2E0EA536FCB86CADFCBB6015748BEA65A50AFF689B2A09

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

65AE52DB2BB1A8769A4FC71244657576A9147FEFDCD17711AF2195E2FD480FFDAD501345EE85791722213293F3C26B0881571E0B4886E25DF4BCADACE8000F07