near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.33k stars 629 forks source link

Add an ability to get the info of the storage cost in the runtime #4001

Open alexauroradev opened 3 years ago

alexauroradev commented 3 years ago

Some factory contracts (for example, [the bridge FT connector factory](https://github.com/near/rainbow-token-connector/blob/master/bridge-token-factory/src/lib.rs#L238-L266), or mining pool factory) during their lifetime deploy other contracts. At the moment factory contracts have [hardcoded values](https://github.com/near/rainbow-token-connector/blob/master/bridge-token-factory/src/lib.rs#L24-L32) for the required storage deposits. Similar problem is valid for the data storing.

This can be enhanced, by providing in the runtime an environmental variable for yoctoNEAR cost per byte and/or a function(s) that takes as an argument a piece of data to be saved OR a contract to be deployed and returns the amount of yoctoNEAR to be used as a deposit.

bowenwang1996 commented 3 years ago

@evgenykuzyakov what do you think?

bowenwang1996 commented 3 years ago

Relevant discussion https://gov.near.org/t/store-protocol-config-in-a-contract/2105

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.