Skip to content
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

Created: Fractional Market Wrapper #82

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Saw-mon-and-Natalie
Copy link

@Saw-mon-and-Natalie Saw-mon-and-Natalie commented May 12, 2022

This PR adds a market wrapper for Fractional auctions.

Summary of Addition and Changes

Contracts

  • The main contract created is FractionalMarketWrapper.sol.
  • PartyBid.sol is slightly changed (v4) to accommodate rebalancing its wETH and ETH balances. The changes are not required if the party is winning or it has not placed a bid yet. It is only necessary if the party has lost or the multisig is forcing the party to lose. Every time the bid function is called the call is delegated to FractionalMarketWrapper's bid(uint256 auctionId, uint256 bidAmount) and there we are also making sure the wETH is withdrawn to party's balance.

Tests

  • To make sure that the Fractional auction ends using evm_increaseTime method, we added a new constant EIGHT_DAYS_IN_SECONDS and for the tests regarding Fractional that value has been used.
  • Some tests have been changed to check for wETH + ETH balance to be invariant for Fractional auctions instead of only PartyBid's ETH balance.
  • Since ERC721TokenVault.sol uses a hardcoded/constant weth address, a constant for 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 is also created and by using the hardhat_setCode method we etch the compiled runtime bytecode for EtherToken at that address.

All tests are passing. For running the tests faster use the following command:

npm run hardhat test --grep "FRACTIONAL"

… changed PartyBid to allow rebalancing ETH from wETH deposits from ERC721TokenVault
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant