# How to deploy existing DeFi contracts to localhost?

**URL:** <https://forum.openzeppelin.com/t/how-to-deploy-existing-defi-contracts-to-localhost/2838>\
**Category:** Support\
**Created:** [May 11, 2020, 8:45am UTC](https://forum.openzeppelin.com/t/how-to-deploy-existing-defi-contracts-to-localhost/2838 "2020-05-11T08:45:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankarrr](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ankarrr/32/2543_2.png) [@Ankarrr](https://forum.openzeppelin.com/u/Ankarrr)\
**Post date:** [May 11, 2020, 8:45am UTC](https://forum.openzeppelin.com/t/how-to-deploy-existing-defi-contracts-to-localhost/2838/1 "2020-05-11T08:45:25Z")

</div>

I am trying to developing smart contracts let use some Tokens and DeFi protocols like USDC, Compound, Uniswap, etc. Then if I need to testing locally, I need to deploy them in localhost blockchain (Ganache). I currently can’t find a good way to do this. Please help.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [May 11, 2020, 10:04am UTC](https://forum.openzeppelin.com/t/how-to-deploy-existing-defi-contracts-to-localhost/2838/2 "2020-05-11T10:04:55Z")

</div>

Hi @Ankarrr,

Welcome to the community forum 👋

You could test against a fork of mainnet using `ganache-cli --fork` so that you can use the actual DeFi contracts.

OpenZeppelin Test Environment supports testing using ganache fork. See the announcement for details:

> [@OpenZeppelin Test Environment 0.1.4: Ganache Fork](https://forum.openzeppelin.com/t/openzeppelin-test-environment-0-1-4-ganache-fork/2668):
>
> Hey everyone! We are happy to announce the release 0.1.4 of our Test Environment. This [release](https://github.com/OpenZeppelin/openzeppelin-test-environment/releases/tag/v0.1.4) delivers support for Ganache fork, unlocked\_accounts, and allowUnlimitedContractSize [options](https://docs.openzeppelin.com/test-environment/0.1/getting-started#advanced-options). With these options enabled you can fork mainnet and run tests locally on protocols such as Maker, Compound, and Uniswap without complicated test setups. Another reason to test on mainnet is to make sure your upgrade process [goes swiftly](https://blog.openzeppelin.com/testing-real-world-contract-upgrades/). Try it today! $ npm install --save-dev @openzeppelin/test-envi…

---

<div class="post-metadata">

**Author:** ![Ankarrr](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ankarrr/32/2543_2.png) [@Ankarrr](https://forum.openzeppelin.com/u/Ankarrr)\
**Post date:** [May 14, 2020, 9:01am UTC](https://forum.openzeppelin.com/t/how-to-deploy-existing-defi-contracts-to-localhost/2838/3 "2020-05-14T09:01:21Z")

</div>

Very helpful! Thank you.
