Skip to content

Commit

Permalink
Make the contract feel more general for no reason.
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Mar 19, 2021
1 parent 954cd90 commit a3f7a5f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lot-ethereum/seller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,14 @@ contract OrchidSeller {
uint256 packed_;
}

mapping(address => Account) private accounts_;
mapping(IERC20 => mapping(address => Account)) private accounts_;

function read(IERC20 token, address signer) public view returns (uint256) {
return accounts_[token][signer].packed_;
}

function read(address signer) external view returns (uint256) {
return accounts_[signer].packed_;
return read(IERC20(0), signer);
}


Expand All @@ -113,7 +117,7 @@ contract OrchidSeller {
digest, nonce, token, amount, adjust, warn, retrieve, refill));
require(signer == ecrecover(digest, v, r, s));
} {
Account storage account = accounts_[signer];
Account storage account = accounts_[token][signer];
uint256 cache = account.packed_;
require(uint192(refill) == refill);
require(uint64(cache) == nonce);
Expand All @@ -138,7 +142,7 @@ contract OrchidSeller {
{
(uint256 balance,) = lottery_.read(token, address(this), signer);
balance = (balance >> 128) + uint128(balance);
if (balance > accounts_[signer].packed_ >> 64)
if (balance > accounts_[token][signer].packed_ >> 64)
return false;
}

Expand Down

0 comments on commit a3f7a5f

Please sign in to comment.