mirror of
				https://github.com/Instadapp/Gelato-automations.git
				synced 2024-07-29 22:28:07 +00:00 
			
		
		
		
	feat: provider payment at ca. break-even
This commit is contained in:
		
							parent
							
								
									10f62bbc9a
								
							
						
					
					
						commit
						1673e08d78
					
				|  | @ -48,7 +48,7 @@ contract ConnectGelatoDataForFullRefinance is ConnectorInterface { | ||||||
|     uint256 internal immutable _id; |     uint256 internal immutable _id; | ||||||
|     address internal immutable _connectGelatoProviderPayment; |     address internal immutable _connectGelatoProviderPayment; | ||||||
| 
 | 
 | ||||||
|     uint256 public constant GAS_COST = 1800000 + (18000 * 12); // 1800000 + ~12% (Estimated Value) |     uint256 public constant GAS_COST = 1850000; | ||||||
| 
 | 
 | ||||||
|     constructor(uint256 id, address connectGelatoProviderPayment) { |     constructor(uint256 id, address connectGelatoProviderPayment) { | ||||||
|         _id = id; |         _id = id; | ||||||
|  |  | ||||||
|  | @ -69,7 +69,7 @@ contract ConnectGelatoDataForPartialRefinance is ConnectorInterface { | ||||||
|     uint256 internal immutable _id; |     uint256 internal immutable _id; | ||||||
|     address internal immutable _connectGelatoProviderPayment; |     address internal immutable _connectGelatoProviderPayment; | ||||||
| 
 | 
 | ||||||
|     uint256 public constant GAS_COST = 1490779 + (14908 * 12); // 1490779 + ~12% (Estimated Value) |     uint256 public constant GAS_COST = 1850000; | ||||||
| 
 | 
 | ||||||
|     constructor(uint256 id, address connectGelatoProviderPayment) { |     constructor(uint256 id, address connectGelatoProviderPayment) { | ||||||
|         _id = id; |         _id = id; | ||||||
|  |  | ||||||
|  | @ -26,7 +26,7 @@ module.exports = { | ||||||
|       // timeout: 150000,
 |       // timeout: 150000,
 | ||||||
|       forking: { |       forking: { | ||||||
|         url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`, |         url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`, | ||||||
|         blockNumber: 11104384, |         blockNumber: 11189230, | ||||||
|       }, |       }, | ||||||
|       // Custom
 |       // Custom
 | ||||||
|       GelatoCore: "0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8", |       GelatoCore: "0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8", | ||||||
|  |  | ||||||
|  | @ -183,9 +183,9 @@ describe("Full Debt Bridge refinancing loan from Maker to Compound", function () | ||||||
|       vaultId |       vaultId | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     const gasFeesPaidFromCol = ethers.utils |     const gasFeesPaidFromCol = ethers.BigNumber.from(1850000).mul( | ||||||
|       .parseUnits(String(1800000 + 18000 * 12), 0) |       gelatoGasPrice | ||||||
|       .mul(gelatoGasPrice); |     ); | ||||||
| 
 | 
 | ||||||
|     const pricedCollateral = ( |     const pricedCollateral = ( | ||||||
|       await contracts.makerResolver.getMakerVaultCollateralBalance(vaultId) |       await contracts.makerResolver.getMakerVaultCollateralBalance(vaultId) | ||||||
|  | @ -220,7 +220,13 @@ describe("Full Debt Bridge refinancing loan from Maker to Compound", function () | ||||||
| 
 | 
 | ||||||
|     expect( |     expect( | ||||||
|       await contracts.gelatoCore.providerFunds(wallets.providerAddress) |       await contracts.gelatoCore.providerFunds(wallets.providerAddress) | ||||||
|     ).to.be.gt(providerBalanceBeforeExecution); |     ).to.be.gt( | ||||||
|  |       providerBalanceBeforeExecution.sub( | ||||||
|  |         gasFeesPaidFromCol | ||||||
|  |           .mul(await contracts.gelatoCore.totalSuccessShare()) | ||||||
|  |           .div(100) | ||||||
|  |       ) | ||||||
|  |     ); | ||||||
| 
 | 
 | ||||||
|     // compound position of DSA on cDai and cEth
 |     // compound position of DSA on cDai and cEth
 | ||||||
|     const compoundPosition = await contracts.compoundResolver.getCompoundData( |     const compoundPosition = await contracts.compoundResolver.getCompoundData( | ||||||
|  |  | ||||||
|  | @ -187,9 +187,9 @@ describe("Full Debt Bridge refinancing loan from ETH-A to ETH-B", function () { | ||||||
|       vaultAId |       vaultAId | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     const gasFeesPaidFromCol = ethers.utils |     const gasFeesPaidFromCol = ethers.BigNumber.from(1850000).mul( | ||||||
|       .parseUnits(String(1800000 + 18000 * 12), 0) |       gelatoGasPrice | ||||||
|       .mul(gelatoGasPrice); |     ); | ||||||
| 
 | 
 | ||||||
|     const pricedCollateral = ( |     const pricedCollateral = ( | ||||||
|       await contracts.makerResolver.getMakerVaultCollateralBalance(vaultAId) |       await contracts.makerResolver.getMakerVaultCollateralBalance(vaultAId) | ||||||
|  | @ -238,7 +238,13 @@ describe("Full Debt Bridge refinancing loan from ETH-A to ETH-B", function () { | ||||||
| 
 | 
 | ||||||
|     expect( |     expect( | ||||||
|       await contracts.gelatoCore.providerFunds(wallets.providerAddress) |       await contracts.gelatoCore.providerFunds(wallets.providerAddress) | ||||||
|     ).to.be.gt(providerBalanceBeforeExecution); |     ).to.be.gt( | ||||||
|  |       providerBalanceBeforeExecution.sub( | ||||||
|  |         gasFeesPaidFromCol | ||||||
|  |           .mul(await contracts.gelatoCore.totalSuccessShare()) | ||||||
|  |           .div(100) | ||||||
|  |       ) | ||||||
|  |     ); | ||||||
| 
 | 
 | ||||||
|     // Estimated amount to borrowed token should be equal to the actual one read on compound contracts
 |     // Estimated amount to borrowed token should be equal to the actual one read on compound contracts
 | ||||||
|     expect(debtOnMakerBefore).to.be.equal(debtOnMakerVaultB); |     expect(debtOnMakerBefore).to.be.equal(debtOnMakerVaultB); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 gitpusha
						gitpusha