Type
CONTRACT
Validation date
2023-11-20 21:54:08 UTC
Fee
0 UCO

Code (946 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xd632dc5f1cd47fd8c6a3342ae9ecb3fd9ebe4578", 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: 9.9202e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    FD12DBBD41792647E96DC8E54B9135799974C01598EFBBD6007B348D55A7255335C5CFCA950DCF675D286CD0433A56665BAB3F3829395B27D555A4CC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E0BB8A7DB64A4DEC79045B389E984AB9DCE97E2CE0B4B6A3A49972D0D8ADF426

Previous signature

825B9816F0A7E3AC3441AEB610D86B6A67BE7F837CD89A35763B5D3CABC855FBD0887031E343E897546C783443AE37D5397F0FB9C398FF2FEB33921A1B4ACB02

Origin signature

30440220034EB8B39F2E5084284EF0D892003407DBCD56DC26A64B433AD571DB7CC4CDCC02204ACD720C37E02D06AD4A239C8DE8AEE88A079680E0B4EDE51FB89DD3B0FC7C6A

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00B29488A9E694D2CB0784FBAEE0EC110605AE0EE1A0FB30D002806E628FD5DD97

Coordinator signature

CB4A19EE57C05A94629228EA2697D438F539E2532C30DB058DF37C541630FD5BB30E3BC3A1EAA82F84A68951AB446FB90C9363CC8A8CE609692764C1DD73DB0E

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

6A556A187926943FFBBBF30CA4B19F20C7ED572AF8BE2B2C687D1FE3BC6B043BD2E1B40E94458DCC4B4165FB1EC2A4C372EAF9A7FCD089FA09A3D1CF9AF1380C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

E23CCC4EDD7DD5A4C128FC34776974FB071C1B3A092DF571CE9C7D048271E6AD681226061C326663DCDF8C00FBA86A67AC45E1DC58424B3114411ACAADD6570C