primitivefinance / v1-cross-margin-spec

Collateral management contracts for Primitive protocol.
MIT License
0 stars 0 forks source link

Implement Option Core #8

Open Alexangelj opened 3 years ago

Alexangelj commented 3 years ago

The Option Core has the long that Primitive V1 Option.sol has. Instead of deploying new instances of ERC-20s with the option logic embedded into the contract, the Option Core can hold the option logic. The Option Core holds an array of ids that map to ERC-20 token addresses, which are simply mintable and burnable by the Option Core.

Option Core can deploy new options, which will use the parameters to generate an id. New ERC-20 clones are deployed to represent the tokenized options, and these are mapped to the id.

Option Core has the logic to mint and burn the option tokens, transfer collateral, and convert to ERC-1155 tokens.

Option Core is a low-level contract that is controlled by the Option Manager. Option Core will have invariant rules determined by their Option Manager implementation.

Option Core does not hold funds, just logic. Fund controlling logic is delegated to the Option Manager. https://www.notion.so/primitivefi/Primitive-Core-16b9458828f54edabd94fc0922eaef4c

High level spec:

Notes:

Alexangelj commented 3 years ago

Adding:

Alexangelj commented 3 years ago

image