Gelato-automations/test/helpers/services/gelato/provideFunds.js

37 lines
1004 B
JavaScript
Raw Normal View History

2020-11-16 16:55:04 +00:00
const { expect } = require("chai");
2020-10-30 17:35:11 +00:00
2020-11-15 14:08:12 +00:00
module.exports = async function (
gelatoProviderWallet,
2020-10-30 17:35:11 +00:00
gelatoCore,
gasLimit,
gasPriceCeil
) {
//#region Provider put some fund on gelato for paying future tasks executions
// Provider put some funds in gelato system for paying the
// Executor when this one will execute task on behalf of the
// Provider. At each provider's task execution, some funds (approximatively
// the gas cost value) will be transfered to the Executor stake.
let gelatoProviderAddress = await gelatoProviderWallet.getAddress();
2020-10-30 17:35:11 +00:00
const TASK_AUTOMATION_FUNDS = await gelatoCore.minExecProviderFunds(
gasLimit,
gasPriceCeil
);
await expect(
gelatoCore
.connect(gelatoProviderWallet)
.provideFunds(gelatoProviderAddress, {
value: TASK_AUTOMATION_FUNDS,
})
2020-10-30 17:35:11 +00:00
).to.emit(gelatoCore, "LogFundsProvided");
expect(await gelatoCore.providerFunds(gelatoProviderAddress)).to.be.equal(
2020-10-30 17:35:11 +00:00
TASK_AUTOMATION_FUNDS
);
//#endregion
2020-11-15 14:08:12 +00:00
};