Skip to content

Commit

Permalink
Merge pull request #202 from overlay-market/arthurka/bac-70-revert-th…
Browse files Browse the repository at this point in the history
…e-extraction-of-oishares-from-the-block-in-build

revert: moving oiShares declaration out of the block
  • Loading branch information
TomasCImach authored May 23, 2024
2 parents cc33d51 + c638932 commit a8f5b66
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
3 changes: 1 addition & 2 deletions contracts/OverlayV1Market.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ contract OverlayV1Market is IOverlayV1Market, Pausable {
require(collateral >= params.get(Risk.Parameters.MinCollateral), "OVV1:collateral<min");

uint256 oi;
uint256 oiShares;
uint256 debt;
uint256 price;
uint256 tradingFee;
Expand Down Expand Up @@ -245,7 +244,7 @@ contract OverlayV1Market is IOverlayV1Market, Pausable {

// add new position's open interest to the side's aggregate oi value
// and increase number of oi shares issued
oiShares = _addToOiAggregates(oi, capOi, isLong);
uint256 oiShares = _addToOiAggregates(oi, capOi, isLong);

// assemble position info data
// check position is not immediately liquidatable prior to storing
Expand Down
30 changes: 15 additions & 15 deletions scripts/Create.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ contract CreateMarketScript is Script {
// TODO: update values as needed
address constant FEED = 0x0000000000000000000000000000000000000000;
uint256[15] MARKET_PARAMS = [
uint256(122000000000), // k
500000000000000000, // lmbda
2500000000000000, // delta
5000000000000000000, // capPayoff
8e23, // capNotional
5000000000000000000, // capLeverage
2592000, // circuitBreakerWindow
uint256(122000000000), // k
500000000000000000, // lmbda
2500000000000000, // delta
5000000000000000000, // capPayoff
8e23, // capNotional
5000000000000000000, // capLeverage
2592000, // circuitBreakerWindow
66670000000000000000000, // circuitBreakerMintTarget
100000000000000000, // maintenanceMargin
100000000000000000, // maintenanceMarginBurnRate
50000000000000000, // liquidationFeeRate
750000000000000, // tradingFeeRate
1e14, // minCollateral
25000000000000, // priceDriftUpperLimit
250 // averageBlockTime
100000000000000000, // maintenanceMargin
100000000000000000, // maintenanceMarginBurnRate
50000000000000000, // liquidationFeeRate
750000000000000, // tradingFeeRate
1e14, // minCollateral
25000000000000, // priceDriftUpperLimit
250 // averageBlockTime
];

function run() external {
Expand All @@ -43,7 +43,7 @@ contract CreateMarketScript is Script {
vm.startBroadcast(DEPLOYER_PK);

// <!---- START DEPLOYMENT ---->

address market = factory.deployMarket(ArbSepoliaConfig.FEED_FACTORY, FEED, MARKET_PARAMS);

// <!-- END DEPLOYMENT -->
Expand Down
2 changes: 1 addition & 1 deletion scripts/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract DeployScript is Script {
vm.startBroadcast(DEPLOYER_PK);

// <!---- START DEPLOYMENT ---->

// 1. Deploy token contract
OverlayV1Token ovl = new OverlayV1Token();

Expand Down
8 changes: 5 additions & 3 deletions scripts/feeds/chainlink/Create.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
pragma solidity ^0.8.0;

import {Script, console2} from "forge-std/Script.sol";
import {OverlayV1ChainlinkFeedFactory} from "contracts/feeds/chainlink/OverlayV1ChainlinkFeedFactory.sol";
import {OverlayV1ChainlinkFeedFactory} from
"contracts/feeds/chainlink/OverlayV1ChainlinkFeedFactory.sol";
import {ArbSepoliaConfig} from "scripts/config/ArbSepolia.config.sol";
import {ArbMainnetConfig} from "scripts/config/ArbMainnet.config.sol";

Expand All @@ -22,11 +23,12 @@ contract CreateFeed is Script {

vm.startBroadcast(DEPLOYER_PK);

OverlayV1ChainlinkFeedFactory feedFactory = OverlayV1ChainlinkFeedFactory(ArbSepoliaConfig.FEED_FACTORY);
OverlayV1ChainlinkFeedFactory feedFactory =
OverlayV1ChainlinkFeedFactory(ArbSepoliaConfig.FEED_FACTORY);

// <!---- START DEPLOYMENT ---->

address feed = feedFactory.deployFeed(AGGREGATOR, HEARTBEAT);
address feed = feedFactory.deployFeed(AGGREGATOR, HEARTBEAT);

// <!-- END DEPLOYMENT -->

Expand Down
9 changes: 4 additions & 5 deletions scripts/feeds/chainlink/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
pragma solidity ^0.8.0;

import {Script, console2} from "forge-std/Script.sol";
import {OverlayV1ChainlinkFeedFactory} from "contracts/feeds/chainlink/OverlayV1ChainlinkFeedFactory.sol";
import {OverlayV1ChainlinkFeedFactory} from
"contracts/feeds/chainlink/OverlayV1ChainlinkFeedFactory.sol";
import {ArbSepoliaConfig} from "scripts/config/ArbSepolia.config.sol";
import {ArbMainnetConfig} from "scripts/config/ArbMainnet.config.sol";

Expand All @@ -19,11 +20,9 @@ contract DeployFeedFactory is Script {
vm.startBroadcast(DEPLOYER_PK);

// <!---- START DEPLOYMENT ---->

OverlayV1ChainlinkFeedFactory feedFactory = new OverlayV1ChainlinkFeedFactory(
ArbSepoliaConfig.OVL,
ArbSepoliaConfig.MICRO_WINDOW,
ArbSepoliaConfig.MACRO_WINDOW
ArbSepoliaConfig.OVL, ArbSepoliaConfig.MICRO_WINDOW, ArbSepoliaConfig.MACRO_WINDOW
);

// <!-- END DEPLOYMENT -->
Expand Down

0 comments on commit a8f5b66

Please sign in to comment.