Issue with a checker inside `sendMintRequest` function
Closed this issue · 4 comments
Jaseempk commented
Line 137 in 35af5e0
s_portfolioBalance
is updated only in the _mintFulFillRequest
function which is called inside fulfillRequest
function.
So If I'm not wrong when we initially call sendMintRequest
function this s_portfolioBalance
will be zero right, then this function call is always gonna revert right?
Correct me If I'm wrong.
PatrickAlphaC commented
You're right! We should initialize calling this func
Jaseempk commented
what would be the better approach for this?
Is it optimal to just initialise the value of s_portfolioBalance
by calling a function in the constructor like this?
function initializePortfolioBalance(bytes memory response) internal {
s_portfolioBalance = uint256(bytes32(response));
}
PatrickAlphaC commented
Hmm... Yes! Have an initializer with a balance would be great.
Jaseempk commented
yep got it thanks