Type
CONTRACT
Validation date
2023-11-21 16:28:28 UTC
Fee
0 UCO

Code (941 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700591280 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 >= 1700591280
]

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)) == 0xB23F98DBF5B35875326C2073E6FCE96F9058FB90BEE08053D63C0EF8D73EDEE6,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf7b38243aa616e325959b7600e58b26adb995a96", 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: 0x0000647409F94DE9798EA91E049B9AABA07B8CF3570A22056513B3437091C04B6807, 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

    DC4251E2627835482353D6EAB572683D626C0A973C13BF893129CB8C140C05F33C3CF82397B26C94B43B4152886B2EAF6B85BC4299402A79D1E52BE4

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010935C2D70426B1D536BF9E8015D3FD32C57BBAC306EB9EC5F72C121BA96DA6A3

Previous signature

1F864C9624B03CA9F5C9329FCFC0FFDFFB0088E880B0AE54DC3EFD9F718C38C40EF7CB229DB3CEA40E0892C8D7B25092EE39F95EE972331244276B6CE4586B01

Origin signature

304502205674EA7C2E828DC844B98F43166D9F54434D2BA067B35611C12B6474ACE9EDD7022100D48F127C14F83E3583D89FB4295666A05E8025B052177F377730322D0E045597

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

005D2EC3F47E0C88C353EE1395F651C32C0C052618288DAABAA9DCC3B94C46AE7D

Coordinator signature

8FA48EAA60FBDE7845998A4D1F320CFC200362A23FF367F92BCC4550E4B6370F8A030921087866F40F1CF31D91555775351AEA8C06F39197988F35B3C0BE7005

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

25BDD438853CE335ACD0E9153867ECC2D2913B6FA5CAB19052AA9A3B11FEACC810A2415F88B88E83EB56A50A0D644C0189F8F8BC7F3325173A37E1291A696203

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

3EEB7C974A3BFEFC98F7776AC7F4552351998A72FD1724D2CDF5311C2293C6BA4603C8B51545C00F2256B13FDABBC42114678E8D02E21747F89339A71E93BC0C