Type
CONTRACT
Validation date
2023-11-28 09:37:58 UTC
Fee
0 UCO

Code (943 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701171420 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 1.0945, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 1.0945, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

condition triggered_by: transaction, on: reveal_secret(secret), as: [
  content: Crypto.hash(String.to_hex(secret)) == 0x5CF667FE340102A2D277EF9CEEC59BA25E6F465C7C61716F49464F2FC06CEEDC,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x8f849cb518fb464d4b626dee05f8d1076ca4e416", data: "0x#{abi_data}"]
    request = [jsonrpc: "2.0", id: "1", method: "eth_call", params: [tx, "latest"]]

    headers = ["Content-Type": "application/json"]
    body = Json.to_string(request)

    res = Http.request("https://sepolia.infura.io/v3/3a7a2dbdbec046a4961550ddf8c7d78a", "POST", headers, body)
    if res.status == 200 && Json.is_valid?(res.body) do
      response = Json.parse(res.body)
      result = Map.get(response, "result")
      
      if result != nil do
        decoded_abi = Evm.abi_decode("(uint)", result)
        # Withdrawn status is 1
        valid? = List.at(decoded_abi, 0) == 1
      end
    end

    valid?
  )
]

actions triggered_by: transaction, on: reveal_secret(secret) do
  Contract.set_type "transfer"
  Contract.add_token_transfer to: 0x0000E3E9B897C1EE0DC7FE004AD18B4B23361B00861F0C4DC6FC85FEC6A762FF235C, amount: 1.0912165, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0032835, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    FD96430C0A4285FBD54C7FD89EAA4642571B38CC57F3921E1868CB56B6F71C3AC835C0A051119BF5B63E65C74C3342B2FCB0EA83C495AE657BD8E878

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016B9B49A6B230549F1937AFB498F41C4729125FE6290FFF0FDEA2CAE65BEBC8BB

Previous signature

80C98B0DC11557E3A8BC4CB76D79AE7FA76C444CAA1C05C8AB928FAD94B0B072CE645A3DFA61C4B3A6AB88EAF589CC7D6733CC2E193106CF31417A2E2F1D3404

Origin signature

3046022100C6C90F3EFBA15A548608C8FC16A8FF18E5E81C4F01236DC02C28C5E37DFE4553022100F33145B57786A7EA80D67ECC25C837E350534E0FE8E2CA44CF868F5A4194478F

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

0065B898BE23323751BDB488E273203146961F6A0396095BFBD6DF6B391CC95465

Coordinator signature

3F874CA4501388D707412A41BBEE6D753AA72A48D97AE1613FCCFC79518EEE5BC19F50CD66ACE679FFF4CFA93F6538FB9D94D32C1581DDF0C596F46AF6A91C03

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B01758F416852456BAAE3A732BB2354800DF5036F7C65D5014DC342194A5A1D20D558BF802DD08AA0AEBFA330CBC640F74601C355DF6D01FA4F851DD4B70480F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

D067ADCDEDB7BA9CC1258E6B80335000FF2FB338B6A4F748028F59050083AD57870A618506420D74E35E4BC435612A81A206B5DA9278398E6DA51208BC6C9609