Onchain.Storage is an ecosystem of on-chain modular storage protocols that can interact each other, in the form of smart contract live on an EVM compatible blockchain.
A user who wants to interact with different protocols has to do separate transactions and wait for separate responses. This inherently slows down the whole process making it inefficient.
Create a protocol which allows any user interact with a dynamic list of protocols, managing them using a set of admin keys. In essence, we are introducing a proxy contract that manages different contracts' interaction.
At high level, the protocol works as follows
A proxy contract forwards client calls to one or more contracts. Since in principle anyone is allowed to forward transactions to any contract, we implement an enablement check for the legitimate contracts in order to avoid potential unexpected outcomes.
The protocol basically consists in three functions:
To manage admins we need to run following function
manageProtocolAdmins(address admin, bool state)
This function will enable the admin
if the state
is true
or will disable the address if false
.
To manage protocols we need to run following function
manageProtocolContracts(address protocol, bool state)
This function will enable the protocol
if the state
is true
or will disable the address if false
.
To create a proxy call we need to run following function
createOnchainProxyTransaction(address[] protocols, unit256[] values, bytes[] data)
As we can see all the parameters are arrays, so the contract can loop over protocols
, values
and data
.
protocols
are allowed.values
is exactly the msg.value
amount, so the user can't cheat over values.admin
: Address representing an adminprotocol
: Address representing a protocol smart contractprotocols
: List of addresses representing more than one protocols smart contratsvalues
: List that describes how the total value sent to bulk contract is divided among each protocoldata
: List that collects the data being sent to each protocol