Type
CONTRACT
Validation date
2023-11-16 15:15:17 UTC
Fee
0 UCO

Code (953 B)

  @version 1

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

  Contract.set_code ""
end

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

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: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5A0CB3CAD9C0E3C6897D8A4AACEB90E307852249B72CC22D97A00619E44C7311F3F0B3B0D410BD8491352564E1BD3A6BC4E198E858E0D2266864D813

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00011A6225CCD8AA4894070A32A2402A955DAAC32C3FEDFDCC74B0DDE6EC550EA181

Previous signature

94CB51401E1F9C7467074F4A1956AE6477F9DCED1EB3BC47DE9143F12450ECEC2A9936395FE51A1D132E024AA4DCF29694D3349EA218C9F1887657170A5EC109

Origin signature

304402203CE5FB08470BB0A8E20C7175F0EBB266ED086FA6295975708FE2791C6389750502206A3F252D0DDFDB40247352430F065678D79BE3865CA1B3DD77F875DDF14C5871

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00BA8D2B40542A21E173B78312C2F028D94BDDE9E7F447E12897745228AEF676E1

Coordinator signature

A0F29917B57FD776D639C6B966780E4C1A8E5F6934137743522B155A76BB55829FDED58D929FA37336B21B92F15EEA2532D86C28CDBB16AF76A93B0BB14A4E05

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

4382FC1149555D57763B27108412D4DDEB970BB1625DC2212076DA3327D61A7E1C2584C3E1153D289553BFDD22D77138B0E98279BDA24CCB3B61CFD9D6541D00

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

155C1078C9FE0B82F723C340F1B273E7071952BC91D16C3CBAEA19A9BB1C2FB3BEA6AB6E13FCAE9C35ACFFDC647ACAEEDE6E81D06342F709D831F3728669690F