Type
CONTRACT
Validation date
2023-10-27 13:57:33 UTC
Fee
0 UCO

Code (928 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698422220 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""

end

condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [
  previous_public_key: (
  # Transaction is not yet validated so we need to use previous address
  # to get the genesis address
  previous_address = Chain.get_previous_address()
 Chain.get_genesis_address(previous_address) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1698422220,
  content: Crypto.hash(String.to_hex(secret)) == 0x5FBA4ABB1334BECB4DBCBC8075CFB55CF547F151DB8744B37F15E9458E92E6A3
]

actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do
  next_code = """
  @version 1

  export fun get_secret() do
    [
      secret: 0x#{secret},
      secret_signature: [
        r: 0x#{secret_signature.r},
        s: 0x#{secret_signature.s},
        v: #{secret_signature.v}
      ]
    ]
  end

  """

  Contract.set_type "transfer"
  Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 9.97e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1698422220,
    secret_hash: 0x5FBA4ABB1334BECB4DBCBC8075CFB55CF547F151DB8744B37F15E9458E92E6A3,
    secret_hash_signature: [
      r: 0x1B959F70D7571E0BBEC268E692457AA150F434636D9C60C7E550F5C7CEE64086,
      s: 0x20D5C4F821B45AA9EEEBA1528DF20A207DB94E4CDA9F06F4E3E2433A6D8CB9F9,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    43916A593EE44D34DC9C409BD76F279C10B95DC0ED1DB110244C7E01EE11F397606D170BA0631DF011A50F5A39569B135A2B4A2A129285AF5B52FB1A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00013670454B957E6A6E074BD448CDD17C7D3367984982E257219ADC85D6D33BA633

Previous signature

D6FAF4759A5F31E7536D7390BC8A3E83533A8667E67427BCA3D1B12307F05D0545EB7173FD3064A9178FBBCEA57F5EBE98F92A5C50467BF99788842830F18103

Origin signature

3044022007A44363CFDBE164B5122FC3B51569760CCDCBE7B7A43E260A149F7C874E38E602203CBDD9BEDD6A3184199FA5237B3EC39369A035F774DEF72012D83D2E443F62F6

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

002B0CC93B9EFDCE812E22F859B96EFB0133F40D45C5F234FBF65CAAF33653B041

Coordinator signature

871A3481213697A5E0D48DA96000C9EEB5FFA8F02262E304663FDDB8F28530394E38A00D3FF856E65390B54135AE62F21741FB6B3DC48829CBC77AF55E221308

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

AB6E2C8C2B1FADA4E67E4864FB45977C47EB21BD12798109A270425E734B2F9D9955D243A2C1D29CA83B2A3C480915BB5E8BBF9CA27222C018ABAFBAEE38FE05

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

CDBE35C6115E0D34113E1D835D1F775DC834DBA46D9EA82CF319D6D7C15257CA997F88A52750A72421439815780B290EC76413001A3ECB56EBE32AD8455B9F0D