Type
CONTRACT
Validation date
2023-11-21 21:53:48 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B2ED708BE7A60422D96956E12329369618036A9971820D54C1D45BE2143514B0364FF1286E2719D30082C0927E6315FA82AA73B26039B5540ACE7F96

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001187AC277308502F6F33F4A72CA69C3C83E2F4E9A7380B600AF9B4B506D4AD941

Previous signature

60BD4C4943E98FCA8E33E206803D42EA76FBCF3476C6642DB85E9FB1B9601B6AC8EB093C76AF9C5774068E71922C3F91907AA5477F47B7A4EE476BF765933401

Origin signature

3046022100E29098A59A76709EC625DBEFAC3FBA97C4BC8181B825ADBBF8ED2A05438C5EBC022100EADD9DF9D4453AAD212C54854E053452580782D976558551A86864D9299A5D45

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

001D687164CED0134E78D126A7B63506C92F6F44F09B93463AEFB098E398953F0A

Coordinator signature

F3E2B676CF1DE337B32FBA64675FB0DD523812D5E7DF290C78BAC4B6FFB4111DDEAEADD256A605C97A6B157CEB502943BB3A9397DF9A93615CF1BF79F9BF0D0A

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

3FB0CCF3ECA1F95B293746ECC4715B0708DDAEAA544791D3DF411014EA18E9AB5C7FA7F7EB50D959DE91A7B27BD181787DC9583B1BF4C4443E6077D67091170C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C36EA8182E50768144ECF6487ECF29146C90C87736148273B97081E598D60E7D06979DC2EEA81D322C0E125DA3B9D7C93E224F1C87EDF79DBF5C774027122F01