Type
CONTRACT
Validation date
2024-01-30 18:07:44 UTC
Fee
0 UCO

Code (945 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xfecc2690cbadc0b640d82dfa04fe03c02d5dee49", 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: 0x0000834AD179A291856494A6ECA9AA855AAE0F28E5F221666CBD11D2FF96B2A0FE19, amount: 4.960075, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.014925, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D33D2D46C61BFE2F893746A2FD53BF5E4C6CE014DC9E5EFE0734D4DA2F18F815F96BA4E6DD1DD09257177F28BFAD8FBE54BF615DD59FFDBC73C823AD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00017DF6B1A1F0C287F4B582DA061704BBE76DD18656D0E6AB91689474D39C39E7A1

Previous signature

0995ED3B6A25E39E53D59CC060F4EA53B1A29A6595A1DDC6F6DCDABE23B7B51895AE669BC965612A38E40482873A565B4E2DE3B10F1606ED4D5A5E4DBD27CF02

Origin signature

3046022100D4A016D2890776224B6A922C089EC80AAAEBE28932A4AEB24AC0E30E95E5C6F2022100EB2AC98E9FFE12751509CB35587A743E356CBE3BF9DC61F396D971171F526BDD

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

007D8FDAF55949128EC3BFA93F2AC41668B231106EBDD16AD8032C6D26F37D2C0E

Coordinator signature

337971E32E1B4D722DA13BFDF5686655AB699C06DCC6885CDDDB70AC62321F749029DB21D6BE926C230CBA0B6233E39C19C8A6CD235DA25C93F233E6D686B90D

Validator #1 public key

00010F2A0E4C424582A94BD90E05FE6931628F91988ABBE387D365994F1F3FCF5A12

Validator #1 signature

5864C62BA3F56E31C5C6089E6E29B5D1369FB3C099EF639E6A6775568D629B2D607024B1FCC0691EAB6224301D17E4624B003B164AFBB925C69DA93661ED1A02

Validator #2 public key

000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0

Validator #2 signature

C4B3B3A7E19E10F6DE93B9A5A995EE73D8C0229B55C58CA15A55113496145DAD5A66B7148B3149AABD010F9AF271E446402208E9A67F3F4C0B6B36E0E00CB30A