Open MaksymilianDemitraszek opened 1 year ago
Dispatchers are not bound to the contracts themselves, since what binds them is the address and knowledge that we have a right interface.
This might be not doable because of that, without providing class_hash
from the user. Is this something that is going to be an issue?
Should be doable via a plugin or upstream to compilator
Dispatchers could also generate a static method for deploying a instance of the contract from the provided class hash that would return Self
. Something like
Dispatcher {
// ...
construct(class_hash: ClassHash, arg1: Type1, arg2: Type2, ...) -> Self {
// perform deploy
let addr = ...;
Self { addr }
}
}
Dispatchers could also generate a static method for deploying a instance of the contract from the provided class hash that would return Self. Something like...
That is actually not much different from the current deploy
on the ContractClass
, and would require also a custom plugin (or a modification/overriding of the cairo one) so that will be difficult to implement
@cptartur You can have different constructor signatures for a specific trait.
@cptartur You can have different constructor signatures for a specific trait.
Are you sure about that? I think that contract implementation can only have a single constructor.
@cptartur Contract implementation has one, but dispatchers are generated per trait not per implementation. So you are able to have multiple contract implementations per one dispatcher.
Dispatchers should also support constructors in some way, probably should be upstreamed to the compiler.