Type
CONTRACT
Validation date
2023-11-21 10:09:26 UTC
Fee
0 UCO

Code (946 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x75f58c2c4d693df8b1417b1a4e7e7f929695e3a3", 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.00992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    ED2C47E53720E4BF5EA371EFB568754E366B95A9ABFA66896C3438F5C983BF624AE6049C752040A8525ECB3CD9A7870C90F24CC4F9742BB85474555C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001139B339A063502F75F5D3EF6986E117D55166A224637174E7E197B80B940BC31

Previous signature

2CB0C8EF70DDF612EF8EA4272EF90A28380BD3C1A209D78CEFB4F510588342BB5B7B12AF57F632B157E14D9E3786E3ACE41869F602FC2A8B1EF1A526EE84FF0D

Origin signature

3046022100B04B7FE77A88355C0D0673B0322960B3DE582ABDB28DEAABD6EFC89F49AC7367022100EB2C3614F0650AE6BBD1006EFFBA84BE90DA7ACEAF49854E15789114901A3452

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

001ABEB7124C90638B073986F2A6B0548FD2E809258B60EBB1767CEF282C1CEDA3

Coordinator signature

C83F5CCB7B816220BCC1A87CA32139B9C6504183117CFBD86FBDF3FD3E5441E399083D1815A08CF996D577D078DC96EB4008410C0C7DAEF83B18750653018809

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

46C4B298224BE53F3D18E23ED848B090F989C60195B6AC447A692AFD1050C7A7E2A394B0922C8D7D0059274DBEABB23896BE4063743A73C252753ED1C6B67707

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

3EAE0445EC78CE20C957F55AF82FECD6C18FA5896B1F7E2B174E98B44DAF4615B260D54140581BC38D09E265FCA271B6C449E1FB09D299554AFA5793D2B31608