跳到主要内容

Description

There’s a pool offering rewards in tokens every 5 days for those who deposit their DVT tokens into it.

Alice, Bob, Charlie and David have already deposited some DVT tokens, and have won their rewards!

You don’t have any DVT tokens. But in the upcoming round, you must claim most rewards for yourself.

By the way, rumours say a new pool has just launched. Isn’t it offering flash loans of DVT tokens?

Code

ERC20Snapshot:继承自 ERC20,通过 SnapshotId 可以追溯到每一个快照时间点的账户余额和总供应量,在 ERC20 token 的 transfer 之前会通过 beforeTransfer 来更新当前快照 ID 下的账号余额和总供应,通常用作分红、投票、空投等快照场景.

Pool: 通过distributeRewards 来进行分配,每一次Deposit都会调用一次。 FlashLoan: 提供闪电贷

Solution

所以我们的攻击思路就是,通过闪电贷deposit到pool中,出发分分配,分配了之后,再进行Withdraw赎回DVT,把闪电贷归还就好了

Exp