Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rainlanguage/rain.factory
Solidity interfaces and implementation of Rain factories.
https://github.com/rainlanguage/rain.factory
rainlang solidity solidity-contracts
Last synced: 17 days ago
JSON representation
Solidity interfaces and implementation of Rain factories.
- Host: GitHub
- URL: https://github.com/rainlanguage/rain.factory
- Owner: rainlanguage
- License: other
- Created: 2023-03-28T06:29:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-07T10:43:09.000Z (about 2 months ago)
- Last Synced: 2024-12-07T11:19:55.732Z (about 2 months ago)
- Topics: rainlang, solidity, solidity-contracts
- Language: Solidity
- Homepage: https://rainprotocol.github.io/rain.factory/
- Size: 1.21 MB
- Stars: 0
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rain.factory
Docs at https://rainprotocol.github.io/rain.factory
## Concrete implementations
`CloneFactory` implements the latest version of `ICloneableFactory` allowing any
compatible `ICloneable` contract to be cloned as an EIP1167 proxy and
initialized.`CloneFactory` implements interpreter deployer discoverability.
## Interfaces
Contains interfaces for working with Rain factories.
Rain tooling/ecosystem generally tries to be as agnostic and low friction as
possible on the implementation side.The ideal would be that "any" contract can call an interpreter and magically be
supported but there's a lot that can go wrong, for example:- Contracts can self destruct or even [redeployed with new bytecode](https://0age.medium.com/the-promise-and-the-peril-of-metamorphic-contracts-9eb8b8413c5e)
- Proxies can point to new implementations and "upgrade"
- Discoverability of ABIs and other metadata subject to indexer limitationsFalling short of the ideal, we want to support:
- Ability to (dis)trust contracts at the bytecode level NOT the human/key level
- Support existing patterns such as EIP1167 for clones, etc.
- Avoid introducing Rain-isms as much as possibleThe onchain tooling for analysis is found at https://github.com/rainprotocol/rain.extrospection
The current interfaces in this repository are for
- `ICloneableFactoryV2` that is expected to clone proxies from a reference
implementation
- A small interface `ICloneableV2` designed for cloneable proxy contracts to
expose an `initialize` function that the factory can call to act like a
constructor### Legacy
#### `ICloneableV1`
This version of `ICloneable` did not have any explicit return value on success of
initialize. It is possible for contracts that do not implement `ICloneableV1` to
silently fail to initialize when cloned by an `ICloneableFactoryV1`.Newer versions of the interface include an explicit success value and check.
#### `IFactory`
The legacy factory model was much more restricted in that each factory
implementation was 1:1 with the thing it was deploying. If you needed a new
contract you also needed to implement a new factory.This was suboptimal for several reasons:
- Increased surface area for things to go wrong
- More Rain-isms creeping in
- Redundant work to maintain a growing list of factoriesThe legacy interface is available as `IFactory` but it is NOT RECOMMENDED for
new contracts.## Implementations