# Smart contract upgrade costs

**URL:** <https://forum.openzeppelin.com/t/smart-contract-upgrade-costs/814>\
**Category:** SDK\
**Created:** [June 9, 2019, 9:42am UTC](https://forum.openzeppelin.com/t/smart-contract-upgrade-costs/814 "2019-06-09T09:42:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![techbro965](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/techbro965/32/626_2.png) [@techbro965](https://forum.openzeppelin.com/u/techbro965)\
**Post date:** [June 9, 2019, 9:42am UTC](https://forum.openzeppelin.com/t/smart-contract-upgrade-costs/814/1 "2019-06-09T09:42:28Z")

</div>

Hi got a few questions regarding the upgradeability costs for a contract.

When using ZeppelinOS and updating the contract how are the costs to update the contract calculated?

Do they take the same costs as if the contract was deployed fresh from start or the cost will only be for the code changes in he functions/variables?

Does the storage affect the price, lets say I have 20 records already saved in a mapping would the cost to upgrade contract be the same as if there were no records ?

---

<div class="post-metadata">

**Author:** ![spalladino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/spalladino/32/22_2.png) [@spalladino](https://forum.openzeppelin.com/u/spalladino)\
**Post date:** [June 10, 2019, 1:46pm UTC](https://forum.openzeppelin.com/t/smart-contract-upgrade-costs/814/2 "2019-06-10T13:46:34Z")

</div>

Hey @techbro965, that’s a good question! The cost of updating a contract does **not** depend on storage, but rather on two things:

1- Deploying the new logic contract (this is exactly the same as if the contract was deployed anew)  
2- Updating your upgradeable instance from the old logic contract to the new one (constant cost, rather cheap, as it requires only to [change the implementation slot](https://github.com/zeppelinos/zos/blob/861be136120d90435d3782f55dd8da28a758229a/packages/lib/contracts/upgradeability/BaseUpgradeabilityProxy.sol#L41-L44) in storage)

Note that, if you have multiple instances of the same contract, you need to pay the cost for (1) only once, and (2) for each instance. Even better, if you are upgrading an instance created [directly from an EVM package](https://docs.zeppelinos.org/docs/linking.html), you don’t need to pay anything for (1), since it’s handled by the EVM package owner.
