Type
CONTRACT
Validation date
2023-11-13 19:41:48 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x4d0b7fdd6543fc7edb740fb5be4e903f513393e2", 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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 0.198403, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-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

    DDCF1F258492BE8973D989DC0A436B39044A4B5829ED2B782CFE3328C0B638F5084E11B360C8E45DDAAE28A571A0A0E4DEA60972F07902D088225947

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000154B29F6B32F7462CC523F262BFFFDEBB0CB1E29727DF01A98AB7F722B6026C04

Previous signature

F007268640E3F775A38848FC29A2ED713FA87ACA31443EA3169404A2A1516D3E62F2C6BC0371124131DA2FDE924ABD892741F31F0B6ACC5815B05E76242CEA01

Origin signature

30440220653ED7ACCBEC85240A31B728B9AE888E471061FD2C1ED21993307DE6BFBB3EF902203567240F46B0AAE0DFDCADC892CA6184149CEC78DCF32D743E9E59E29360E82B

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00732B88AA3B93332A1887ADCC39E009146FECA961B8DA9FBF024F07B20E53E304

Coordinator signature

F20069AA14A436242FBC4F4EE6EAF493017E8B8428F1673DD29CC388929735BD59A41C1A1CF56D36596B62B1D9B0DBE033A2CF29C1C01F861E05030DB29BED01

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

6B2A3B94EBE611D13519A9889F28C08BEB564F1BDAED91D696AD74DCECE0764B876B1ADCA8E067103BD4D1EE10C3920B86DE93EC17802ADC01D95DB7D9224305

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

0FB1F030424199EEC764E9F957E04BCB93CD9F1A12DB7578892B4A60D8224C3C799CDD3136C7785778610B753F37E082F4B1E7FF1E867AA883044B2D552CDF04