
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@metamask-institutional/mmi-defi-adapters
Advanced tools
Defi adapters for MMI Dashboard
MMI Defi adapter library
We have created an open source DeFi adapater library. The aim of this library is to provide the tools and scaffolding for a DeFi protocol to build an adapter. This adapter will provide read and write capabilities within the MMI and MetaMask portfolio dashboards. Our goal is to (i) connect users with DeFi protocols (ii) benefit the wider ecosystem (iii) simplify and standardize adapter building.
Create a copy of .env.example
as .env
.
Run the following command:
npm i
Run the following command for building the app once
npm run build
Run the following command for constantly building the app during development
npm run build:watch
Specific details on what commands are available can be shown running:
npm run adapters-cli
For getting the arguments and options for specific commands:
npm run positions -- --help
It is possible to get results for specific protocols and chains for every command by adding --chain <chainId>
and/or --protocol <protocolName>
For example:
npm run positions 0x6b8Be925ED8277fE4D27820aE4677e76Ebf4c255 -- --protocol stargate --chain 1
npm run positions 0x6b8Be925ED8277fE4D27820aE4677e76Ebf4c255
npm run profits 0xB0D502E938ed5f4df2E681fE6E419ff29631d62b
npm run prices
npm run tvl
npm run apr
npm run apy
npm run deposits 0x6b8Be925ED8277fE4D27820aE4677e76Ebf4c255 17719334 17719336
npm run withdrawals 0x6b8Be925ED8277fE4D27820aE4677e76Ebf4c255 17719334 17719336
mmi-defi-adapters/
│
└── src/
├── adapters/ # Folder for all the protocol adapters and code
│ ├── example-protocol/ # Folder for the new protocol called example-protocol
│ │ ├── products/ # Folder for the different protocol product
│ │ │ ├── pool/ # Folder for the pool product
│ │ │ │ ├── ethereum/ # Folder with protocol specific metadata and code
│ │ │ │ ├── optimism/ # Folder with protocol specific metadata and code
│ │ │ │ ├── arbitrum/ # Folder with protocol specific metadata and code
│ │ │ │ └── protocolNamePoolAdapter.ts # Implementation of IProtocolAdapter
│ │ │ │
│ │ │ └── vesting/ # Folder for the staking product
│ │ │ ├── ethereum/ # Folder with protocol specific metadata and code
│ │ │ ├── arbitrum/ # Folder with protocol specific metadata and code
│ │ │ └── protocolNameVestingAdapter.ts # Implementation of IProtocolAdapter
│ │ │
│ │ └── buildMetadata.ts # Metadata builder script
│ │
│ ├── index.ts # Exports supportedProtocols object
│ └── metadataBuilders.ts # Exports protocolMetadataBuilders object
│
└── contracts/
└── abis/
└── example-protocol/ # Folder to place all the protocol contract abis
├── example-lp-factory-contract.json # Abi for the protocol lp-factory contract
└── example-staking-contract.json # Abi for the protocol staking contract
See CONTRIBUTING.md.
Run the following command to add a new adapter
npm run new-adapter <Example> <example-product> [Chains]
Where:
<Example>
is the name of your protocol as you'd like it to appear.<example-product>
is the name of the product for the adapter in kebab-case[Chains]
is an optional argument with a comma separated list of supported chains (e.g. Ethereum,Arbitrum,Optimism
). Default: Ethereum
To integrate a new protocol:
src/adapters/index.ts
:
Protocol
object: key in CamelCase, value in kebab-case (matching folder name).supportedProtocols
object.src/adapters
, named in kebab-case, e.g., src/${protocolName}/products/${productName}/productAdapter.ts
.After adding your protocol:
src/adapters/stargate/products/pool/arbitrum/metadata.json
using src/adapters/stargate/buildMetadata.ts
.protocolMetadataBuilders
object in src/adapters/metadataBuilders.ts
and test npm run metadata
src/${protocolName}/products/${productName}
.src/adapters/example/products/example-product/exampleProductAdapter.ts
to your product folder.supportedProtocols
in src/adapters/index.ts
.npm run positions 0x6b8Be925ED8277fE4D27820aE4677e76Ebf4c255
.npm run profits 0x6b8Be925ED8277fE4D27820aE4677e76Ebf4c255
.npm run prices 0x6b8Be925ED8277fE4D27820aE4677e76Ebf4c255
.Add a JSON file with the abi of any new contract to the folder src/contracts/abis/<protocol-name>
.
Run the following command to generate factories and abis for those contracts automatically:
npm run build-types
JP | Bernardo | Johann |
FAQs
Defi adapters for MMI Dashboard
We found that @metamask-institutional/mmi-defi-adapters demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.