Type
CONTRACT
Validation date
2023-11-08 10:32:15 UTC
Fee
0 UCO

Code (933 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1699446720,
  content: Crypto.hash(String.to_hex(secret)) == 0x3F2CFAC6B9739ECC4A06E0C74C94A43C88A32548BEED0623BA9EB811F5B64E56
]

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: 9.97e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1699446720,
    secret_hash: 0x3F2CFAC6B9739ECC4A06E0C74C94A43C88A32548BEED0623BA9EB811F5B64E56,
    secret_hash_signature: [
      r: 0xE195336525E0843C0D5454971947BCF4C54B05A5A7C9A21B2324F1D739BE69D8,
      s: 0x0AEDAC3227900BA1F6A94269E1B577B03BBDF384132AACCF26E779E9B820B7B4,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    75D6B930A975448966E393445E1CEC2848B405D3DB45A99388E83DA2841063ADCAC37632F0ABA9834D5CCC35C0EB682474E963147F82DE8D3814C11D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00013E19E57C54826CAF2CB5C5B9A57A7000683C70A51079D7FEA4963CC4CD5B5DEE

Previous signature

6C0AE8174B86B9F3EE903C957422722CBA252EDA32B891CD21989738DBE7EEDB5DF8AEDC9C2B8F7ADB0FE7179691EAA2A4626A4E1ADA9D7AF6761AC7FC8AA80D

Origin signature

3045022100C18F507AEBC2D59CDBF304F0C4A2E38D054C8EA906BE17E3FA4A544BAC16167602206FDFEDA16560C8B4BC421BC0DFD86B752A5FF6BE2F952BB7D24C1CDF0072339B

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0046A19307C4A83B18105CE1FD367183A0A72E74E9A54896ED1A03DC0A9B6A2AB7

Coordinator signature

26607C8D18FADCAE75572ECB33F51F1000767F4B4C2CDF1838FF7D0FFF87B5593A2E3D2C156F179698D8AB0CC4AC85347024ED6CCD38EC3DF7CA268C7E02D703

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

5F62907EB7AB6BA4BA8B2E43DB916A16B4EB16368813D6F6A5F1C4FCCF69C05171A623A6A5C8AC453D2E05BBA9E1946F5446D7721FF1A4E353C1B13C5B149D0A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2AFB1156FB224AFE307520788EEE62AC93D8CE6F6BBFAEB6B8B3B6F4242B62A4663A0B4ED98BFCE8ACE0172685CA041D65EADCCC7E26FDB9B60DCED3AED9650A