From a17d812a72b9fd649efbfca9d1e948c7cb4f5d38 Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:21:26 -0500 Subject: [PATCH] remove unused contract --- .../contracts/utils/DelegatedCOACaller.cdc | 137 ------------------ 1 file changed, 137 deletions(-) delete mode 100644 cadence/contracts/utils/DelegatedCOACaller.cdc diff --git a/cadence/contracts/utils/DelegatedCOACaller.cdc b/cadence/contracts/utils/DelegatedCOACaller.cdc deleted file mode 100644 index f712792c..00000000 --- a/cadence/contracts/utils/DelegatedCOACaller.cdc +++ /dev/null @@ -1,137 +0,0 @@ -import "FungibleToken" - -import "EVM" - -import "FlowEVMBridgeUtils" - -access(all) -contract DelegatedCOACaller { - - access(all) - let pathPrefix: String - - access(all) - event CallerCreated(address: EVM.EVMAddress, owner: Address?) - - access(all) - struct interface ICallParameters { - access(all) let to: EVM.EVMAddress - access(all) let data: [UInt8] - access(all) let gasLimit: UInt64 - access(all) let value: EVM.Balance - } - - access(all) - struct CallParameters : ICallParameters{ - access(all) let to: EVM.EVMAddress - access(all) let data: [UInt8] - access(all) let gasLimit: UInt64 - access(all) let value: EVM.Balance - - init( - to: EVM.EVMAddress, - data: [UInt8], - gasLimit: UInt64, - value: EVM.Balance - ) { - self.to = to - self.data = data - self.gasLimit = gasLimit - self.value = value - } - } - - access(all) - resource interface ICaller : EVM.Addressable { - access(all) - var pendingCall: {ICallParameters}? - - access(EVM.Owner | EVM.Call) - fun setPendingCall(_ parameters: {ICallParameters}) { - pre { - self.pendingCall == nil: "Call already pending" - } - } - - access(EVM.Owner | EVM.Call) - fun reset() { - self.pendingCall = nil - } - - access(all) - fun executeCall(): EVM.Result { - pre { - self.pendingCall != nil: "No pending call found" - } - post { - self.pendingCall == nil - } - } - } - - access(all) - resource Caller : ICaller, EVM.Addressable { - access(self) - let coaCapability: Capability - access(all) - var pendingCall: {ICallParameters}? - - init(coaCapability: Capability) { - pre { - coaCapability.borrow() != nil: "Invalid COA Capability" - } - self.coaCapability = coaCapability - self.pendingCall = nil - } - - /// The EVM address of the associated CadenceOwnedAccount - access(all)caSt - view fun address(): EVM.EVMAddress { - return self.borrowCOA().address() - } - - access(all) - fun executeCall(): EVM.Result { - let callResult = self.borrowCOA().call( - to: self.pendingCall!.to, - data: self.pendingCall!.data, - gasLimit: self.pendingCall!.gasLimit, - value: self.pendingCall!.value - ) - self.reset() - return callResult - } - - access(EVM.Owner | EVM.Call) - fun setPendingCall(_ parameters: {ICallParameters}) { - self.pendingCall = parameters - } - - access(EVM.Owner | EVM.Call) - fun reset() { - self.pendingCall = nil - } - - access(self) - view fun borrowCOA(): auth(EVM.Call) &EVM.CadenceOwnedAccount { - return self.coaCapability.borrow() ?? panic("Invalid COA Capability") - } - } - - access(all) - fun createCaller(coaCapability: Capability): @Caller { - let caller <- create Caller(coaCapability: coaCapability) - emit CallerCreated(address: caller.address(), owner: coaCapability.borrow()!.owner?.address) - return <-caller - } - - access(all) - view fun deriveStoragePath(from coaAddress: EVM.EVMAddress): StoragePath? { - let addressHex = FlowEVMBridgeUtils.getEVMAddressAsHexString(address: coaAddress) - return StoragePath(identifier: self.pathPrefix.concat(addressHex)) - } - - init() { - self.pathPrefix = "delegatedCOACaller_" - } -}