diff --git a/README.md b/README.md index 7fced9f4304871367c78bded2a381d0a78de485c..16343e8b97cc9f019563ce4aa77699cd0e61aff9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # QSI_Groupe1 -l'adresse du contrat: KT1QTwmF2eptKss2FWbT1rHP5wCERL16kihQ +l'adresse du contrat: KT1KDh3oWApHysHWdcDuFuNhk1WoVvJTtsDF ## Getting started diff --git a/contracts/AssociationRegistry.jsligo b/contracts/AssociationRegistry.jsligo index 1da82935ba8a14fd69f388a7bbb88b65bf1e7293..6c5fb4feddaadc9d282feb90853a8347c08339b0 100644 --- a/contracts/AssociationRegistry.jsligo +++ b/contracts/AssociationRegistry.jsligo @@ -8,29 +8,30 @@ type storage = map<string, association>; type return_ = [list<operation>, storage]; +const myAssoAdmin = ("tz1aek2YDiM5xxqZwus1eyR3siiSNjmiJfFM" as address) ; -const registrationFeeInitial= 10000000mutez; +const registrationFeeInitial= 10 as mutez; // Register a new DAO @entry const registerAssociation = (association: association, storage: storage): return_ => { - //Addresse of MyAsso - const ownerAddress = ("tz1dV9UkbS6uMuKjQy5Vs7FSptKz8LR28oFq" as address) + let operations : list<operation> = list([]) ; const receiver : contract<unit> = - match (Tezos.get_contract_opt(ownerAddress) as option<contract<unit>>) { + match ((Tezos.get_contract_opt(myAssoAdmin))) { when(Some(contract)): contract; when(None()): (failwith ("Not a contract") as contract<unit>) } - // Check if walletAmount is present and greater than or equal to registrationFeeInitial - // if ((Tezos.get_balance())> registrationFeeInitial) { - // failwith("Insufficient funds to register association"); - // } + // Check if walletAmount is present and greater than or equal to registrationFeeInitial + if ((Tezos.get_amount())!= registrationFeeInitial) { + failwith("The amount should be 10tez exactly"); + } if(Some(Tezos.get_sender())== association.admin) { - const payoutOperation : operation =Tezos.transaction(unit,10000000mutez,receiver); - const _operations : list <operation> = list([payoutOperation]); + const payoutOperation : operation =Tezos.transaction(unit,registrationFeeInitial,receiver); + operations = list([payoutOperation]); // Check if association already exists } + const existingAssociation = Map.mem(association.name, storage); if (existingAssociation) { failwith("Association already registered"); @@ -45,7 +46,7 @@ const receiver : contract<unit> = // Add new association to storage const updatedStorage: storage = Map.add(association.name, newAssociation, storage); - return [list([]), updatedStorage]; + return [operations, updatedStorage]; } @@ -83,4 +84,3 @@ const listDetailsAssociations = (associationName:string, stor: storage): associa @view const listAllAssociations = (_unused : unit,stor: storage): storage=> stor ; -