Type
CONTRACT
Validation date
2023-11-19 13:12:15 UTC
Fee
0 UCO

Code (941 B)

  @version 1

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

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

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

    CAAF8BB94E4EBCB9B00CE89067E69C8C0320E8370DE534A0FE5769980C6FBC43C1AB7627DB2662F1EDD2CEB02420FC108037E802CB1E05B465C40BBA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E8C47268AF03773EDED7B9D8ECE41C9800737073A9ADE1AEFD761597F50AB202

Previous signature

5E04FA6A0DBDA7161C57176AEBF91EED8032F509AFAC849AC3DBD7C28400A5DBD0E3843977BB48663F1E407E24873431381038A02EC35E4D1629FF2B7B058D0F

Origin signature

3045022100C581379D77621C9FA8CA79F6FFD81ACC18B04A2B053B644C81FE4083E4618CB1022039E25A2F20718ABFD599496781EC8AEEBA991F5413A510F7E7A1A4141C4287B9

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

005A6C18E9C535CD2D86EA07613A4236F5FEAD01C1D4209C4C085625766638D33B

Coordinator signature

45479B1F993001BCEF2847115A011BE73209933DCD3004F4F6511510CDC3621CEF16837B107B9B32487F142EC910F68AAEDB547590A48560CF3C91F792C7D80B

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

6071F84CE7029236DAFC447385DD0DC16556B70C7C994819EE6FF88CF62E0AA77D87B10D2F9BA3DF1EEA37AFC74F1CAF692644090959960B9A97F5E1F8EC7C02

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D6E26C0EBFA15B8248BF7E42BAE94B059DFEE429C7E75D4525698B10A25A7D14B60CF529672E78BC156FA34D2EEC051F16172DB689D1099ED6AF6BBE36E2C005