Open
Description
Issue To Be Solved
For debugging purposes and for error reporting, it would be nice if the cadence call stack continued through direct contract function invocations.
Example:
pub fun main(): UFix64 {
return getBalance(0x01)
}
pub fun getBalance(_ address: Address): UFix64 {
let account = getAccount(address)
return account.balance
}
// Snippet from FlowServiceAccount that is called when calling `.balance` through a direct contract function invoke
pub fun defaultTokenBalance(_ acct: PublicAccount): UFix64 {
var balance = 0.0
if let balanceRef = acct
.getCapability(/public/flowTokenBalance)
.borrow<&FlowToken.Vault{FungibleToken.Balance}>(){ // <---- lets say you are here
balance = balanceRef.balance
}
return balance
}
When you are at that point, the call stack should be:
- main
- getBalance
- defaultTokenBalance
but it is just
- defaultTokenBalance
Suggested Solution
Not really sure how to do this. Maybe cadence should be aware of which calls trigger direct contract function invocations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment