On-chain defense against hostile takeovers. In layman's terms, this smart contract only facilitates a discounted sale of shares to a whitelisted group.
More info on the concept of a poison pill can be found below:
- https://www.investopedia.com/terms/p/poisonpill.asp
- https://twitter.com/GuardAOR/status/1476271943351427078
- Whitelisted sale โ only accounts whitelisted by the owner can
redeem. The whitelist can be updated at any time, individually or in batches. - Configurable payment assets โ the pill accepts any set of ERC20s as payment. Each asset is valued through its own Chainlink-compatible USD feed, or assumed to hold a 1:1 USD peg when no feed is configured (e.g. USDC). Assets can be added and removed post-deployment.
- Two price sources for the token โ a Chainlink-compatible feed, or a
manually maintained
pricefor tokens with no on-chain feed. A non-zero manual price always overrides the feed.discountBPbasis points are shaved off whichever price applies. - Oracle hygiene โ feeds are read via
latestRoundData; non-positive answers revert, and answers older thanmaxOracleAgerevert. - Slippage protection โ
redeemtakesminTokensOutso buyers cannot be front-run by price updates. - One-way funds โ
withdrawpushes proceeds to the treasury and is callable by anyone; it cannot touch the treasury token, so nobody can defuse the pill mid-sale.sweeprecovers unsold treasury tokens, is owner-only, and also only ever pays out to the treasury.
- Off-chain process in
$TOKENentity (corporate or DAO) triggers the need to use a poison pill. It is assumed that shares in the entity are represented as an ERC20 token. - Deploy the pill with the initial whitelist, payment assets, and one of the two token price sources (feed or manual price) โ see .env.example for the full parameter list.
- Move the funds to sell from the entity's treasury to the pill contract. The
goal of the pill is to deter an attacker attempting a takeover and/or bring them
to the negotiation table, so management can fund the pill in batches rather than
all at once. If the attacker backs off, the owner can
sweepunsold tokens back to the treasury. - Whitelisted users buy
$TOKENat a discount with any registered payment asset viaredeem(previewRedeemquotes the current rate). - Anyone can push accumulated proceeds back to the treasury via
withdraw.
Foundry under the hood. The test suite includes unit, fuzz, and invariant tests; Slither runs in CI and the source is kept finding-free.
make build # compile
make test # unit + fuzz + invariant tests
make fmt # format
make lint # formatting check + slither
Find a variety of Chainlink feeds to test with at https://data.chain.link.
Copy .env.example to .env, fill in your parameters, then:
make deploy-sepolia
These smart contracts are being provided as is. No guarantee, representation, or warranty is being made, express or implied, as to the safety or correctness of any code provided in this repository. The contracts have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information, or loss of funds. The original author is not liable for any of the foregoing. Users should proceed with caution and use at their own risk. On top of this, nothing in this repository constitutes legal advice. Please advise with a lawyer before executing the poison pill strategy.