Created
February 27, 2020 11:24
-
-
Save PaulRBerg/5f1b76437aa705cf16719ee247ee8c99 to your computer and use it in GitHub Desktop.
Use Argent's approveAndCall
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
const data = payrollContract.interface.functions.createSalary.encode([ | |
recipientAddress, | |
deposit.toString(10), | |
tokenAddress, | |
startTime.toString(10), | |
stopTime.toString(10), | |
]); | |
const gasLimit = GAS_LIMITS.tokenApproval + createSalaryGasLimit; | |
console.log({ data, gasLimit }); | |
try { | |
const txHash = await walletHelper.approveAndCall( | |
tokenAddress, | |
deposit.toString(10), | |
payrollContract.address, | |
data, | |
gasLimit, | |
); | |
console.log({ txHash }); | |
} catch (myOtherError) { | |
console.log({ myOtherError }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment