Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Fix FullRouter deposit issue (#84)
Browse files Browse the repository at this point in the history
* fix full router leverage

* enhancement of 'tempEstimate' mechanism for safety (#74)

* enhancement of 'tempEstimate' mechanism for safety

* some documentation to not confuse future devs

* overshoot first entry for safety

* update session to sandbox and include child calls

* update doc

* fix redundancy

* del temp deletes to keep temp vals available within a session

* del unneeded topLevel check

* show that FullRouter is broken under meta strategies with debt

* fixed test: using fullrouter for metastrategy, so the fullrouter is NOT broken under metastrategies with debt for deploying

* fix strategy naming clash

* Improved cache (#79)

* cache leverage item percentage

* remove end session

* update tests

* include withdrawal fee in meta strategy estimate

* limit slippage estimate

Co-authored-by: Peter Phillips <[email protected]>

Co-authored-by: George Carder <[email protected]>
  • Loading branch information
PeterMPhillips and georgercarder authored May 2, 2022
1 parent 1b1fdb9 commit 2d87739
Show file tree
Hide file tree
Showing 9 changed files with 608 additions and 102 deletions.
200 changes: 144 additions & 56 deletions contracts/routers/FullRouter.sol

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function getNetworks(): NetworksUserConfig {
if (archiveNode)
networks.hardhat.forking = {
url: archiveNode,
blockNumber: 14619730,
blockNumber: 14655540,
}
}
if (mnemonic && infuraApiKey) {
Expand Down
1 change: 1 addition & 0 deletions lib/estimator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ export class Estimator {
} else if (tokenOut.toLowerCase() === WETH.toLowerCase()) {
// Withdraw
const strategy = new Contract(tokenIn, IStrategy.abi, this.signer)
amount = amount.sub(amount.mul(2).div(DIVISOR))
return this.withdraw(strategy, amount)
} else {
// Meta strategies always have weth as an input or output
Expand Down
4 changes: 2 additions & 2 deletions lib/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class LiveEnvironment {
platform: Platform
adapters: LiveAdapters
routers: LiveRouters
estimators: Estimators
estimators: Estimators

constructor(
signer: SignerWithAddress,
Expand All @@ -75,7 +75,7 @@ export class LiveEnvironment {

export type LiveAdapters = {
aaveV2: Contract
aaveV2Debt: Contract
aaveV2Debt: Contract
balancer: Contract
compound: Contract
curve: Contract
Expand Down
Loading

0 comments on commit 2d87739

Please sign in to comment.