Type
CONTRACT
Validation date
2023-11-14 23:15:09 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    BC3A15973B9A5BB98042A742E6FBAC37BF7E34281759752658035462F5575B6E09D2A6CD44C965AF63D490F7AE2BA152CFC6914759886DE39C6BE925

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00019211B2C75919596711DDFE18D6D60D686986AA4FE9D9815AAC8976D1AC1CB6B9

Previous signature

5E82497BFC2E607B0C1D4435231635855A73DD1E34923C31992812C03F145932D28396EFFBC56CB431959D0FBA3B4DBE9C913A510C7463713D951D89149EEF0A

Origin signature

3043021F38CE21178D793B444162FF6F7DFC5DA8B1D2C7F46464EB5EB8E93B13325F2702206C903A7E5A37712BC6997A159905A9918A7D063C24910B368EBF9A9E0F889089

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

004140700164F0AD9A3B14E81A92C2E43C0526A3CDC7689A55B713ADCC6628EFC7

Coordinator signature

54BE2BE4751A6BF034E885BFCC4363C2AD8AF6F6DBFF3649CFE6033CCE4327324D79766F45B9A183268C1F47399B1FCD7BF547563C24306B7C10F3AED1763B05

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

664436D7B90F6FFAA242ACCAADE214FB5C6619C21D1C54A837DFDD5BAD1BEB3F417F811E83630CE1B1BE0A86DFFB10CFCFB3B5566EDCAE872D84C8C8FDD1830C

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

5D7BAC318C1D490280543786539B834741FDC2A24FD3DFBBD52EFAE5B38AD933DAE532CD15301617381DA9B380BF37354C3D658603CF172D03FEAC49DEA9640E