You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deploying contracts and / or contract interaction can sometimes work differently, depending on the development environment (e.g. Starknet)
ape-starknet needs more customization around ContractContainers available on the ProjectManager (e.g. ape.project.MyContract).
We need to support contract declaration. Soon, Deploy transactions will no longer work on Starknet.
A contract declaration in Starknet is a type of transaction (like a Deploy) but for allowing other contracts to deploy your contract. You cannot invoke methods on a ContractDeclaration. It like a Class versus an instance of the class. In Starknet, you publish your contract types and other contracts (accounts) can deploy those types.
Additionally, we would like to be able to customize the selector hash function of contract types, which is available in ethpm-types but there is not an easy way to force Ape to use a custom class of ContractType.
Value:
Ecosystem plugins
Multi-chain compatibility in Ape.
Starknet users
Dependencies:
n/a
Design approach:
ape.api.compilers.py:
classCompilerAPI:
contract_type_cls: Type[ContracType] =ContractType"""The class to use when creating contract types."""
CompilerManager in ape:
classCompilerManager:
deflookup_contract_type_cls(self, contract_type):
"""Get the plugin defined contract type cls for a given contract type."""
new file: ape.api.contracts.py:
classContractContainerAPI:
@abstractmethoddefis_container_type(self, contract_type: ContractType):
...
@abstractmethoddefget_container(self, contract_type) ->ContractContainer:
....
classContractContainer:
defis_container_type(self, contract_type: ContractType):
"""Return True when the contract type is part of a specific plugin's container type."""defget_container(self, contract_type) ->ContractContainer:
plugin_defined_contract_type=self.compiler_manager.lookup_contract_type_cls(contract_type)
returnContractContainer(plugin_defined_contract_type)
ape-cairo compilers.py:
classStarknetContractType(ContractType):
"""A contract type with a custom hash function using the Starknet keccak for easy lookup of contract methods."""classCairoCompiler:
contract_type_cls=StarknetContractType
ape-starknet register the container
fromape.api.contractsimportContractContainer# Has all the same methods as the normal container except adding new ones (still a registerable API class)classStarknetContractContainer(ContractContainer):
defdeclare() ->ContractDelcaration (definitonTBD)
Task list:
Tasks go here
Estimated completion date:
For now, the plan to add declare() to the accounts, since we have deploy() there as well. However, it is more ideal to have both.
Design review:
Do not signoff unless:
agreed the tasks and design approach will achieve acceptance, and
the work can be completed by one person within the SLA.
Design reviewers should consider simpler approaches to achieve goals.
This is also something that is hinting might be a good ticket to do for titanboa enhancement.
My idea is something along the lines of allowing ape-vyper to customize ContractContainer objects for vyper contracts. I don't know exactly how that will work yet.
Elevator pitch:
Deploying contracts and / or contract interaction can sometimes work differently, depending on the development environment (e.g. Starknet)
ape-starknet
needs more customization aroundContractContainer
s available on theProjectManager
(e.g.ape.project.MyContract
).We need to support contract declaration. Soon,
Deploy
transactions will no longer work on Starknet.A contract declaration in Starknet is a type of transaction (like a
Deploy
) but for allowing other contracts to deploy your contract.You cannot invoke methods on a ContractDeclaration. It like a Class versus an instance of the class. In Starknet, you publish your contract types and other contracts (accounts) can deploy those types.
Additionally, we would like to be able to customize the selector hash function of contract types, which is available in
ethpm-types
but there is not an easy way to force Ape to use a custom class ofContractType
.Value:
Dependencies:
n/a
Design approach:
ape.api.compilers.py:
CompilerManager in ape:
new file:
ape.api.contracts.py
:ape-cairo compilers.py:
ape-starknet register the container
Task list:
Estimated completion date:
For now, the plan to add
declare()
to theaccounts
, since we havedeploy()
there as well. However, it is more ideal to have both.Design review:
Do not signoff unless:
Design reviewers should consider simpler approaches to achieve goals.
(Please leave a comment to sign off)
Related Tickets
Contract declaration support: ApeWorX/archive-ape-starknet#32
Custom selector insurance: ApeWorX/ethpm-types#38
Custom contract types in ape-cairo: https://github.com/ApeWorX/ape-cairo/issues/20
The text was updated successfully, but these errors were encountered: