我有一个正在运行的示例,它将 Aave 令牌存入 Aave。我正在使用Aave v2 github提供的代码合同示例
// Fork Kovan
await hre.network.provider.request({
method: 'hardhat_reset',
params: [{ forking: { jsonRpcUrl: KOVAN_JSON_RPC } }],
});
// Act like AAVE_HOLDER
await hre.network.provider.request({
method: 'hardhat_impersonateAccount',
params: [AAVE_HOLDER],
});
const signer = await hre.ethers.getSigner(AAVE_HOLDER);
console.log('signer:', signer.address);
// AAVE token on Kovan network
const aavetoken = IERC20__factory.connect(AAVE_TOKEN_ADDRESS, signer);
console.log('token balance:', (await aavetoken.balanceOf(signer.address)).toString());
const MyV2CreditDelegation = new MyV2CreditDelegation__factory(signer);
const delegation = await MyV2CreditDelegation.deploy({ gasLimit: 1e7 });
console.log('delegation:', delegation.address);
// Set the allowance higher than the deposit amount
// so we know we can make multiple transactions
let allowance = 100000
let despositAmount = 10;
await aavetoken.approve(delegation.address, allowance);
console.log('allowance:', (await aavetoken.allowance(signer.address, delegation.address, { gasLimit: 1e6 })).toString());
const depositTrans = await delegation.depositCollateral(aavetoken.address, despositAmount, true, { gasLimit: 1e6 });
console.log('depositTrans:', depositTrans.hash);
const depositReceipt = await depositTrans.wait();
存款工作正常,但是当我尝试提款时:
try {
var withdrawTrans = await delegation
.withdrawCollateral(aavetoken.address, { gasLimit: 1e6 })
console.log('withdrawTrans:', withdrawTrans.hash);
const withdrawReceipt = await withdrawTrans.wait();
}
catch (err) {
console.log('Error:' + err);
}
我收到一个错误:
事务恢复:函数返回了意外的数据量
我对安全帽很陌生,我现在确定如何进一步调试它。如何退出 Aave?