Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obUSD Spec #2

Open
RonTuretzky opened this issue Dec 3, 2024 · 0 comments
Open

obUSD Spec #2

RonTuretzky opened this issue Dec 3, 2024 · 0 comments

Comments

@RonTuretzky
Copy link

RonTuretzky commented Dec 3, 2024

(Optimism Builder's Dollar Referred to as obUSD here after)

Overview

The goal of obUSD (prev. PGFDAI) is to allow Projects/teams that have been approved for builder grants by the Optimism Grants council to be eligible for receiving funding while completing their grants. This is conditional on them receiving a minimum number of vouches from accredited Optimism ecosystem members. The funding is generated by the total holdings of obUSD, which generates and redistributes yield to eligible projects. obUSD is an alternative to holding stablecoins (such as USDC/USDT) and can be held by the optimism foundation, builders and projects in the space.

Background

Yield Generation
Yield is generated by supplying DAI liquidity to AAVE, which earns interest on supplying and borrowing assets with a variable interest rates. This allows for a risk free source of yield, preserving the stablecoin aspects of the asset, while generating yield for the builders.
Other risk free sources of yield were considered, and are potential candidates for future versions and upgrades, but for the initial version a tried and true method was selected.

Please refer to this file for the source code of the an existing implementation utilizing the same mechanism which was deployed to mainnet and utilized by the Breadchain community.

EAS
The Optimism foundation utilizes EAS to identify projects , project applications and more. The obUSD mechanism will utilize these attestations in order to integrate mechanism into the Optimism eco-system.
Project Grantee Configuration
Attestations provided by the Optimism foundation will be submitted to the smart contract infrastructure, validating the authenticity of the attestation. Given a valid attestation , the infrastructure will accept the recipient address at the intended recipient of yield, in the event the project receives an adequate amount of vouches from accredited Optimism Citizens.
Voucher Configuration
Vouchers will submit an attestation which accredits them as an Optimism Citizen, and will then be whitelisted by the smart contract infrastructure to be able to vouch. They can then submit a transaction to vouch for projects.

On Chain


classDiagram

	class obUSDYieldDistributor{
		OptimismBuildersDollar obUSD
		bytes32 GRANTEE_HASH
		bytes32 APPLICATION_APPROVED_HASH
		uint256 SEASON_DURATION
		uint256 currentSeasonExpiry
		uint256 minRequiredVouches
		uint256 public PRECISION
		uint256 public cycleLength
		uint256 public lastClaimedBlockNumber
		uint256 public previousCycleStartingBlock
		address [] optimismFoundationAttestors 
		address [] currentProjects 
		mapping(address=>uint256)projectToVouches
		mapping(address=>mapping(bytes32=>bool)) userToProjectVouch
		mapping(address => bool) eligibleVoucher
		mapping(bytes32 => bool) eligibleProject 
		mapping(address => uint256) projectToExpiry
		mapping(bytes32 => address ) projectToAddress
		+vouch(OffChainAttestation projectApprovalAttestation)
		+vouch(OffChainAttestation projectApprovalAttestation, bytes32 identityAttestation)
		distributeYield()
		isReadyToDistribute()
	}
	class OptimismBuildersDollar{
		+setYieldClaimer()
		+claimYield()
		+yieldAccrued()
	}

	class OffchainAttestationVerifier{
	+IEAS()
	+verify()	
	}
	class ERC20 {
	+mint()
	+burn()
	}
	OptimismBuildersDollar --> ERC20
	obUSDYieldDistributor --* OptimismBuildersDollar
	class EIP712Verifier
	OffchainAttestationVerifier --> EIP712Verifier
	obUSDYieldDistributor --> OffchainAttestationVerifier
Loading

Project Configuration Flow

Given a Approved Projects attestation produced by the expected Issuer (the Optimism foundations address) which has an approved status and a "Grantee" name, we can programmatically infer that this project is approved by the Optimism foundation. We can then use the to address to later allow the project submitter to claim the funds.

So when a project is vouched for the first time, the frontend should submit the attestation, and the contract should do a full verification flow. Further vouches can omit the verification part, as the project should already be considered eligible by the contract.

![[Pasted image 20241127090447.png]]

sequenceDiagram
    participant User as Voucher
    participant Frontend
    participant OBD as obUSD
	User ->> Frontend: Choose a project to vouch for and initiate process
    Frontend ->> Frontend: Retrieve ApprovedProject attestation ID 
    User ->> OBD : Initiate transaction 
    alt Project is not included in obUSD
        OBD ->> OBD: Check attestor and status 
        alt If attestor is Optimism foundation and status is true
        OBD ->> OBD: Mark project as eligible for recieving vouches
        end
    end
	OBD->> OBD: Add vouch to project 

Loading

Voucher Selection

The following schema is used by the optimism foundation in order to create identities for those eligible to vote

sequenceDiagram
    participant Frontend
    participant c as Yield Distributor Contract
    Frontend ->> Frontend: fetch Optimism foundation attestation 
    alt Initiator is sanctioned voting address by optimism foundation
        c -->> c: Allow voter vouch and whitelist
    else Not sanctioned by optimism foundation
        c ->> c: Revert 
    end

Loading

When a project has reached the minimum amount of vouches, it should be eligible for receiving future yield.

Yield Distribution

The yield is distributed equally between all projects. Gelato will be used to automate the yield distribution.


Off-Chain

The frontend will be static and stateless, as all data can be fetched through the EAS/Charmverse API. This also allows the frontend to be up-to-date as Optimism seasons and grants change. The frontend does not hold any authority , privileged information or centralized aspects.

Project Indexing

Using the Charmverse applications page, all projects can be fetched, and then by fetching their proposalID, the attestation URL can be fetched by running

curl -s GET https://app.charmverse.io/api/proposals/<proposal_id> | jq -r '.issuedCredentials[0].verificationUrl'

The json containing the offchain signature can then be loaded into the transaction data, as well as details for the project display.

Project Component

The project component will include the following (fetched from the project metadata URI)

  • Organization
  • Description
  • Charmverse URL
  • The vouching component

Vouching Component

Citizen attestations can be fetched using the EAS GraphQL API, which in combination with the project attestation data should allow the vouching component to create a transaction representing a vouch from a valid Optimism Citizen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant