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

bring updates back to dc/master #122

Merged
merged 12 commits into from
Aug 18, 2021
152 changes: 121 additions & 31 deletions README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions addmarket.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ module.exports = async () => {
await factory.addArtist(artistAddress)
}

// for now deuplicate the original tokenURIs for the copies
tokenURIs = tokenURIs.concat(tokenURIs);

console.log("CREATING MARKET");
console.log("ipfs hash ", ipfsHash);
console.log("timestamps", timestamps);
Expand Down
14 changes: 7 additions & 7 deletions contracts/RCFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract RCFactory is NativeMetaTransaction, IRCFactory {
/// @dev if true markets default to the paused state
bool public override marketPausedDefaultState;
/// @dev a limit to the number of NFTs to mint per market
uint256 public override nftMintingLimit;
uint256 public override cardLimit;

///// GOVERNANCE VARIABLES- GOVERNORS /////
/// @dev unapproved markets hidden from the interface
Expand Down Expand Up @@ -153,8 +153,8 @@ contract RCFactory is NativeMetaTransaction, IRCFactory {
setPotDistribution(20, 0, 0, 20, 100); // 2% artist, 2% affiliate, 10% card affiliate
setMinimumPriceIncreasePercent(10); // 10%
setNumberOfNFTsToAward(3);
setNFTMintingLimit(40); // safe limit tested and set at 40, can be adjusted later if gas limit changes
setMaxRentIterations(50, 25); // safe limit tested and set at 80, can be adjusted later if gas limit changes
setCardLimit(40); // safe limit tested and set at 40, can be adjusted later if gas limit changes
setMaxRentIterations(50, 25); // safe limit tested and set at 50 & 25, can be adjusted later if gas limit changes
// oracle
setArbitrator(_arbitratorAddress);
setRealitioAddress(_realitioAddress);
Expand Down Expand Up @@ -353,9 +353,9 @@ contract RCFactory is NativeMetaTransaction, IRCFactory {

/// @notice A limit to the number of NFTs to mint per market
/// @dev to avoid gas limits
/// @param _mintLimit the limit to set
function setNFTMintingLimit(uint256 _mintLimit) public override onlyOwner {
nftMintingLimit = _mintLimit;
/// @param _cardLimit the limit to set
function setCardLimit(uint256 _cardLimit) public override onlyOwner {
cardLimit = _cardLimit;
}

/// @notice A limit to the number of rent collections per transaction
Expand Down Expand Up @@ -662,7 +662,7 @@ contract RCFactory is NativeMetaTransaction, IRCFactory {
/// @dev ..the copies are appended to the end of the array
/// @dev ..so half the array length if the number of tokens.
require(
(_tokenURIs.length / 2) <= nftMintingLimit,
(_tokenURIs.length / 2) <= cardLimit,
"Too many tokens to mint"
);

Expand Down
1 change: 0 additions & 1 deletion contracts/RCMarket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ contract RCMarket is Initializable, NativeMetaTransaction, IRCMarket {
/// @dev when the market locks
uint32 public override marketLockingTime;
/// @dev when the question can be answered on realitio
/// @dev only needed for circuit breaker
uint32 public override oracleResolutionTime;

// PAYOUT VARIABLES
Expand Down
1 change: 1 addition & 0 deletions contracts/RCOrderbook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ contract RCOrderbook is NativeMetaTransaction, IRCOrderbook {
_loopCounter + _cardCount < maxDeletions
) {
_market = closedMarkets[userClosedMarketIndex[_user]];
// Just do the whole market at once
_cardCount = market[_market].cardCount;
uint256 i = _cardCount;
do {
Expand Down
8 changes: 5 additions & 3 deletions contracts/RCTreasury.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract RCTreasury is AccessControl, NativeMetaTransaction, IRCTreasury {
uint256 public override totalMarketPots;
/// @dev rent taken and allocated to a particular market
uint256 public override marketBalance;
/// @dev a quick check if a uesr is foreclosed
/// @dev a quick check if a user is foreclosed
mapping(address => bool) public override isForeclosed;
/// @dev to keep track of the size of the rounding issue between rent collections
uint256 public override marketBalanceTopup;
Expand Down Expand Up @@ -68,6 +68,7 @@ contract RCTreasury is AccessControl, NativeMetaTransaction, IRCTreasury {
/// @dev max deposit balance, to minimise funds at risk
uint256 public override maxContractBalance;
/// @dev whitelist to only allow certain addresses to deposit
/// @dev intended for beta use only, will be disabled after launch
mapping(address => bool) public isAllowed;
bool public whitelistEnabled;
/// @dev allow markets to be restricted to a certain role
Expand All @@ -80,7 +81,7 @@ contract RCTreasury is AccessControl, NativeMetaTransaction, IRCTreasury {
bool public override globalPause;
/// @dev if true, cannot rent, claim or upgrade any cards for specific market
mapping(address => bool) public override marketPaused;
/// @dev if true, owner has locked the market pause
/// @dev if true, owner has locked the market pause (Governors are locked out)
mapping(address => bool) public override lockMarketPaused;

/*╔═════════════════════════════════╗
Expand Down Expand Up @@ -189,6 +190,7 @@ contract RCTreasury is AccessControl, NativeMetaTransaction, IRCTreasury {
}

/// @notice set max deposit balance, to minimise funds at risk
/// @dev this is only a soft check, it is possible to exceed this limit
/// @param _newBalanceLimit the max balance to set in wei
function setMaxContractBalance(uint256 _newBalanceLimit)
public
Expand Down Expand Up @@ -358,7 +360,7 @@ contract RCTreasury is AccessControl, NativeMetaTransaction, IRCTreasury {

/// @notice deposit tokens into RealityCards
/// @dev it is passed the user instead of using msg.sender because might be called
/// @dev ... via contract (newRental) or Layer1->Layer2 bot
/// @dev ... via contract or Layer1->Layer2 bot
/// @param _user the user to credit the deposit to
/// @param _amount the amount to deposit, must be approved
function deposit(uint256 _amount, address _user)
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IRCFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ interface IRCFactory {

function timeout() external view returns (uint32);

function nftMintingLimit() external view returns (uint256);
function cardLimit() external view returns (uint256);

function getPotDistribution() external view returns (uint256[5] memory);

Expand Down Expand Up @@ -126,7 +126,7 @@ interface IRCFactory {

function maxRentIterationsToLockMarket() external view returns (uint256);

function setNFTMintingLimit(uint256 _mintLimit) external;
function setCardLimit(uint256 _cardLimit) external;

function setMinimumPriceIncreasePercent(uint256 _percentIncrease) external;

Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/RCFull.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ interface IRCFactory {

function timeout() external view returns (uint32);

function nftMintingLimit() external view returns (uint256);
function cardLimit() external view returns (uint256);

function getPotDistribution() external view returns (uint256[5] memory);

Expand Down Expand Up @@ -121,7 +121,7 @@ interface IRCFactory {

function maxRentIterationsToLockMarket() external view returns (uint256);

function setNFTMintingLimit(uint256 _mintLimit) external;
function setCardLimit(uint256 _cardLimit) external;

function setMinimumPriceIncreasePercent(uint256 _percentIncrease) external;

Expand Down
1 change: 1 addition & 0 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ module.exports = async (deployer, network, accounts) => {
console.log('treasury.address: ', treasury.address);
console.log('factory.address: ', factory.address);
console.log('orderbook.address: ', orderbook.address);
console.log('leaderboard.address: ', leaderboard.address);
} else {
console.log('No deploy script for this network');
}
Expand Down
2 changes: 1 addition & 1 deletion test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract("RealityCardsTests", (accounts) => {
describe("Market tests ", () => {
it.skip("Lock a market with many cards ", async () => {
let cardsToMake = 100;
await factory.setNFTMintingLimit(cardsToMake);
await factory.setCardLimit(cardsToMake);
markets.push(await rc.createMarket({ numberOfCards: cardsToMake }))

await rc.deposit(1000, alice)
Expand Down