-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from onflow/fix-contract-field-access
Fix contract field access
- Loading branch information
Showing
9 changed files
with
89 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import "EVM" | ||
|
||
import "FlowEVMBridgeUtils" | ||
|
||
access(all) | ||
fun main(): String { | ||
let coa = getAuthAccount<auth(BorrowValue) &Account>(0xdfc20aee650fcbdf) | ||
.storage | ||
.borrow<auth(EVM.Call) &EVM.CadenceOwnedAccount>( | ||
from: /storage/evm | ||
) ?? panic("Problem borrowing COA") | ||
// Confirm the registry address was set | ||
let postRegistryResult = coa.call( | ||
to: FlowEVMBridgeUtils.getBridgeFactoryEVMAddress(), | ||
data: EVM.encodeABIWithSignature("owner()", []), | ||
gasLimit: 15_000_000, | ||
value: EVM.Balance(attoflow: 0) | ||
) | ||
assert( | ||
postRegistryResult.status == EVM.Status.successful, | ||
message: "Failed to get registry address from FlowBridgeFactory contract" | ||
) | ||
|
||
let decodedResult = EVM.decodeABI( | ||
types: [Type<EVM.EVMAddress>()], | ||
data: postRegistryResult.data | ||
) | ||
assert(decodedResult.length == 1, message: "Invalid response from getRegistry() call to FlowBridgeFactory contract") | ||
return (decodedResult[0] as! EVM.EVMAddress).toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters