Dirti

Smart Contract DirtiCoin Logic

Smart Contract

Smart Contract – The narrative below shows the logical operations carried out by the smart contract that comprises DirtiCoin. Before looking at the logic, you may want to understand what actions can happen in the DirtiCoin contract and who can initiate them.

The Protocol

DirtiCoin uses the ERC-20 standard contract on the Ethereum main blockchain. It is a smart contract to create a fungible token. The ERC has the primary responsibility of tracking balances (Solorio, Kanna, & Hoover, 2020).

Each DirtiCoin has several fields common to all ERC-20 as well as some specific for the implementation. The list below contains some, but not all fields. These fields are common to nearly all ERC-20 contracts.

  • coincap – this is the total amount of DirtiCoin which can ever be minted
  • totalSupply – this is the total amount of DirtiCoin in circulation
  • balance – this tracks the balance for the owner address associated with this instance
  • transfer – the address where balances will be transferred to, and the quantity being transferred

Smart Contract Triggers

We have a very limited set of triggers that cause action in the contract.

  1. Deposits and Withdrawals: These are common triggers which will update both the balance and the transfer fields (see above)
  2. Outside Audit: This will occur once or twice each year. It is a specialized vote request. We are presenting the results of the outside audit of the Asset Ledger and asking the DAO to accept the report.
  3. Asset Ledger change of State: Not all state changes will trigger a DAO vote. For instance, changing from Initializing to Balanced doesn’t require a vote. However, a change from Balanced to either Out of Balance state will lead to a vote. One of the results of the vote, in those circumstances, is likely to put the ledger into an Initializing state. That state persists until the approved proposal is fully implemented.
  4. Minting new DirtiCoin: This may happen as often as once each year. When the Company mints additional DirtiCoin, within the limits of the Coin Cap, we will adjust the totalsupply field, indicating the amount of DirtiCoin in circulation. This will also alter the Ledger State to Initializing.
  5. Adjusting the Coin Cap: This change may happen every few years as we need to increase the upper limit of the monetary supply of DirtiCoin. We expect this will always be a proposal to increase the number. Because this situation is probably driven by a need for more DirtiCoin the proposal would likely include a minting event which puts the Ledger State into Initializing.
  6. Burning DirtiCoin: We expect this to be a rare event. If we propose burning DirtiCoin and the DAO agrees, then we would decrease the totalSupply, reflecting the decrease in the circulation.

Out of Balance Asset Ledger

An out of tolerances condition in the Asset Ledger (the Ledger) is a potential trigger for a vote. It isn’t an automatic demand for a vote. If the Company is unable to balance the Ledger with existing assets, then we will put a proposal to the DAO to increase, or decrease assets.

To thwart manipulation of the DAO through some exploit against the public version of the Asset Ledger, the contract will verify any apparent Out-of-Balance state with a secure version of the Asset Ledger. If the secure version of the Asset Ledger assets shows either of the out-of-bounds states, then the DAO requests a proposal and recommendation from the Company and initiate a vote of the DAO with a date certain end date of not less than 30 calendar days for all votes to be cast and tallied. After the expiration of the voting the votes will be tallied.

The likelihood of the contract requesting a proposal is extremely low. The Company constantly monitors the Asset Ledger. We also look at the pipeline of deals. Knowing what is coming enables us to proactively put forward proposals to the DAO when we anticipate an impending Out-of-Balance situation.

Smart Contract – Proposals

In addition to these DAO initiated requests; a vote can be set by action of the Company which puts specific motions before the DAO. These measures include, but are not limited to raising the Coin Cap, establishing a new Asset Ledger connection with a different entity, or such other measures as the Company deems appropriate for a vote by the DAO.

Voting Rules

  1. The Company is the only entity which can submit proposals to the DAO for their vote.
  2. Only contracts that are older than 30 days from the start of the voting period are eligible to vote.
  3. Contracts must be holding a quantity equal to or greater than 1 DiD are eligible to vote (DirtiCoin x 10 to the 9th).
  4. Each eligible contract gets one vote, regardless of the quantity of DiD held in the contract.
  5. No proxies for DirtiCoin voting are acceptable.
  6. Each proposal has a time limit for voting which will not exceed 30 calendar days and won’t be less than 7 days.
  7. Votes received after the time limit for a proposal are ignored.
  8. A plurality of the eligible votes submitted is a majority vote regardless of the number of eligible contracts.
  9. Each vote has a value of either “For”, “Against”, or “Abstain.” These values are mutually exclusive.
  10. The Company can choose to count eligible submitted abstentions as votes “For” or “Against”, at their discretion.
  11. A “majority” is really a plurality. It may not be the majority of all eligible votes. However, it will be the majority of the votes cast.
  12. If the number of votes “For” is greater than those “Against” the proposal is accepted.
  13. If the number of votes “Against” is greater than those “For” the proposal is rejected.

Smart Contract – Voting Logic

  1. DirtiCoin receives a state-change notification from Asset-Ledger.
  2. DirtiCoin reads the Asset-Ledger-State
  3. IF Asset-Ledger-State = “Out of Balance” THEN
    1. Fetch the Asset-Ledger-Proposal
    2. Set the Vote-Attempt = 0
    3. WHILE Vote-Attempt < 3
      1. Increment Vote-Attempt by 1
      2. Presents the Asset-Ledger-Proposal to the Voter-UI asking for a UI-Vote
      3. Fetch the the UI-Vote
      4. If UI-Vote = “For” or “Against” or “Abstain” SET Vote-Attempt = 4 ELSE Display Invalid-Vote-Message ENDIF
    4. ENDWHILE
  4. ENDIF
  5. Fetch Audit-Result
  6. If Audit-Result = Yes THEN
    1. Fetch the Audit-Result-Proposal
    1. Set the Vote-Attempt = 0
    2. WHILE Vote-Attempt < 3
      1. Increment Vote-Attempt by 1
      2. Presents the Asset-Ledger-Proposal to the Voter-UI asking for a UI-Vote
      3. Fetch the the UI-Vote
      4. If UI-Vote = “For” or “Against” or “Abstain” SET Vote-Attempt = 4 ELSE Display Invalid-Vote-Message ENDIF
    3. ENDWHILE
  7. ENDIF
  8. END

When voting this contract does not write anything to the blockchain, creating no new transactions. Therefore, there is no “gas fee” for voting. Gas Fees occur when changes are made to the Asset-Ledger and and when the DirtiCoin contract is changed.

Conclusions

The DAO is a “slow DAO.” Votes take days or weeks, not seconds.

The contract comprises many essentials of the design of DirtiCoin as a currency. We engineered the Contract to achieve several goals. First, we wanted to give you the ultimate control over the monetary supply of DirtiCoin. Second, we wanted to protect your wealth from pirates. Third, we created a structure that stores your wealth in much the same way putting your money in a bank does.

Disclaimers