Type
CONTRACT
Validation date
2023-10-30 11:11:08 UTC
Fee
0 UCO

Code (945 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698671400 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 >= 1698671400
]

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)) == 0x22A22E199CDB8ADCA608A22FFDCF6E1D65668F2DEC9357DC568A213A9F33ABD7,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x701d703454438b29bfd29692bfadda1f80164e8b", 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

    CE2E7717D5C4E6DAD77D9EA9868D3A3F8D01B0FCFCA8E56208F36CB19BF97531D4021AE50FD96CCC0734C73E29DB485E2990174FD67CAA0902ED23D2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A87D2AD236CC9B3FDD86F0128CABDEF661C201D5BCB99143B06C6C1209339F8D

Previous signature

E13888696B40C2C3E9D14FAC40F5C399EEBB7FD33995578C7946AB3351CB17182023377E782FC35105818D4C34F12FAE56E4353FB34B0E9AF2CDCE7CC188E500

Origin signature

3045022029D34B9359E89F901DA919684279DBB93857FA915938F0D057E7B76E0B09DE4F022100E86BC33F0435F8CB85A3F546D50BE011A227BF9DEE0D8DB829EDEB6C7070A8EE

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00293E8CA1DB6552608CCBD7B5777670F441BF39E3B3AEC5D729191CFAAF5F1D05

Coordinator signature

81C594C2BA0F057AE77699EBF134CB94C69AD4FE88463183E999C116CF6FB9B0CE13596EDF689F5F9634B040ADC1ABF91282423C4D50DBB5543B4C3F0077DB06

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

339FFE47EBAC16DD67DC49568321AF3F7D45C2D7AA05816DC1DF2F42BD1A332DBC2B3176BEC3D7C08C99FF9751B892EE8A8D982B62174A861C9A2F735AC28508

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

36E5B97D33E38A62411E3F3E2E7E4477E3B6FE74901B5EC21A7DCF89819D953BC308217C31C4799B12645DF25EFA0A0DC344771F335CE5AD130872E2F3B56C01