https://gitlab.com/nomadic-labs/mi-cho-coq
Raw File
Tip revision: 466c12e37697d213efdc86108937d3c3443313ff authored by Yann Regis-Gianas on 12 May 2021, 07:52:52 UTC
Update code and proof of CPMM2
Tip revision: 466c12e
dexter_storage.v
(* Open Source License *)
(* Copyright (c) 2020 Nomadic Labs. <contact@nomadic-labs.com> *)

(* Permission is hereby granted, free of charge, to any person obtaining a *)
(* copy of this software and associated documentation files (the "Software"), *)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)
(* and/or sell copies of the Software, and to permit persons to whom the *)
(* Software is furnished to do so, subject to the following conditions: *)

(* The above copyright notice and this permission notice shall be included *)
(* in all copies or substantial portions of the Software. *)

(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)
(* DEALINGS IN THE SOFTWARE. *)

Require Import String.

Require Import syntax.
Require error.
Require parser_helpers.

Require Import dexter_definition.

Require Import contract_semantics.

(* Generated by split.py *)
Definition sto_tokenPool (sto : data storage_ty) : data nat :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    tokenPool
  end.

Definition sto_xtzPool (sto : data storage_ty) : data mutez :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    xtzPool
  end.

Definition sto_lqtTotal (sto : data storage_ty) : data nat :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    lqtTotal
  end.

Definition sto_tokenAddress (sto : data storage_ty) : data address :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    tokenAddress
  end.

Definition sto_lqtAddress (sto : data storage_ty) : data address :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    lqtAddress
  end.

Definition sto_set_tokenPool (sto : data storage_ty) (tokenPool' : data nat) : data storage_ty :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    (tokenPool', (xtzPool, (lqtTotal, (tokenAddress, lqtAddress))))
  end.

Definition sto_set_xtzPool (sto : data storage_ty) (xtzPool' : data mutez) : data storage_ty :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    (tokenPool, (xtzPool', (lqtTotal, (tokenAddress, lqtAddress))))
  end.

Definition sto_set_lqtTotal (sto : data storage_ty) (lqtTotal' : data nat) : data storage_ty :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    (tokenPool, (xtzPool, (lqtTotal', (tokenAddress, lqtAddress))))
  end.

Definition sto_set_tokenAddress (sto : data storage_ty) (tokenAddress' : data address) : data storage_ty :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    (tokenPool, (xtzPool, (lqtTotal, (tokenAddress', lqtAddress))))
  end.

Definition sto_set_lqtAddress (sto : data storage_ty) (lqtAddress' : data address) : data storage_ty :=
  match sto with
  | (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))) =>
    (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress'))))
  end.

Ltac destruct_sto sto tokenPool xtzPool lqtTotal tokenAddress lqtAddress :=
  destruct sto as (tokenPool, (xtzPool, (lqtTotal, (tokenAddress, lqtAddress)))).
back to top