Skip to content

Commit

Permalink
update interface event types & values
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Jun 25, 2024
1 parent 8cae3ad commit 700dfe4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ access(all) contract FlowEVMBridgeHandlerInterfaces {
**************/

/// Event emitted when a handler is enabled between a Cadence type and an EVM address
access(all) event HandlerEnabled(handlerType: String, targetType: String, targetEVMAddress: String)
access(all) event MinterSet(handlerType: String, targetType: String?, targetEVMAddress: String?, minterType: String)
access(all) event HandlerEnabled(
handlerType: String,
handlerUUID: UInt64,
targetType: String,
targetEVMAddress: String
)
access(all) event MinterSet(handlerType: String,
handlerUUID: UInt64,
targetType: String?,
targetEVMAddress: String?,
minterType: String,
minterUUID: UInt64
)

/****************
Constructs
Expand Down Expand Up @@ -75,9 +86,11 @@ access(all) contract FlowEVMBridgeHandlerInterfaces {
minter.getMintedType() == self.getTargetType(): "Minter does not mint the target type"
emit MinterSet(
handlerType: self.getType().identifier,
handlerUUID: self.uuid,
targetType: self.getTargetType()?.identifier,
targetEVMAddress: self.getTargetEVMAddress()?.toString(),
minterType: minter.getType().identifier
minterType: minter.getType().identifier,
minterUUID: minter.uuid
)
}
}
Expand All @@ -93,6 +106,7 @@ access(all) contract FlowEVMBridgeHandlerInterfaces {
self.isEnabled(): "Problem enabling Handler"
emit HandlerEnabled(
handlerType: self.getType().identifier,
handlerUUID: self.uuid,
targetType: self.getTargetType()!.identifier,
targetEVMAddress: self.getTargetEVMAddress()!.toString()
)
Expand Down
4 changes: 2 additions & 2 deletions cadence/contracts/bridge/interfaces/IEVMBridgeNFTMinter.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "NonFungibleToken"
access(all)
contract interface IEVMBridgeNFTMinter {

access(all) event Minted(type: Type, id: UInt64, uuid: UInt64, evmID: UInt256, tokenURI: String, minter: Address)
access(all) event Minted(type: String, id: UInt64, uuid: UInt64, evmID: UInt256, tokenURI: String, minter: Address)
access(all) event TokenURIUpdated(evmID: UInt256, newURI: String, updater: Address)

/// Account-only method to mint an NFT
Expand All @@ -14,7 +14,7 @@ contract interface IEVMBridgeNFTMinter {
fun mintNFT(id: UInt256, tokenURI: String): @{NonFungibleToken.NFT} {
post {
emit Minted(
type: result.getType(),
type: result.getType().identifier,
id: result.id,
uuid: result.uuid,
evmID: id,
Expand Down
9 changes: 7 additions & 2 deletions cadence/contracts/bridge/interfaces/IEVMBridgeTokenMinter.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ access(all)
contract interface IEVMBridgeTokenMinter {

/// Emitted whenever tokens are minted, identifying the type, amount, and minter
access(all) event Minted(type: Type, amount: UFix64, mintedUUID: UInt64, minter: Address)
access(all) event Minted(type: String, amount: UFix64, mintedUUID: UInt64, minter: Address)

/// Account-only method to mint a fungible token of the specified amount.
///
access(account)
fun mintTokens(amount: UFix64): @{FungibleToken.Vault} {
post {
result.balance == amount: "Result does not contained specified amount"
emit Minted(type: result.getType(), amount: amount, mintedUUID: result.uuid, minter: self.account.address)
emit Minted(
type: result.getType().identifier,
amount: amount,
mintedUUID: result.uuid,
minter: self.account.address
)
}
}
}

0 comments on commit 700dfe4

Please sign in to comment.