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

Code (944 B)

  @version 1

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

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

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

    E90AE5E49C3BC13A6BDA674ED2DA274030AD0CF844AFD75154028E77E017F54E6EBBA14E334EECEC4C7A86DA5E201FD081370E8A743964ADD16DDA83

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010B024D1616F79C76B3AFD160B6A93CF77ECE394EE52E1F26E094045B1772A011

Previous signature

0017917102FB6A2616E9CD537A074DD340173E44423E09E5D901683F450881FEBA4C38F80971BF7639F64DF83012369ACF42CFE9100F5D81531FE1C5E5AEB301

Origin signature

304502205858F14F0F181D21E2E682892AB73813245A79D809792DCCBBA2B37E4D48A814022100F2CD850E4E9A8A351B80111800359DDE921409B5F6E27357A70F094B4FF41008

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

0010E14B13A33738C738FD630511670ACE311B925D354B80614B88CA9BF25A233F

Coordinator signature

BEDE560B5EF86900F33A35166109FBEE474D24F7C42B2D9D91429C87D611D357238522E24A4304BF30FD992DCD293CC20064D05C8E3C802C0E42F42628CDBE06

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

ABB016047236909B657876E56110532B15CA6CA870E11C81B503FBF5100E23F47C3B48AFA348A27EF91A529D2BB6FC18594C78AB2C82AD0E1E2715977ED03300

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

7647D12B1A723CA5D04EA5C0D8A27EEA8AB1FED8EF7A63D9E5F6DDC6F39142E937BDDD4E1B9944C945D3300155B74694353440640106C6A3F8E3FC1A8B122004