Skip to content

Simplify reclaim asset#31

Merged
regynald merged 7 commits intofeat/hardhat-coveragefrom
regynald/hook-806-clean-up-reclaim-covered-call-flow
May 24, 2022
Merged

Simplify reclaim asset#31
regynald merged 7 commits intofeat/hardhat-coveragefrom
regynald/hook-806-clean-up-reclaim-covered-call-flow

Conversation

@regynald
Copy link
Contributor

@regynald regynald commented May 24, 2022

  • Finish call instrument tests

New reclaim asset logic:

  • Can only be used on non expired, unsettled options
  • Can only be called by option writer when the writes it the owner of the option nft
  • If there's a bid placed. The bid amount is sent back to the high bidder
  • Underlying asset is returned to asset (withdrawn from the vault if returnNft is true)

@linear
Copy link

linear bot commented May 24, 2022

HOOK-806 Clean up reclaim covered call flow

Can only reclaim if owner of underlying

@regynald regynald force-pushed the regynald/hook-806-clean-up-reclaim-covered-call-flow branch from 017ed25 to ea00729 Compare May 24, 2022 19:09
@jake-nyquist jake-nyquist mentioned this pull request May 24, 2022
@jake-nyquist jake-nyquist mentioned this pull request May 24, 2022
@regynald regynald marked this pull request as ready for review May 24, 2022 20:57
"mintWithVault-- asset must be in vault"
);
require(
_allowedVaultImplementation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to keep this check

"mintWithVault -- entitlement expiration must match call expiration"
);
require(
_allowedVaultImplementation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need this check

);
uint256 assetId = 0;
if (
address(vault) ==
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we likewise need this

operator: address(this),
vaultAddress: address(vault),
assetId: assetId,
assetId: assetId, /// assume that the asset within the vault has assetId 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the string here

/// @param vaultAddress location where the vault is deployed
/// @param underlyingAddress address of underlying asset
/// @param assetId id of the asset within the vault
function _allowedVaultImplementation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this function

);
}

if (call.expiration <= block.timestamp) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a test that specifically verifies someone can settle if the option is expired (and expired worthless)

IHookVault(call.vaultAddress).withdrawalAsset(call.assetId);
}
IHookVault(call.vaultAddress).clearEntitlementAndDistribute(
call.assetId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't make sense to me.. why would we want to distribute in all cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh whoops I misread. what does this change mean

);
require(
call.expiration > block.timestamp,
"reclaimAsset -- the option must not be expired"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the option must be active?

Copy link
Contributor

@jake-nyquist jake-nyquist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok if rebase

@jake-nyquist
Copy link
Contributor

btw new failed test here?

@jake-nyquist
Copy link
Contributor

  1. Call Instrument Tests
    getters
    "before each" hook for "should get vault address":
    Error: VM Exception while processing transaction: reverted with reason string 'mintWithVault -- call contact must be the entitled operator'

@regynald regynald merged commit 06f3c32 into feat/hardhat-coverage May 24, 2022
@regynald regynald deleted the regynald/hook-806-clean-up-reclaim-covered-call-flow branch May 24, 2022 22:26
jake-nyquist added a commit that referenced this pull request May 26, 2022
* Add boilerplate hardhat implementation

* proto commit

* vault coverage tests (#28)

* vault coverage tests

* 100% vault factory coverage

* empty case

* transfers

* Adding js helpers for singing Entitlement

* chainId for hardhat network

* up to 68% test coverage

* 85% coverage

* checkpoint

* 100% lines coverage in vaults

Co-authored-by: Eliecer Chicott <eliecerchicott@Eliecers-MacBook-Pro-2.local>

* [WIP] Call instrument tests (#29)

* vault coverage tests

* 100% vault factory coverage

* empty case

* transfers

* Adding js helpers for singing Entitlement

* chainId for hardhat network

* up to 68% test coverage

* 85% coverage

* checkpoint

* 100% lines coverage in vaults

* Update gitignore

WIP tests

Working mintwitherc721 tests

Use before each

Most mintWithVault and mintWithEntitledVault tests

mintWithEntitledVault coverage

bid coverage

settle coverage

First reclaim test

* move tests into a single file

* add write with signature test (failing)

Co-authored-by: Jacob R. Nyquist <jake@nyqu.ist>
Co-authored-by: Eliecer Chicott <eliecerchicott@Eliecers-MacBook-Pro-2.local>

* tweak BeaconSalts to be an internal library, rename state variables

* Simplify reclaim asset (#31)

* Simplify reclaim asset logic

* Remaining reclaim tests

* call instrument config coverage

* getter coverage

* settle option and return nft coverage

* Fix rebase issue

* Fix test error

* protocol coverage (#32)

* spellcheck (#33)

* protocol coverage

* spellcheck

* Add more option events (#34)

* Add option settled event

* Remove console log tests

* Add callsettled and callreclaimed events; burnexpiredotion function

* burned expired option and coverage

* Fix issue with _allowedVaultImplementation

* Add solo vault test

* mintWithErc721 while multivault exists coverage

* burned expired option can't work on options with bids

* covered call reclaim forge tests working again

* all forge test working

* Fix slither gh action (#36)

* Update coverage.yml

* Update slither.yml

* Fix slither tag

* gas savings, entitlement simplification; (#37)

* Do not use structs on impose entitlement (#38)

* change impose to skip structs

* increase gas savings

* address pr comments

* fix build bug

* no warnings

* extra hardhat file cleanup

* expand gas limit

Co-authored-by: Eliecer Chicott <eliecerchicott@Eliecers-MacBook-Pro-2.local>
Co-authored-by: Regynald Augustin <github@regynald.com>
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.

2 participants