Type
CONTRACT
Validation date
2023-11-13 19:56:27 UTC
Fee
0 UCO

Code (954 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699912560 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 >= 1699912560
]

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)) == 0xB88FBFCC8B1FAE08002B2DA203A796E7B2DBB2D31D2190FF72CBA3C6F395A930,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x98b5022af42cafb7d630e0bc371a89b649eec443", 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, 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

    D6D5945E07A863B455C44E1E2BC3DAD4056CFC5218307C7725BFF7A08142BA52CE2E58465BDFCA1C1526B19D0D8F2FFF96834932AEA9CE9275582D12

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001C176A9F7D2266C2ECD238C9D0FC64781A09E1430E7CF23669A03426E3843DFAF

Previous signature

34C1B75FFCB2020AB7AF72A91A545BBB9FE43193F55A17B8228FCFBDB6FFE88321DB5A7E5EC98E6C59E09236C1DEDB312BE1466876239F101360663F9212F101

Origin signature

3045022100872D54C21441427B4F022E8467953723CBB2955D2D4E26F1A131142825958B89022016B4EFD2A2CE9BC53A55C991489325359553E193694DAC912837733EF399BF49

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00728A2E0C119A9F41D517C5E41A7E604FBC8B00CC5E15E3C7A1FF3E2ED74DB1B6

Coordinator signature

B65C267D623061D7710C34AFE46EDE2FDB37504F0036231D582A03003778B063DFEE94E574F04F386F3528A6EFA27CC6BED7A6B65024FB860AFA2947CC6D920E

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

7D5111BEFF1D925CB0D56BC450DA6B41D553DA2B8C376334FE5E5CAA78C956C1700DB7971D401662C81AD527DEE6C0CCA8D3C15E9C195A1CBBBC43C304A8B20B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

906F3C45E3DD57800959912BDDC683A139FF3484F3C5AF26A523BDCD5FDB1604F8B2DBBD5B849C32CC619AF9BA76FF61982E1E490E804A2E6C91BBB372F1980E