Type
CONTRACT
Validation date
2023-10-25 14:29:12 UTC
Fee
0 UCO

Code (945 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xb13588033af6ef8b4e1b684f717242fbdbe6fe9e", 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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 9.9202e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CAF753811D1A875EBABF97E1D02D654EDC63D37FF080F152130B24C032F44721F3B6E0C332EEC83756BC6F80A25E21DF6EA148001F0C607A8A67FDA6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00012EE57F28013F8495431F1071B332B265D7966F9E8784B06330FCB08F892146C0

Previous signature

F913DB8AB0840C9BBC1E6EE3B544AB79876E61FA63374EFD329279B252C0B92E345CEAA79CEC494B41A8C4010E90B2506E298A10403B894289257047D2EB3E0B

Origin signature

3045022100CD01730DAB47DE7F14E054DDE4DDFE02D5BBA65DE450729E0D6AEF2D84CC421A02203125621EC8795F8DB2B9B4AFDAA16353471EF3E1A01E43E3704F707F9DBB030E

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00F50D60CF1FBF759A810E558D6D7DC366BC3DBC86BF23A370CFD3F76D6563A724

Coordinator signature

2ED148BF237A36FDDD96B06CF94BAF1E031C774880CFB2AF4FF6F8870420B592E9CB90D6EB7090015903B3C3CFFB1C0F13656D90314077CECD576F9F0CE04A05

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

1E8452B441DFE1BB5A2B6F2AAE96E1C841FED7E9643CF3DF82C2C566B379664E46115E5F8C90E7E3B8E95C67AA2076FD815D64E91B4E08260D4842019EE81B04

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

CD8B15BED0EC8C1F5E2B5A5BC1AD53C903ED17D1B4C824419E591BA093DFB0B5A29C650FEC7F8BC3F0FAAB642C354B68D07A8BBE79856B83AA2F2F9B679EC806