Type
CONTRACT
Validation date
2023-11-14 19:14:28 UTC
Fee
0 UCO

Code (943 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3CA47FC9C6D01E0956DBDD605CDA874C670F76A6CA0E23BC0B6AD3ABB38083C0ECCBAEECD321831BEBDD3296D09F3A1FB48565DF93BBF04640027C9B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001DCB40B5284AD5B1B6AA7464F982A7A4BD02A0E1578EF4D39AAAF2E7AAE125939

Previous signature

A688B75C7A909D66E43625B5319A8D5798EDED28C8C2C2E4B57947BFB1426667EC0BBA07C65982B3CDA70910BBBCF29F04F1355B17BC737F5B22D501C0FB0806

Origin signature

3045022078B36784158FB6455A8D84B1CCA3D993B788E3DFF2DAD707112A7241B3F2F2C40221008175D985312AF3B5F4E08C1F3EE73BB41E55BC31241039A063C4CE3F974DE57A

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

000C8B8F7437419CAA76B684B00148B3452FFD0EABC72E37A4EF073D3987717331

Coordinator signature

2A8D44065F92E851078BB06FA5FB3E9256943C19A45EC8CF3EC9D8ECFE7D15263182F46B00313697294FE83B9168525910FEF26A026DBD39AA9198D5381F300C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

02172262E4BB3A05661E8D4DBBF36CC960250338FAECF543DE11274A20327FB536A82721A298FEB71C893AA2D3E0E23ED8A3575A13E53E7A2DF852EF606AFF0F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

9F164A941C42CCB660957D8260E081FE818D87716C24C72414A231BE58B74E9202DB50147F7C9978467409633EAB890C4D16101156D8C9BDA0E601AEC26EC306