Type
CONTRACT
Validation date
2023-11-14 23:05:27 UTC
Fee
0 UCO

Code (869 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700010300 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 50
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 50
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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1700010300,
  content: Crypto.hash(String.to_hex(secret)) == 0xA1E3C7BCB06FC1B26B3F6D42861664BF3FB7FE78B669481685BB103ECD6AE0F4
]

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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 49.85
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.15

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1700010300,
    secret_hash: 0xA1E3C7BCB06FC1B26B3F6D42861664BF3FB7FE78B669481685BB103ECD6AE0F4,
    secret_hash_signature: [
      r: 0xB5FF25ADCA15813E4C85A7AE1EBCB66ECB72E89580BCAB28AAE94849B80F552F,
      s: 0x0369F09BEC2C5C33A88DBB85109DD23B1F9C9EB47E31F9A74910DE04DDC2FFA5,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CD2CF70012CC455E1F32C3B6755C75B030725E1E04CE41EE6558BE783EF4B48B1115E675336C7D43F14B291C9EC6679A7AB8A6587BC7C2732FB15E38

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F3E5F925DF069D89D43AB18D5D76E53A7CC29369CBC92A6C7B6F1C62D603438A

Previous signature

9611C5E2328826E899285F4FCF79AF0A1B7EC0DAFB1F359FE19030AAE3F3E5B4BCB11FE8A06B6C8921BE7F4875498798A37839C7C65647235CD65A1BB48F9406

Origin signature

30460221009E8F2D98D0C21C8674810431F54A275FEA89F5E6C3A86A540F29C30F6F35B412022100C946D32EF4203B7D76173EF38ACA0345638C1C899FC57EC54F82F7E1358EAC38

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00A815C7080985168295688E4D86647DEE5E206F7FC609E54F9C6590499C0F46B0

Coordinator signature

AE8D46AF92DADAFD4DD42F8A105E52896A2F09FC5A7E7A739B517B1800014090D85233E997ACF9993879646E37F2CB4713529CA21A1DC1A7D6B1687A793CEA08

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

129F1D44A67727E373CC184604E2CB0999351512D99FD83A412B3386D9408214F636AE27F657B372D1201289ED89D33622D768EBE6B48F04F2D7D41C9141610D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

04D8B8E22B25DCD387381561A7EBF7879C61B59C1CF47D1CED6433F187722B624708C07475CD60C3AC08077990AB05A6021B114787D7FA236782034A90D00606