Type
CONTRACT
Validation date
2023-10-23 12:04:58 UTC
Fee
0 UCO

Code (949 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x631fbd7ae16b55d53ff9bf64ac79ae654e5b0f8f", 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: 0x0000CB30ACA5320066B4413E9D4190EA13562F3225BB5F49A975ABD91CFFDAFED88D, amount: 0.2976045, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.955e-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

    D66BFE74EB1484FAADA7D02D34F17BA0979224AAD8CBFD22758B6E7C590B3D52B03F8CB939DD8D5536362CD043F901FB476E031687DDCA0119C77AEB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A9933E2AD0DE778893BCBF0C5C35B1579E37E5F6FE3D456AB9639694C5CC0EF1

Previous signature

BF6B11CA2C1401118616D8BE00D33E41398984D04A45B6EFEA0D074725C1A7D0E26963105C9A1421011155E837ECDC10EA0B42CCCDE7C670C707231FE66AA000

Origin signature

304502205168ADC0C5B27E65BCDA38356D4FB4792101ED3B9AE3F6EA67C72424ABC89D52022100B58DCF9EE5B03376313218BC62CDB27556BCE603E7AEF68857A37EAE63CEDBFD

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00E45BE23348E36FED1F9C6418793ED72DDAFD713C78478BF8D608EFD0DA515CA0

Coordinator signature

FFD3A13A386AFDD121486B183E6AC1EA35C24C34700788B20614F9CAFBA13093AC8CDC5D4E1430CCE2E0234DB75F0F37867B17F4B5D5B0F536439D446150E80F

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

17E37657D322B115501F883C799EF85B6B6C10993913805824A885CDCBF82ADFA8F4DB55A7525CFDBBA0E43B75F685DD388320E4A3573573DA5F50708357B90F

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

23EF814112E500FA20DFF107EE2531312543C02314C9683B5A2A8D1020FC9D60968B89C265E05FCD1757FE8893D4573ECB4416B187B2627B4E1535063C3CD00C