Adapters

Ocean adapter primitives

What is an adapter?

In DeFi, generally speaking, an adapter is any smart contract that integrates unrelated DeFi protocols with each other. The purpose of Ocean adapter smart contracts is to connect Shell with external protocols.

Ocean Adapters

The Ocean Adapter is compatible with Shell v3, which introduced certain changes to the Ocean smart contract. An Ocean Adapter won't work with older versions of Shell.

The Ocean Adapter is a special version of a DeFi Adapter smart contract that is written according to the Ocean specification, i.e. it inherits the special abstract contract OceanAdapter in order to integrate external projects and protocols, and make them compatible with the Ocean.

Anyone can write an OceanAdapter, to connect Shell Protocol and any project of the creator's liking. It's completely permissionless! You can see a few example of the Ocean Adapter in the following links in our repo:

  • Curve2PoolAdapter - coming soon

  • CurveTricryptoAdapter - coming soon

Why integrate with the Ocean?

As a fully open source and permissionless protocol, writing an Ocean Adapter is available to anyone. External projects can write their own adapters and integrate with Shell Protocol, getting the best out of its composability and unique architecture.

Integrated projects do not only become compatible with the Shell Protocol, but also with one another.

And last but not least, new protocols that are just starting and may not have big numbers in TVL and other metrics will get to tap into a much bigger user base than they would initially have. Every user on Shell Protocol becomes their user as well.

Creating an Ocean Adapter

In order to create an Ocean Adapter smart contract, developers must inherit the abstract contract OceanAdapter.sol, passing Ocean contract and Primitive contract addresses (the address for the contract the integration is written for) to its constructor like in the example below:

One requirement that has to be satisfied is implementation of the three methods that were specified, but not implemented by the inherited abstract contract OceanAdapter.sol, and those methods are: primitiveOutputAmount, wrapToken and unwrapToken.

A reference of the actual implementation (which may be different for each Adapter) can be seen in Curve2PoolAdapter example:

Other than that, smart contract developers are free to add arbitrarily complex logic and custom functionality to their Adapters.

The full implementation of abstract contract OceanAdapter.sol can be found here: [link coming soon].

Last updated