The SparkLend Conduit is a conduit contract designed to be used within the Maker Allocation System. It implements the IAllocatorConduit interface, so it will be able to work within the constraints on the Allocation System design. There is one contract in this repo:
SparkLendConduit
: Facilitates the movement of funds between the Maker Allocation System and the SparkLend instance.
In later iterations of this code's development, it is expected for other SparkLend Conduits to be developed to support multichain deployments.
wards
: Thewards
mapping tracks the administrative permissions on this contract. Admin can upgrade the contract and set key storage values.operator
: Theoperator
performs actions on behalf of a givenilk
(SubDAO identifier in the Maker Allocation System). The operator can deposit, withdraw, request funds, and cancel fund requests in the Conduit. Onboarding and offboarding ofoperator
actors is done by Maker admin in the core system.
roles
: The roles contract to perform operator authentication.registry
: Returns thebuffer
contract for a given ilk (source of funds).
The deposit
function is used to move funds from a given ilk
's buffer
into the Conduit. From the Conduit, the funds are used to supply
in the SparkLend Pool. The result is that:
- Funds are moved from the
buffer
to SparkLend's aToken for that asset. - aTokens are minted and sent to the Conduit.
- The Conduit state to track the
ilk
's portion of the aTokens in the Conduit is increased.
The withdraw
function is used to withdraw
funds from the SparkLend Pool into the Conduit. From the Conduit, the funds are sent to the ilk
's buffer
. The result is that:
- Funds are moved from SparkLend's aToken for that asset to the
buffer
. - The Conduit's aTokens corresponding to the underlying asset withdrawn are burned.
- The Conduit state to track the
ilk
's portion of the aTokens in the Conduit is reduced.
NOTE: The last two invariants are not strict equalities because of A) the potential for a permissionless transfer of the aToken into the conduit and/or B) the rounding behaviour difference (round on SparkLend vs round-down on SparkLend Conduit).
Since the SparkLend Conduit will likely require maintenance as its desired usage evolves, it will be an upgradeable contract, using upgradeable-proxy
for upgradeable logic. This is a non-transparent proxy contract that gives upgrade rights to the PauseProxy.
As with most MakerDAO contracts, non standard token implementations are assumed to not be supported. As examples, this includes tokens that:
- Do not have a decimals field or have more than 18 decimals.
- Do not revert and instead rely on a return value.
- Implement fee on transfer.
- Include rebasing logic.
- Implement callbacks/hooks.
To run the tests, do the following:
forge test
The IP in this repository was assigned to Mars SPC Limited in respect of the MarsOne SP