{"_id":"@benddao/bend-lending-protocol","name":"@benddao/bend-lending-protocol","dist-tags":{"latest":"1.0.11"},"versions":{"1.0.11":{"name":"@benddao/bend-lending-protocol","version":"1.0.11","description":"BendDAO Lending Protocol smart contracts","homepage":"https://www.benddao.xyz/","bugs":{"url":"https://github.com/BendDAO/bend-lending-protocol/issues"},"repository":{"type":"git","url":"git+https://github.com/BendDAO/bend-lending-protocol.git"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"run-env":"yarn && tail -f /dev/null","hardhat":"hardhat","hardhat:node":"hardhat node","hardhat:localhost":"hardhat --network localhost","hardhat:goerli":"hardhat --network goerli","hardhat:rinkeby":"hardhat --network rinkeby","hardhat:main":"hardhat --network main","size":"npm run compile && npm run hardhat size-contracts","compile":"SKIP_LOAD=true hardhat compile","test":"npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test/*.spec.ts","test:localhost":"npm run compile && TS_NODE_TRANSPILE_ONLY=1 npm run hardhat:localhost test ./test/*.spec.ts","test:file":"npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test/__setup.spec.ts ./test/${TEST_FILE}","test:subgraph:localhost":"npm run compile && npm run hardhat:localhost test ./test/__setup.spec.ts ./test/subgraph-scenarios.spec.ts","dev:coverage":". ./setup-test-env.sh && COVERAGE=true npx hardhat coverage --temp temp-artifacts --testfiles test/emptyrun.coverage.ts && rm -rf coverage.json coverage/ && COVERAGE=true npx hardhat coverage --temp temp-artifacts --testfiles 'test/*.spec.ts'","dev:update-abis":"npm run compile && node ./scripts/updateAbis && npm run prettier:abis","dev:export-storage-layout":"npm run compile && hardhat export-storage-layout","dev:storage-layout-compare":"npm run compile && hardhat storage-layout-compare --a ${CONTRACT_NAME_A} --b ${CONTRACT_NAME_B} --a-ref ${CONTRACT_REF_A} --b-ref ${CONTRACT_REF_B}","dev:export-storage-check":"npm run compile && hardhat storage-layout-check --source ${CONTRACT_LAYOUT_JSON} --b ${CONTRACT_NAME}","prettier:abis":"prettier --write 'abis/**/*.json'","prettier:code":"prettier --write 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts'  'test/**/*.ts' 'test/**/*.sol'","ci:test":"npm run compile && npm run test","ci:clean":"hardhat clean && rm -rf ./artifacts ./cache ./types","bend:hardhat:dev:migration":"npm run compile && npm run hardhat -- bend:dev","bend:localhost:dev:migration":"npm run compile && npm run hardhat:localhost -- bend:dev","bend:localhost:full:migration":"npm run compile && npm run hardhat:localhost -- bend:mainnet","bend:develop:full:migration":"npm run compile && npm run hardhat:develop -- bend:mainnet","bend:rinkeby:full:migration":"npm run compile && npm run hardhat:rinkeby -- bend:mainnet","bend:goerli:full:migration":"npm run compile && npm run hardhat:goerli -- bend:mainnet","bend:main:full:migration":"npm run compile && npm run hardhat:main -- bend:mainnet --verify","develop:verify":"npm run hardhat:develop verify:general -- --all --pool Bend","develop:verify:reserves":"npm run hardhat:develop verify:reserves -- --pool Bend","develop:print-contracts":"npm run hardhat:develop -- print-contracts","develop:print-config":"hardhat --network develop print-config --pool Bend","rinkeby:verify":"npm run hardhat:rinkeby verify:general -- --all --pool Bend","rinkeby:verify:reserves":"npm run hardhat:rinkeby verify:reserves -- --pool Bend","rinkeby:print-contracts":"npm run hardhat:rinkeby -- print-contracts","rinkeby:print-config":"hardhat --network rinkeby print-config --pool Bend","goerli:verify":"npm run hardhat:goerli verify:general -- --all --pool Bend","goerli:verify:reserves":"npm run hardhat:goerli verify:reserves -- --pool Bend","goerli:print-contracts":"npm run hardhat:goerli -- print-contracts","goerli:print-config":"hardhat --network goerli print-config --pool Bend","main:verify":"npm run hardhat:main verify:general -- --all --pool Bend","main:verify:reserves":"npm run hardhat:main verify:reserves -- --pool Bend","main:print-contracts":"npm run hardhat:main -- print-contracts","main:print-config":"hardhat --network main print-config --pool Bend","prepublishOnly":"npm run compile"},"devDependencies":{"@chainlink/contracts":"^0.2.2","@nomiclabs/hardhat-ethers":"^2.0.0","@nomiclabs/hardhat-etherscan":"^2.0.2","@nomiclabs/hardhat-waffle":"^2.0.0","@openzeppelin/contracts":"^4.3.3","@openzeppelin/contracts-upgradeable":"^4.3.3","@openzeppelin/test-helpers":"^0.5.15","@typechain/ethers-v5":"^2.0.0","@typechain/hardhat":"^1.0.1","@typechain/truffle-v5":"^2.0.2","@typechain/web3-v1":"^4.0.0","@types/chai":"^4.2.11","@types/lowdb":"^1.0.9","@types/mocha":"^7.0.2","@types/node":"^14.0.5","bignumber.js":"^9.0.0","chai":"^4.2.0","chai-bignumber":"^3.0.0","chai-bn":"^0.2.1","defender-relay-client":"^1.7.0","dotenv":"^8.2.0","eth-sig-util":"2.5.3","ethereum-waffle":"^3.2.0","ethereumjs-util":"^7.0.0","ethers":"^5.0.19","globby":"^11.0.1","hardhat":"^2.2.0","hardhat-contract-sizer":"^2.0.3","hardhat-dependency-compiler":"^1.1.2","hardhat-gas-reporter":"^1.0.0","hardhat-storage-layout-diff":"^0.0.4","hardhat-typechain":"^0.3.3","husky":"^4.2.5","lowdb":"^1.0.0","prettier":"^2.0.5","prettier-plugin-solidity":"^1.0.0-alpha.53","pretty-quick":"^2.0.1","solidity-coverage":"^0.7.17","tmp-promise":"^3.0.2","ts-generator":"^0.1.1","ts-node":"^8.10.2","tslint":"^6.1.2","tslint-config-prettier":"^1.18.0","tslint-plugin-prettier":"^2.3.0","typechain":"^4.0.0","typescript":"^4.0.5"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged --pattern 'contracts/**/*.sol' --pattern 'helpers/**/*.ts'  --pattern 'test/**/*.ts' --pattern 'tasks/**/*.ts'"}},"dependencies":{"global-agent":"^3.0.0"},"gitHead":"5f16c3bee5ccbadd7fefd9cd56ffe793f4751f03","_id":"@benddao/bend-lending-protocol@1.0.11","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-zPCDPymU23uJrUdSLveW+J0nC0HRFlc96w8UbfzjHp81SWp9k2U6BhUgyef3J1bQsN48tGHfsqO+mELUs23eoA==","shasum":"4d3d850b3d9104d8d6e6153d945c91727c2014d9","tarball":"https://registry.npmjs.org/@benddao/bend-lending-protocol/-/bend-lending-protocol-1.0.11.tgz","fileCount":680,"unpackedSize":71286267,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjsANlVLM4e7qiGWW56F7AptYflV0LWnFpD0/zp1H6GQIgFAYkDZQaUNDucpvdTs3qSOYyLH4pTFAzS7D0WKCUEwE="}]},"_npmUser":{"name":"developerbend","email":"developer@benddao.xyz"},"directories":{},"maintainers":[{"name":"developerbend","email":"developer@benddao.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bend-lending-protocol_1.0.11_1693015655055_0.33265890547027777"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-26T02:07:34.939Z","1.0.11":"2023-08-26T02:07:35.416Z","modified":"2023-08-26T02:07:35.728Z"},"maintainers":[{"name":"developerbend","email":"developer@benddao.xyz"}],"description":"BendDAO Lending Protocol smart contracts","homepage":"https://www.benddao.xyz/","repository":{"type":"git","url":"git+https://github.com/BendDAO/bend-lending-protocol.git"},"bugs":{"url":"https://github.com/BendDAO/bend-lending-protocol/issues"},"readme":"[![Build pass](https://github.com/BendDAO/bend-lending-protocol/actions/workflows/node.js.yml/badge.svg)](https://github.com/BendDAO/bend-lending-protocol/actions/workflows/node.js.yml)\n[![codecov](https://codecov.io/gh/BendDAO/bend-lending-protocol/branch/main/graph/badge.svg?token=Z4Y9S158JS)](https://codecov.io/gh/BendDAO/bend-lending-protocol)\n\n```\n######                       ######     #    ####### \n#     # ###### #    # #####  #     #   # #   #     # \n#     # #      ##   # #    # #     #  #   #  #     # \n######  #####  # #  # #    # #     # #     # #     # \n#     # #      #  # # #    # #     # ####### #     # \n#     # #      #   ## #    # #     # #     # #     # \n######  ###### #    # #####  ######  #     # ####### \n```\n\n# BendDAO Lending Protocol\n\nThis repository contains the smart contracts source code and markets configuration for BendDAO Lending Protocol. The repository uses Hardhat as development environment for compilation, testing and deployment tasks.\n\n## What is BendDAO Lending Protocol?\n\nBendDAO Lending Protocol is a decentralized non-custodial NFT lending protocol where users can participate as depositors or borrowers. Depositors provide liquidity to the market to earn a passive income, while borrowers are able to borrow in an overcollateralized fashion, using NFTs as collateral.\n\n## Documentation\n\nThe documentation of BendDAO Lending Protocol is in the following [BendDAO documentation](https://docs.benddao.xyz) link. At the documentation you can learn more about the protocol, see the contract interfaces, integration guides and audits.\n\nFor getting the latest contracts addresses, please check the [Deployed contracts](https://docs.benddao.xyz/developers/deployed-contracts) page at the documentation to stay up to date.\n\n## Audits\n1. [Verilog Solutions Online Report](https://hackmd.io/@verilog/benddao-audit).\n2. [Certik Online Report](https://www.certik.com/projects/bend-dao).\n\n## Thanks\nBendDAO lending protocol refers to the architecture design and adopts some of the code of [AAVE](https://github.com/aave).\nWe are very grateful to AAVE for providing us with an excellent DeFi platform.\n\n## Connect with the community\n\nYou can join at the [Discord](https://discord.gg/benddao) channel or at the [Governance](https://snapshot.org/#/benddao.eth) for asking questions about the protocol or talk about BendDAO with other peers.\n\n## Getting Started\n\nYou can install `@benddao/bend-protocol` as an NPM package in your Hardhat, Buidler or Truffle project to import the contracts and interfaces:\n\n`npm install @benddao/bend-protocol`\n\nImport at Solidity files:\n\n```\nimport {ILendPool} from \"@benddao/bend-protocol/contracts/interfaces/ILendPool.sol\";\n\ncontract Misc {\n\n  function deposit(address pool, address token, address user, uint256 amount) public {\n    ILendPool(pool).deposit(token, amount, user, 0);\n    {...}\n  }\n}\n```\n\nThe JSON artifacts with the ABI and Bytecode are also included into the bundled NPM package at `artifacts/` directory.\n\nImport JSON file via Node JS `require`:\n\n```\nconst LendPoolArtifact = require('@benddao/bend-protocol/artifacts/contracts/protocol/LendPool.sol/LendPool.json');\n\n// Log the ABI into console\nconsole.log(LendPoolArtifact.abi)\n```\n\n## Setup\n\nThe repository uses Docker Compose to manage sensitive keys and load the configuration. Prior any action like test or deploy, you must run `docker-compose up` to start the `contracts-env` container, and then connect to the container console via `docker-compose exec contracts-env bash`.\n\nFollow the next steps to setup the repository:\n\n- Install `docker` and `docker-compose`\n- Create an environment file named `.env` and fill the next environment variables\n\n```\n# Mnemonic, only first address will be used\nMNEMONIC=\"\"\n\n# Add Alchemy or Infura provider keys, alchemy takes preference at the config level\nALCHEMY_KEY=\"\"\nINFURA_KEY=\"\"\n\n# Optional Etherscan key, to automatize the verification of the contracts at Etherscan\nETHERSCAN_KEY=\"\"\n\n```\n\n## Markets configuration\n\nThe configurations related with the BendDAO Markets are located at `markets` directory. You can follow the `IBendConfiguration` interface to create new Markets configuration or extend the current BendDAO configuration.\n\nEach market should have his own Market configuration file, and their own set of deployment tasks, using the BendDAO market config and tasks as a reference.\n\n## Test\n\nYou can run the full test suite with the following commands:\n\n```\n# In one terminal\ndocker-compose up\n\n# Open another tab or terminal\ndocker-compose exec contracts-env bash\n\n# install dependencies\nyarn install\n\n# A new Bash terminal is prompted, connected to the container\nnpm run test\n```\n\n## Deployments\n\nFor deploying BendDAO Lending Protocol, you can use the available scripts located at `package.json`. For a complete list, run `npm run` to see all the tasks.\n\n### Prepare\n```\n# In one terminal\ndocker-compose up\n\n# Open another tab or terminal\ndocker-compose exec contracts-env bash\n\n# install dependencies\nyarn install\n\n# Runing NPM task\n# npm run xxx\n```\n\n### Localhost dev deployment\n```\n# In first terminal\nnpm run hardhat:node\n\n# In second terminal\nnpm run bend:localhost:dev:migration\n```\n\n### Localhost full deployment\n```\n# In first terminal\nnpm run hardhat:node\n\n# In second terminal\nnpx hardhat --network localhost \"dev:deploy-mock-reserves\"\n# then update pool config reserve address\n\nnpx hardhat --network localhost \"dev:deploy-mock-nfts\"\n# then update pool config nft address\n\nnpx hardhat --network localhost \"dev:deploy-mock-aggregators\" --pool Bend\n# then update pool config reserve aggregators address\n\nnpx hardhat --network localhost \"dev:deploy-mock-bnft-registry\" --pool Bend\n# then update pool config bnft registry address\n\nnpx hardhat --network localhost \"dev:deploy-mock-bnft-tokens\" --pool Bend\n```\n\n### Rinkeby full deployment\n```\n# In one terminal\nnpm run bend:rinkeby:full:migration\n```\n\n## Interact with BendDAO Lending Protocol in Mainnet via console\n\nYou can interact with BendDAO Lending Protocol at Mainnet network using the Hardhat console, in the scenario where the frontend is down or you want to interact directly. You can check the deployed addresses at [deployed-contracts](https://docs.benddao.xyz/developers/deployed-contracts).\n\nRun the Hardhat console pointing to the Mainnet network:\n\n```\nnpx hardhat --network main console\n```\n\nAt the Hardhat console, you can interact with the protocol:\n\n```\n// Load the HRE into helpers to access signers\nrun(\"set-DRE\")\n\n// Import getters to instance any Bend contract\nconst contractGetters = require('./helpers/contracts-getters');\n\n// Load the first signer\nconst signer = await contractGetters.getFirstSigner();\n\n// Lend pool instance\nconst lendPool = await contractGetters.getLendPool(\"0x3AF6fC17EbD751E4D11F5A1d6823b2aE64723B87\");\n\n// ERC20 token WETH Mainnet instance\nconst WETH = await contractGetters.getIErc20Detailed(\"0xbe4d36E2C69Aa9658e937f6cC584E60167484381\");\n\n// Approve 10 WETH to LendPool address\nawait WETH.connect(signer).approve(lendPool.address, ethers.utils.parseUnits('10'));\n\n// Deposit 10 WETH\nawait lendPool.connect(signer).deposit(DAI.address, ethers.utils.parseUnits('10'), await signer.getAddress(), '0');\n```\n\n## Tools\n\nThis project integrates other tools commonly used alongside Hardhat in the ecosystem.\n\nIt also comes with a variety of other tools, preconfigured to work with the project code.\n\nTry running some of the following tasks:\n\n```shell\nnpx hardhat accounts\nnpx hardhat compile\nnpx hardhat clean\nnpx hardhat test\nnpx hardhat node\nnpx hardhat help\nREPORT_GAS=true npx hardhat test\nnpx hardhat coverage\nnpx hardhat run scripts/deploy.js\nnode scripts/deploy.js\nnpx eslint '**/*.js'\nnpx eslint '**/*.js' --fix\nnpx prettier '**/*.{json,sol,md}' --check\nnpx prettier '**/*.{json,sol,md}' --write\nnpx solhint 'contracts/**/*.sol'\nnpx solhint 'contracts/**/*.sol' --fix\n```\n\n## Etherscan verification\n\nTo try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.\n\nIn this project, copy the .env.template file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:\n\n```shell\nhardhat run --network ropsten scripts/deploy.js\n```\n\nThen, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command:\n\n```shell\nnpx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS \"Hello, Hardhat!\"\n```\n","readmeFilename":"README.md"}