Type
CONTRACT
Validation date
2023-11-14 10:29:26 UTC
Fee
0 UCO

Code (938 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xc9a88f29a9b69684c522ccb02789921bed5327db", 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: 0x0000741BB0122172C2B4B8EC02261E7048A3E72B16A71AA4F2ABCA1C2E60F51AF81B, amount: 0.992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.002985, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    07EDE8BBB4702C12CFFC4F44508447A6FF115B74981B50D25244FC0CF5C68F866D33F33C9A133962F188A04520111CCB51DBB6576C1647D6EC051680

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00018561C55221272E459F760547872D7DD481176D0EEF3EC58BE8C8C3076123296A

Previous signature

38D10CAA2F75035638978312160F6E9726C0FEF0F4771CD1F2D1F10411EBA9A1B9BA7D16BD4DD8E6BDE4D13AE53C0813000477301F0790EE28B569781B346F0F

Origin signature

3045022100A19B28A81F5CFEE28DAE1CF050277C934AB0D4E6FB35F0B1DB2C5E9563B51BD90220688DACC64C122BB39D733E45CBEEB688A2F8C93ECE66886856AF9BBA70CAFC5F

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00A43CC4D326E5EBFBC7773A2CE9FF283EEF6868B11F8AC325B0112D0C7651A05A

Coordinator signature

9064419772AD93D0DE59C33EF99339C856CD2E2D423CC81B67AD95350B33B6D6B321D7DDC29BA7B8D9771FAE8710B52E2A0926B73AAB0201F12E65722D816B08

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

D6DAFF09D47337E03FD61253D84DFE698908DAC9709FE276F0CDE6FDA4B053F2B435E98A9993D65D053B76186FD5020BDD7D0E1706C6F0E3DEB51FEB2B8A8601

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

E7EEB4D8FAD781AE1846DC6971EBC1220F791FD01F8727C42904756C765730CBDEFD1D359FC664C3F2C2DC2BC0424DC613D45018E4EB1C2DFDA0ABC03DC71E0E