Type
CONTRACT
Validation date
2023-11-22 02:48:07 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x1d0216ee142eae9b0e92fd166f491892e011b667", 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: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.0992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7F4937E87ABA25795698D05F13A3F28688D758BE86F22383A13B50F60ABC34960A733D5257F970CBCA4C4DD9EE6FE5A3CE4B9867149C385FCB7DC8AB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001D537ADC5C0BBDF4C5AFF43BADC00B53D34F420A23A937978AF6D6146AF889B29

Previous signature

37FB668B2D0228D14E2DD6A3BD46246BBD4797353A0A39282F6ED0B18CA2875E6270428F3240C3C8BA44F12E000B8E4150266B53F066AD3835F3531A0093B100

Origin signature

30450220368E7EF4EF88A2C7D9FB4CD58F2BF3EED8D0F8306E1F60C2B1C93C07FEFCD600022100D1C405A7100288100EFC6F60653B9090C3B7C4C0C7D9AB33A5FD9645BF740F6F

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

0084CBADE2892557113EF5DFB4B854559D64CB1AD7281143794EB7CAE9D49C746E

Coordinator signature

C6C808CF48D665E560A422702FF095C08BD6E997656577879E5F7FD2E19285E89901287DA1B8E4CE8E2D4E59B7BB96006872C4F27CDA1969710A08AA5E89AD03

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

05FD8442BB7BE4242F027B5B1EB61AAAF4AC47AAC46EBF989D5331D9396CFE4086F35403B51FCD519FBC16061C74A729271B62DF442F9224CCDCAC11DB5E4208

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

CC5737BF9E3F35DD4D6623586F197448C4F6CFD91BA73D24A19B5AD399AFF0CCA02B1C3366AA2F86363B5B26D505D52A50914CBB7DB3494DD3783D69B3060B0B