Type
CONTRACT
Validation date
2023-11-14 20:43:45 UTC
Fee
0 UCO

Code (952 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xe200341c0780d81685b0ac1f34efce2b586c92ee", 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: 0x0000B2EB08BF3D472A2E4141D37FD3DA8B61D0E58246B4F37436A5404C6151BE7FFD, amount: 0.0992015, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B05DB4DD640765E15BA4B921313D0224F2A20634A7E7F32FBA75D2A57E554501736D0B4ADA41C5BEF6169D97EDAE66E0C8B6B732A2DA1EF7C1F0A355

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00019458E175BDE52340E2E470F04160A2BDB3CB9CBACCD667FA65F0415EBCA836C6

Previous signature

B9CE7AEAD9D05B12B9F6483B60C91DD187453DBE81ADB26AC857827D643FF8D63D40402AECCDC24C7E676CA4D3DFA5E4BC209115E7906EC1BDE5506428318005

Origin signature

304502205F32710C7E6E5ABCB3DAA9CEE041DF3F31FE8CBF95EDBC48E11F8D58AB25FE5A02210099CCA122B8FF3EB414CAE32463ECC60FEEB68381F12E28259B71BA9DD5CDDDDE

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

006A351A9589C08DB526EEF363BB72F87E957FF285D9D0D62C5C2329065A8333B7

Coordinator signature

C9F4808408507B9F6BEF6623BFE7CE179F638392A246323737354A4FDBBE204B2720DE6D4E33ABFB4366D9E73E0C6195670D06C8FA76CB656E944FACF8C0D00C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

FD25858845E21CA1D4C53635C1612290C3C93D4AFF6A5BCDB00A1C6E327867271329D2363A9F88A72D17E79D6602DB202A9E739AB3A7DDB6FB6BE2A65EAD900D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

16916C5EB65A5B55D0A6A8390CA2E232A11BBE43A3E61CC0C5B8139ED1B1ED8B1D504CA12AD72BB81365CD75D1DABEBFC7861CA40751C07DDF409E3EF1167F0D