-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
410 additions
and
405 deletions.
There are no files selected for viewing
527 changes: 207 additions & 320 deletions
527
broadcast/SetupPostEnvironment.s.sol/421614/run-latest.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.7.6; | ||
pragma abicoder v2; | ||
|
||
import '@script/Registry.s.sol'; | ||
import {Script} from 'forge-std/Script.sol'; | ||
import {Test} from 'forge-std/Test.sol'; | ||
import {Data} from '@contracts/for-test/Data.sol'; | ||
|
||
// BROADCAST | ||
// source .env && forge script DeployDataLog --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY | ||
|
||
// SIMULATE | ||
// source .env && forge script DeployDataLog --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC | ||
|
||
contract DeployDataLog is Script, Test { | ||
function run() public { | ||
vm.startBroadcast(vm.envUint('ARB_SEPOLIA_PK')); | ||
Data data = new Data(); | ||
emit log_named_address('Data:', address(data)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.7.6; | ||
|
||
import '@script/Registry.s.sol'; | ||
import {Script} from 'forge-std/Script.sol'; | ||
import {CamelotRelayerFactory} from '@contracts/factories/CamelotRelayerFactory.sol'; | ||
import {ChainlinkRelayerFactory} from '@contracts/factories/ChainlinkRelayerFactory.sol'; | ||
import {DenominatedOracleFactory} from '@contracts/factories/DenominatedOracleFactory.sol'; | ||
import {IAuthorizable} from '@interfaces/utils/IAuthorizable.sol'; | ||
import {Data} from '@contracts/for-test/Data.sol'; | ||
|
||
// BROADCAST | ||
// source .env && forge script MockDeployFactories --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY | ||
|
||
// SIMULATE | ||
// source .env && forge script MockDeployFactories --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC | ||
|
||
contract MockDeployFactories is Script { | ||
Data public data = Data(RELAYER_DATA); | ||
|
||
ChainlinkRelayerFactory public chainlinkRelayerFactory; | ||
CamelotRelayerFactory public camelotRelayerFactory; | ||
DenominatedOracleFactory public denominatedOracleFactory; | ||
|
||
/** | ||
* @dev CamelotRelayerFactory must be deployed by deployer of protocol | ||
*/ | ||
function run() public { | ||
vm.startBroadcast(vm.envUint('ARB_SEPOLIA_DEPLOYER_PK')); | ||
chainlinkRelayerFactory = new ChainlinkRelayerFactory(); | ||
camelotRelayerFactory = new CamelotRelayerFactory(); | ||
denominatedOracleFactory = new DenominatedOracleFactory(); | ||
|
||
IAuthorizable(address(chainlinkRelayerFactory)).addAuthorization(vm.envAddress('ARB_SEPOLIA_PC')); | ||
IAuthorizable(address(camelotRelayerFactory)).addAuthorization(vm.envAddress('ARB_SEPOLIA_PC')); | ||
IAuthorizable(address(denominatedOracleFactory)).addAuthorization(vm.envAddress('ARB_SEPOLIA_PC')); | ||
|
||
data.modifyFactory(bytes32('chainlinkRelayerFactory'), address(chainlinkRelayerFactory)); | ||
data.modifyFactory(bytes32('camelotRelayerFactory'), address(camelotRelayerFactory)); | ||
data.modifyFactory(bytes32('denominatedOracleFactory'), address(denominatedOracleFactory)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.7.6; | ||
pragma abicoder v2; | ||
|
||
import '@script/Registry.s.sol'; | ||
import {Script} from 'forge-std/Script.sol'; | ||
import {Test} from 'forge-std/Test.sol'; | ||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol'; | ||
import {IAlgebraPool} from '@algebra-core/interfaces/IAlgebraPool.sol'; | ||
import {IChainlinkRelayer} from '@interfaces/oracles/IChainlinkRelayer.sol'; | ||
import {ICamelotRelayer} from '@interfaces/oracles/ICamelotRelayer.sol'; | ||
import {IDenominatedOracle} from '@interfaces/oracles/IDenominatedOracle.sol'; | ||
import {IBaseOracle} from '@interfaces/oracles/IBaseOracle.sol'; | ||
import {Data} from '@contracts/for-test/Data.sol'; | ||
import {DataStorageLibrary} from '@algebra-periphery/libraries/DataStorageLibrary.sol'; | ||
|
||
// BROADCAST | ||
// source .env && forge script Read --skip-simulation --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY | ||
|
||
// SIMULATE | ||
// source .env && forge script Read --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC | ||
|
||
contract Read is Script, Test { | ||
Data public data = Data(RELAYER_DATA); | ||
|
||
// Tokens | ||
address public tokenA = data.tokenA(); | ||
address public tokenB = data.tokenB(); | ||
|
||
// Pool | ||
IAlgebraPool public pool = data.pool(); | ||
uint256 public initPrice = ((INIT_WETH_AMOUNT * WAD) / INIT_OD_AMOUNT); | ||
|
||
// Relayers | ||
IBaseOracle public chainlinkRelayer = IBaseOracle(address(data.chainlinkRelayer())); | ||
IBaseOracle public camelotRelayer = IBaseOracle(address(data.camelotRelayer())); | ||
IBaseOracle public denominatedOracle = IBaseOracle(address(data.denominatedOracle())); | ||
|
||
function run() public { | ||
vm.startBroadcast(vm.envUint('ARB_SEPOLIA_PK')); | ||
readPrice(); | ||
readPriceInverse(); | ||
} | ||
|
||
function readPrice() public { | ||
int24 _arithmeticMeanTick = DataStorageLibrary.consult(address(data.pool()), uint32(ORACLE_INTERVAL_TEST)); | ||
uint256 _quoteAmount = DataStorageLibrary.getQuoteAtTick({ | ||
tick: _arithmeticMeanTick, | ||
baseAmount: 1e18, | ||
baseToken: data.tokenA(), | ||
quoteToken: data.tokenB() | ||
}); | ||
emit log_named_uint('Quote Base A:', _quoteAmount); | ||
} | ||
|
||
function readPriceInverse() public { | ||
int24 _arithmeticMeanTick = DataStorageLibrary.consult(address(data.pool()), uint32(ORACLE_INTERVAL_TEST)); | ||
uint256 _quoteAmount = DataStorageLibrary.getQuoteAtTick({ | ||
tick: _arithmeticMeanTick, | ||
baseAmount: 1e18, | ||
baseToken: data.tokenB(), | ||
quoteToken: data.tokenA() | ||
}); | ||
emit log_named_uint('Quote Base B:', _quoteAmount); | ||
} | ||
} | ||
|
||
/** | ||
* == Logs == | ||
* Quote Base A:: 2230 | ||
* Quote Base B:: 448402863189474895173495757900703 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.