diff --git a/deontic_logic/maker_atlas_examples/endgame_mip_amendment.metta b/deontic_logic/maker_atlas_examples/endgame_mip_amendment.metta new file mode 100644 index 0000000..35a22ca --- /dev/null +++ b/deontic_logic/maker_atlas_examples/endgame_mip_amendment.metta @@ -0,0 +1,34 @@ +;https://mips.makerdao.com/mips/details/MIP102#MIP102c1 +;MIP102c1: Purpose Description +;Amendments +;MIP Amendments that preserve the MIP number can be performed +;to modify any aspect of an existing MIP, including MIP0. +;There are no restrictions on how an existing MIP can be amended. +; +;Multiple amendments to multiple MIPs are allowed to be submitted +;as a single subproposal. +; +;Removals +;MIP102 also enables the removal of one or multiple MIPs +;that are inactive as a part of the Endgame transition. +; +;Multiple MIPs may be removed in a single MIP Removal subproposal. + +(= (exist mip1) True) + +(= (inactive mip1) True) + +(= (preserve_mip_number amendment1 mip1) True) +(= (preserve_mip_number amendment2 mip1) False) + +(= (preserve_mip_number amendment3 mip2) True) +(= (preserve_mip_number amendment4 mip2) False) + +(= (permissible (modify $amendment $mip)) + (and (== (preserve_mip_number $amendment $mip) True) (== (exist $mip) True))) + +(= (permissible (remove $mip)) + (== (inactive $mip) True)) + +!(permissible (modify amendment1 mip1)) +!(permissible (remove mip1)) diff --git a/deontic_logic/maker_atlas_examples/governance_scope.metta b/deontic_logic/maker_atlas_examples/governance_scope.metta new file mode 100644 index 0000000..3de7c11 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/governance_scope.metta @@ -0,0 +1,39 @@ +;https://mips.makerdao.com/mips/details/MIP101#2-the-governance-scope-gov + +;2.6.5.1.2 +;If FacilitatorDAOs fail to take action against misaligned AD, +;they must be severely penalized. + +;Aligned Delegate (AD) +;Aligned Delegates are Anonymous Alignment Conservers that +;use the Protocol Delegation System +;to enable regular MKR holders to easily +;and safely delegate their MKR voting power +;towards implementing the Aligned Governance Strategy of an AVC, +;while earning Governance Participation Rewards in the process. + +;2.6.5.1 +;If a FacilitatorDAO finds that an AD has performed a misaligned act +;or breached their requirements, they can derecognize the AD +;and confiscate their AD Buffer. +;The AD Buffer can be used as a whistleblower bounty in case +;an ecosystem actor provided useful data, information or evidence +;that led to the derecognition of the AD. +;GOV6 must specify sufficient safety mechanisms around the payment of +;the whistleblower bounty. + +(= (Facilitator DAO) True) +(= (misaligned AD1) False) +(= (misaligned AD2) True) + +(take-action DAO AD1) + +(= (obliged (take-action $dao $ad)) + (and (== (Facilitator $dao) True) (== (misaligned $ad) True))) + +(= (obliged (be-penalized $dao $ad)) + (and (and (== (Facilitator $dao) True) (== (misaligned $ad) True)) + (not (== (match &self (take-action $dao $ad) $ad) $ad)))) + +!(obliged (take-action DAO AD1)) +!(obliged (be-penalized DAO AD1)) diff --git a/deontic_logic/maker_atlas_examples/scope_bunded_mutable_alignment.metta b/deontic_logic/maker_atlas_examples/scope_bunded_mutable_alignment.metta new file mode 100644 index 0000000..73f29e0 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/scope_bunded_mutable_alignment.metta @@ -0,0 +1,10 @@ +;https://mips.makerdao.com/mips/details/MIP101#2-3-scope-bounded-mutable-alignment-artifacts-gov3 + + +;Scope Artifacts are continuously updated. +;Their updates must always be aligned with the specifications of the Atlas. + +(= (update scope_artifacts) True) + +(= (obliged (align_with_specs $artifacts)) + ((== (update $artifacts) True) )) \ No newline at end of file diff --git a/deontic_logic/maker_atlas_examples/sky_primitives/asc_rules/asc_rules.metta b/deontic_logic/maker_atlas_examples/sky_primitives/asc_rules/asc_rules.metta new file mode 100644 index 0000000..4c37097 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/sky_primitives/asc_rules/asc_rules.metta @@ -0,0 +1,109 @@ +;ASC rules +; +;The ASC rules ensure that Stars all participate in +;maintaining the stability and peg of USDS. +; +;# Actively stabilizing collateral (ASC): +; +;ASC is collateral that is actively market making against USDS, +;supporting its peg and bidding at a price of at least 0.999 USD per USDS +;(10bps downside spread). +; +;ASC can be USDC and USDT in the PSM, curve, other stablecoins, +;or crypto assets, as long as it is enforced that they enable +;real time redemption of USDS at at least 0.999 USD per USDS. +; +;ASC can also be offchain as RWA loans to market makers, +;as long as there is clear public real time information about the exposure, +;proving that it is at all times used to provide buy support of at least +;0.999 USD per USDS +; +;If a Star doesn’t maintain at least 20% of its collateral portfolio in ASC, +;it will continuously be penalized at a rate of 200% APY on the missing ASC. +;This penalty is settled monthly at the settlement cycle, and retroactively +;calculated per second. +; +;# Demand Absorption Buffer +; +;Demand Absorption Buffer is a type of ASC consisting of USDS that is +;for sale for at most 1.001 USD per USDS. Every Star must maintain a DAB +;equivalent to 25% of their standard ASC requirement. USDS held by a Star is +;not considered a part of its collateral portfolio for the purposes of +;calculating ASC requirements. DAB requirements can also be fulfilled by +;autonomous systems that generate USDS dynamically through the allocation as +;needed. +; +;# Peg Defense Event +; +;A Peg Defense Event is a situation where the volume weighted average price +;of USDS on SkyLink enabled blockchains falls below 0.999 USD per USDS. +; +;In this situation, all Stars must immediately begin to buy USDS at +;a rate of at least 6.25% of their ASC requirement every 6 hours. +; +;If they fail to fulfill this requirement, a penalty of 20 bps on +;all missing buy volume is applied, calculated in finished blocks of +;6 hours from the Peg Defense Event begins, and settled retroactively at +;the monthly settlement cycle. +; +;Peg Defense can be performed both by selling other types of collateral for +;USDS, or by using USDS, or generating new USDS via the allocation system, +;that is then used as collateral on e.g. aave to borrow USDC or USDT and +;buy USDS with it. +; +;# ALM obligation transfer +; +;The ASC and Peg Defense obligation can be transfered against payment to +;a different Star, through the ALM obligation transfer system. +;Both ASC and Peg Defense responsibilities are transferred together, +;as they are tied together. + +(= (asset usdt) 100) +(= (asset usds) 200) +(= (asset usdc) 300) + +(= (apy-rate r1) 2) + +(= (penalize $asset $rate) + (let $res (/ $asset $rate) + $res) +) + +(= (stabilizing_collateral $asset $threshold $rate) + (if(>= $asset $threshold) + (penalize $asset $rate) + False + ) + ) + +(= (volume_weighted_average_price usdt) 1000) + +;(bind! acc1 (usdt 100)) +;(bind! acc2 (usdt 200)) +;(bind! acc3 (usdt 300)) +; +;(= (asset s1) (usdt 100)) +;(= (asset s2) (usdt 200)) +;(= (asset s3) (usdc 100)) + +(= (star_agent a1) s1) + +!(bind! &acc1 (new-state (usdt 100))) + +(= (asset s1) &acc1) + +!(change-state! &acc1 (usdt 200)) + +(= (increase_by_quant $num $quant) + (+ $num $quant) +) + +(= (buy $agent $quant) + (asset $agent) +) + +(= (peg_defense_event $vwap $threshold $agent_list) + (if(>= $vwap $threshold) + (buy $asset ) + ) +) \ No newline at end of file diff --git a/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/genesis_account.metta b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/genesis_account.metta new file mode 100644 index 0000000..792a5c5 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/genesis_account.metta @@ -0,0 +1,23 @@ +;This account counts as controlling 100% of the circulating token supply for +;governance purposes, +;enabling editing of the spark artifact before creation of the Spark token + +(= (preserve_mip_number amendment1 mip1) True) +(= (preserve_mip_number amendment2 mip1) False) + +(= (preserve_mip_number amendment3 mip2) True) +(= (preserve_mip_number amendment4 mip2) False) + +(= (permissible (modify $amendment $mip)) + (and (== (preserve_mip_number $amendment $mip) True) (== (exist $mip) True))) + +(= (permissible (remove $mip)) + (== (inactive $mip) True)) + + +(bind! &master_acc (new-state (supply percent 100))) + +(bind! &enable_editing (new-state (token_emission True))) + +(= (obliged (enable_editing $artifacts)) + ((== (proposal_alignment $artifacts) True) )) \ No newline at end of file diff --git a/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/spark_artifact_edits.metta b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/spark_artifact_edits.metta new file mode 100644 index 0000000..88d5a43 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/spark_artifact_edits.metta @@ -0,0 +1,50 @@ +;A.S1.P1.1 +;Name: Spark Artifact Edits + +;Spark Artifact Edits require a simple majority of SPK holders in +;a weekly SPK Snapshot poll with a minimum quorum of 10% of circulating +;token supply. To propose a Spark Artifact Edit, an SPK holder must have +;at least 1% of the circulating token supply. +;When a proposal is made the Operational Facilitator must determine its +;alignment, and if it is considered in alignment with the Atlas and +;Spark Artifact, the edit proposal is put to a snapshot poll. +;If the poll is successful, the Facilitator must instruct the operational +;govops to carry out the artifact update. + +(= (allow_spark_artifact_edits m1) False) + +(= (spk_holder h1) 2) + +(= (spk_holder h2) 4) + +(= (spk_holder h3) 5) + +(= (spk_holder h4) 2) + +(= (spk_holder h5) 0.5) + + +(= (operational_facilitator o1) True) + +(= (proposal_alignment prop1) True) +(= (proposal_alignment prop2) False) + +(= (stake-size $participants) + (let $lst (collapse (spk_holder (superpose $participants))) + (foldl-atom $lst 0 $x $y (+ $x $y))) +) + +(= (enough-stake-size? $participants $threshold) + (>= (stake-size $participants) $threshold) +) + +!(enough-stake-size? (h1 h3 h5) 7) +!(enough-stake-size? (h1 h3 h5) 8) + +(= (obliged (align_with_atlas $artifacts)) + ((== (proposal_alignment $artifacts) True) )) + +(= (vote $participants) + True) + +!(size-atom (h1 h3 h5)) \ No newline at end of file diff --git a/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/token_distribution_obligation.metta b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/token_distribution_obligation.metta new file mode 100644 index 0000000..3262164 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/token_distribution_obligation.metta @@ -0,0 +1,37 @@ +;# A.S1.P5 +; +;Name: Token Distribution Obligation +; +;Spark is required to distribute 0.2% of +;its total token supply per year to USDS holders. + +(bind! &redist_const (new-state (value 0.2))) + +(bind! &acc1 (new-state (usdt 100))) + +(= (star_agent a1) &acc1) + +(bind! &total_inc (new-state (usdt 100))) + +(= (obliged (supply_token $artifacts)) + ((== (proposal_alignment $artifacts) True) )) + +(= (obliged (be-penalized $dao $ad)) + (and (and (== (Facilitator $dao) True) (== (misaligned $ad) True)) + (not (== (match &self (take-action $dao $ad) $ad) $ad)))) + +(= (redis_by_val_ $holder) + (let (State ($asset_type $inc)) (&total_inc) + (let (State (&_ $rc)) (&redist_const) (+ (* $inc $rc) (star_agent $holder)))) +) + +(= (redis_by_val $holder) + (change-state! $holder (usdt (redis_by_val_ $holder))) +) + +(= (redistribute $holder_list ) + + (let $holder ($holder_list)(obliged (star_agent $holder) + (redis_by_val $holder)) +) + diff --git a/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/token_emissions.metta b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/token_emissions.metta new file mode 100644 index 0000000..7d31a01 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/sky_primitives/spark_artifact/token_emissions.metta @@ -0,0 +1,19 @@ +;Token emissions +; +;Token emissions irreversibly disabled: True + +(bind! &emissions_irreversibly (new-state (token_emission False))) + + + +(= (obliged (support_council_member $m)) + (and (== (approved $m) True) + (and (== (ecosystem-actor $m) True) + (not (== (side-engagement $m) True))))) + +!(obliged (support_council_member m1)) ;False + +(= (permissible (remove $m)) + (== (paid-work-under-last-year $m) False)) + +!(permissible (remove m3)) \ No newline at end of file diff --git a/deontic_logic/maker_atlas_examples/stability_advisory.metta b/deontic_logic/maker_atlas_examples/stability_advisory.metta new file mode 100644 index 0000000..9865351 --- /dev/null +++ b/deontic_logic/maker_atlas_examples/stability_advisory.metta @@ -0,0 +1,101 @@ +;https://mips.makerdao.com/mips/details/MIP104#1-1-1-4 + +;1.1.1.5: Stability Advisory Council Requirements +;1.1.1.5.1 +;Stability Advisory Council members can be individuals, +;groups of people, legal entities, or companies. +;They can be pseudonymous or known entities. +;Stability Advisory Council members must be aligned with +;the long-term goals of MakerDAO Endgame. +; +;1.1.1.5.2 +;Desired competencies for members of the Stability Advisory Council, +;as many of the following as possible: +; +;Expertise in capital markets, bonds, equities. +;Experience as a market analyst or economist. +;Expertise in tokenomics. +;Expertise in fund management and risk profiles. +;Deep knowledge of decentralized collateral accounting and finance. +;Experience in credit risk, market risk, liquidity risk, and operational risk. +;Deep understanding of principles of portfolio construction, asset allocation, +;diversification strategies, and performance measurement. +;Experience in smart contract and DeFi risk management. +;Experience in economic modeling of high-volatility portfolios. +;Expertise in Value at Risk analysis with detailed knowledge about +;the limitations of the method. + +;(= (council-member m1) True) +;(= (council-member m2) True) +;(= (council-member m3) True) +;(= (council-member m4) True) +;(= (council-member m5) True) + +;(being m1 individual) +;(being m2 group) +;(being m3 legal-entity) +;(being m4 company) +;(being m5 government) + +(= (individual m1) True) +(= (group m2) True) +(= (legal-entity m3) True) +(= (company m4) True) +(= (government m5) True) + +;(= (permissible (council-member $m)) +; (or (unify (being $m $r) (being $s individual) +; True False) +; (or (unify (being $m $r) (being $s group) +; True False) +; (or (unify (being $m $r) (being $s legal-entity) +; True False) +; (unify (being $m $r) (being $s company) +; True False))))) + +(= (permissible (council-member $m)) + (or (== (individual $m) True) + (or (== (group $m) True) + (or (== (legal-entity $m) True) + (== (company $m) True))))) + + +;!(permissible (council-member m1)) +;!(permissible (council-member m5)) + +(= (permissible economics) True) +(= (permissible capital-markets) True) +(= (permissible tokenomics) True) +(= (permissible credit-risk) True) +(= (permissible portfolio-construction) True) + + +(= (economics m1) True) +(= (capital-markets m2) True) +(= (tokenomics m3) True) +(= (credit-risk m4) True) +(= (portfolio-construction m5) True) + +(= (tokenomics m1) True) + +(= (permissible (experience $e $m)) + (and (== ($e $m) True) + (== (permissible $e) True))) + + +(= (omissible (experience $e $m)) + (unify ($e $m) ($s $m) True False)) + +;How to do that one of the experience types became optional? +;m1 has both economics and tokenomics +;E.g. we want to call !(optional (experience economics m1)) and get true + + +(= (optional (experience $e $m)) + (and (permissible (experience $e $m)) + (omissible (experience $e $m)))) + + +;!(unify (economics m1) (tokenomics m1) True False) + +!(permissible (experience chill m1)) diff --git a/deontic_logic/maker_atlas_examples/support_advisory_council_membership_management.metta b/deontic_logic/maker_atlas_examples/support_advisory_council_membership_management.metta new file mode 100644 index 0000000..e06332e --- /dev/null +++ b/deontic_logic/maker_atlas_examples/support_advisory_council_membership_management.metta @@ -0,0 +1,99 @@ +;https://mips.makerdao.com/mips/details/MIP106#1-1-1-support-advisory-council-membership-management + +;1.1.1: Support Advisory Council Membership Management +;Members of the Advisory Council are directly approved by +;Maker Governance through a governance poll, and +;must fulfill specific criteria. +; +;1.1.1.1 +;The Support Facilitators must ensure that +;potential Advisory Council Members can apply to be approved by +;Maker Governance, using an open process with clear instructions +;as per 1.1.1.3. +; +;1.1.1.2 +;Advisory Council Members must be ecosystem actors that are not involved +;in any business, political, or other governance-related activity that +;could result in a conflict of interest, either directly or indirectly. +;They must also have relevant skills for providing professional expert input +;on the content that the Support Scope is covering. +; +;1.1.1.3 +;The Support Facilitators must periodically, +;when it is relevant, review the Advisory Council Applications, +;and if they find applications that are suitable, bring them to +;a vote through an MKR governance poll. +;When Advisory Council Applications are posted on the Maker Forum, +;which must follow the template as per 1.1.2.4.1A, +;the Support Facilitators have a review period of 30 days. +;During this review period, the applicant must host a Community Q&A and +;shall answer as many questions and doubts as possible. +; +;1.1.1.3.1 +;The Support Facilitators can extend this deadline, +;if necessary, by 15 days, provided they posted the justification +;in the Maker Forum. +; +;1.1.1.3.2 +;Once the review period is ended, the Support Facilitators must publish +;the response to the application on the Forum, along with a description of +;the reasoning behind the decision. If approved, the application will +;continue with the Governance Process and proceed to a vote as per 1.1.1.3. +; +;1.1.1.3.3 +;Upon a successful vote, the Support Facilitators must arrange +;a service contract with the Advisory Council member, +;which must be made public. Approved Advisory Council Members are +;added to 1.1.1.6.1A. +; +;1.1.1.3.4 +;Approved Advisory Council members have a term of service of 18 months from +;the time they are approved by Maker Governance. +;If desired, the Advisory Council Member can submit a new application for +;re-election when their term has between 60 and 30 days remaining. +;The re-election application must also fulfill 1.1.2 requirements and +;will open a new review period of 30 days where the Maker Community can +;provide feedback. The applicant shall again host a Community Q&A and +;respond to as many questions and doubts as possible. +;If approved, the re-election application will continue with the +;Governance Process and proceed to a vote as per 1.1.1.3. +; +;1.1.1.4 +;The Support Facilitators may, if they deem it necessary, +;hold a vote to remove an Advisory Council Member. +;If an Advisory Council Member has not done any paid work for the Scope for +;at least 1 year, then the Support Facilitators can choose to remove them at +;will, if they deem it necessary. + +;(= (support_council_member m1) True) + +(= (approved m1) True) +(= (approved m2) True) +(= (approved m3) False) + +(= (ecosystem-actor m1) True) +(= (ecosystem-actor m2) False) +(= (ecosystem-actor m3) False) + +(= (side-engagement m1) True) +(= (side-engagement m2) False) +(= (side-engagement m3) False) + +(= (paid-work-under-last-year m1) True) +(= (paid-work-under-last-year m2) False) + +(= (obliged (support_council_member $m)) + (and (== (approved $m) True) + (and (== (ecosystem-actor $m) True) + (not (== (side-engagement $m) True))))) + +!(obliged (support_council_member m1)) ;False + +(= (permissible (remove $m)) + (== (paid-work-under-last-year $m) False)) + +!(permissible (remove m3)) + +;How to remove a member from support council? +;Store a predicate for every potential member and turn them false? +;Or do an atomspace rewrite?