-
Notifications
You must be signed in to change notification settings - Fork 85
WOETH: Donation attack prevention #2106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sparrowDom
wants to merge
51
commits into
master
Choose a base branch
from
sparrowDom/woeth_hack_proof
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
2839dc1
intermittent work committed
sparrowDom 2e6be62
add draft solution for preparing WOETH for the landing markets
sparrowDom 5495d4b
add tests that confirm lending market protection works as exepcted
sparrowDom d0eb16f
add test to protect agains calling initialize twice
sparrowDom fc5d874
add comments
sparrowDom cfec4e5
remove unneeded files
sparrowDom 8405bfc
minor bug fix
sparrowDom e03223c
add fork script tests and fix bug
sparrowDom 319467f
add comments
sparrowDom 1142a74
add another test
sparrowDom f911ba6
divide after multiply
sparrowDom 3dc8523
change credits per token to highres
sparrowDom bad282b
add comment
sparrowDom 07b51cf
comments
sparrowDom c0333fb
lint
sparrowDom 2c965c3
minor changes
sparrowDom df57ef7
Merge remote-tracking branch 'origin/master' into sparrowDom/woeth_ha…
sparrowDom 13fd4da
correct fixture
sparrowDom 7923ddb
make code slighlty better regarding re-entry
sparrowDom c69583f
prettier
sparrowDom 6822937
add explicit visibility
sparrowDom ac855d9
minor test enhancement
sparrowDom 1c9fc64
better function name
sparrowDom 56d0b7d
remove comment
sparrowDom 057469c
simplify
sparrowDom 1a6a16f
simplify code
sparrowDom 2223600
simplify code
sparrowDom b34d811
Merge remote-tracking branch 'origin/master' into sparrowDom/woeth_ha…
sparrowDom 39e8d4b
refactor
sparrowDom 3615ef7
add redeem all test
sparrowDom 466f957
prettier
sparrowDom 52eb244
Add wOETH donation fork tests (#2122)
shahthepro f0580bc
rename deploy script
sparrowDom 0a988d5
add another test and simplify constructor
sparrowDom e2eb8cf
fix: specify override for name and symbol.
clement-ux c6ded55
fix: import IERC20Metadata.
clement-ux be6d473
add gap
sparrowDom c38a3c6
update reference to code
sparrowDom 66269c8
fix compile errors
sparrowDom 5a7192d
move initialize2() into primary initializer
sparrowDom 5ff5c5d
remove virtual where not needed
sparrowDom a05eaa5
Merge remote-tracking branch 'origin/master' into sparrowDom/woeth_ha…
sparrowDom 3ef2219
pick a more appropriate method for fetching highres CPT
sparrowDom 637cd3c
round in the favour of the protocol
sparrowDom 390e4a2
Revert "round in the favour of the protocol"
sparrowDom aad7b57
rounding error fixes
sparrowDom c005824
Option 1 for WOETH rounding error (#2419)
sparrowDom 36c2ce3
prettier
sparrowDom 6791cf1
add require 0 checks
sparrowDom abd7fbe
allow 0 value mints and redeems
sparrowDom 79af39f
Merge remote-tracking branch 'origin/master' into sparrowDom/woeth_ha…
sparrowDom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from world import * | ||
|
||
def expect_approximate(woeth_holder, expected_balance): | ||
balance = woeth.balanceOf(woeth_holder) | ||
diff = abs(expected_balance - balance) | ||
if (diff != 0): | ||
raise Exception("Unexpected balance for account: %s".format(woeth_holder)) | ||
|
||
def confirm_balances_after_upgrade(): | ||
expect_approximate("0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", 1013453939109688661944) | ||
expect_approximate("0xC460B0b6c9b578A4Cb93F99A691e16dB96Ee5833", 575896531839923556165) | ||
expect_approximate("0xdca0a2341ed5438e06b9982243808a76b9add6d0", 319671606657733042618) | ||
expect_approximate("0x8a9d46d28003673cd4fe7a56ecfcfa2be6372e64", 182355401624955452064) | ||
expect_approximate("0xf65ecb5610000100befba41b9f9cf5ca32838078", 97352556026536192865) | ||
expect_approximate("0x0a26e7ab5c554232314a8d459eff0ede72333f08", 91628532171545105831) | ||
|
||
|
||
def manipulate_price(): | ||
OETH_WHALE="0xa4C637e0F704745D182e4D38cAb7E7485321d059" | ||
whl = {'from': OETH_WHALE } | ||
|
||
woeth.convertToAssets(1e18) / 1e18 | ||
oeth.transfer(woeth.address, 10_000 * 1e18, whl) | ||
woeth.convertToAssets(1e18) / 1e18 | ||
|
||
oeth.approve(woeth.address, 1e50, whl) | ||
woeth.deposit(5_000 * 1e18, OETH_WHALE, whl) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const { deploymentWithGovernanceProposal } = require("../../utils/deploy"); | ||
|
||
module.exports = deploymentWithGovernanceProposal( | ||
{ | ||
deployName: "112_upgrade_woeth", | ||
forceDeploy: false, | ||
//forceSkip: true, | ||
reduceQueueTime: true, | ||
deployerIsProposer: false, | ||
// proposalId: | ||
}, | ||
async ({ deployWithConfirmation, ethers }) => { | ||
const cOETHProxy = await ethers.getContract("OETHProxy"); | ||
const cWOETHProxy = await ethers.getContract("WOETHProxy"); | ||
|
||
const dWOETHImpl = await deployWithConfirmation("WOETH", [ | ||
cOETHProxy.address, | ||
]); | ||
|
||
const cWOETH = await ethers.getContractAt("WOETH", cWOETHProxy.address); | ||
|
||
// Governance Actions | ||
// ---------------- | ||
return { | ||
name: `Upgrade WOETH to a new implementation.`, | ||
actions: [ | ||
// 1. Upgrade WOETH | ||
{ | ||
contract: cWOETHProxy, | ||
signature: "upgradeTo(address)", | ||
args: [dWOETHImpl.address], | ||
}, | ||
// 2. Run the second initializer | ||
{ | ||
contract: cWOETH, | ||
signature: "initialize2()", | ||
args: [], | ||
}, | ||
], | ||
}; | ||
} | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.