diff --git a/src/lib.cairo b/src/lib.cairo index ae40474..62d2e03 100644 --- a/src/lib.cairo +++ b/src/lib.cairo @@ -25,6 +25,7 @@ pub mod PushComm { use openzeppelin::access::ownable::OwnableComponent; use openzeppelin::upgrades::UpgradeableComponent; use openzeppelin::upgrades::interface::IUpgradeable; + use openzeppelin::upgrades::interface::IUpgradeAndCall; component!(path: OwnableComponent, storage: ownable, event: OwnableEvent); component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent); @@ -170,6 +171,15 @@ pub mod PushComm { fn upgrade(ref self: ContractState, new_class_hash: ClassHash) { self.ownable.assert_only_owner(); self.upgradeable.upgrade(new_class_hash); + } + } + + #[abi(embed_v0)] + impl UpgradeAndCallImpl of IUpgradeAndCall { + fn upgrade_and_call(ref self: ContractState, new_class_hash: ClassHash, selector: felt252, + calldata: Span) -> Span { + self.ownable.assert_only_owner(); + self.upgradeable.upgrade_and_call(new_class_hash, selector, calldata) } }