Skip to content

Instantly share code, notes, and snippets.

@andreolf-da
andreolf-da / axios.ts
Last active February 15, 2021 15:23
axios
import axios from 'axios'
import { SERVER_HOST } from './conf'
const adapter = () => axios.create({
baseURL: SERVER_HOST,
headers: {
'Authorization': `Bearer ${localStorage.getItem('token')}`
}
})
@andreolf-da
andreolf-da / loadContracts.ts
Last active February 15, 2021 15:24
loadContracts
loadContracts = async (template: Template) =>
await axios()
.post('/contracts/search', {"templateIds" : [`${template.moduleName}:${template.entityName}`]})
.then(res => res.data.result)
@andreolf-da
andreolf-da / agency.hs
Created February 15, 2021 15:18
agency
-- An agency can offer a visit to many parties (that expressed interest off-ledger)
nonconsuming Rental_OfferVisit : ContractId VisitOffer
with
visitor : Party
do
create VisitOffer with
-- Signatory
agency,
landlord,
@andreolf-da
andreolf-da / RentalContractOffer_Reject.hs
Created February 15, 2021 15:17
RentalContractOffer_Reject
RentalContractOffer_Reject : ()
do
create Rental with
-- Signatory
landlord,
agency,
-- Data
tenant = applicant,
authority,
@andreolf-da
andreolf-da / RentalApplication_Accept.hs
Created February 15, 2021 15:16
RentalApplication_Accept
RentalApplication_Accept : ContractId RentalContractOffer
with
authority : Party
do
rentalPendingContractCid <- create RentalPendingContract with
-- Signatory
landlord,
agency,
-- Data
registerId -- Display only
@andreolf-da
andreolf-da / key.hs
Created February 15, 2021 15:16
key
key (agency, registerId) : (Party, Text)
maintainer key._1
@andreolf-da
andreolf-da / AgencyLicenseOffer_Refuse.hs
Created February 15, 2021 15:15
AgencyLicenseOffer_Refuse
AgencyLicenseOffer_Refuse : () do return ()
@andreolf-da
andreolf-da / AgencyLicense_Revoke.hs
Created February 15, 2021 15:14
AgencyLicense_Revoke
AgencyLicense_Revoke : () do return () -- The authority can always revoke licenses
@andreolf-da
andreolf-da / ensure.hs
Created February 15, 2021 15:13
ensure
ensure
authority /= landlord && -- Avoid conflict of interest
authority /= tenant -- Avoid conflict of interest
@andreolf-da
andreolf-da / assert.hs
Created February 15, 2021 15:13
assert
assert (authority /= newAgency) -- Prevent meaningless self-offer