This commit is contained in:
parent
836e3d8719
commit
87b9ecce67
@ -3,9 +3,17 @@ src = "src"
|
|||||||
out = "out"
|
out = "out"
|
||||||
libs = ["lib"]
|
libs = ["lib"]
|
||||||
|
|
||||||
|
# upgrades
|
||||||
|
ffi = true
|
||||||
|
ast = true
|
||||||
|
build_info = true
|
||||||
|
extra_output = ["storageLayout"]
|
||||||
|
|
||||||
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
|
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
|
||||||
|
|
||||||
remappings = [
|
remappings = [
|
||||||
"@uniswap/v3-core/=lib/v3-core/",
|
"@uniswap/v3-core/=lib/v3-core/",
|
||||||
"@uniswap/v3-periphery=lib/v3-periphery/",
|
"@uniswap/v3-periphery=lib/v3-periphery/",
|
||||||
|
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
|
||||||
|
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
|
||||||
]
|
]
|
||||||
@ -12,7 +12,7 @@ contract RaidGeldScript is Script, Constants {
|
|||||||
|
|
||||||
function run() public {
|
function run() public {
|
||||||
vm.startBroadcast();
|
vm.startBroadcast();
|
||||||
raidgeld = new RaidGeld(DAO_TOKEN, POOL, BAAL, NFT_POSITION_MANAGER);
|
// raidgeld = new RaidGeld(DAO_TOKEN, POOL, BAAL, NFT_POSITION_MANAGER);
|
||||||
vm.stopBroadcast();
|
vm.stopBroadcast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
pragma solidity ^0.8.13;
|
pragma solidity ^0.8.13;
|
||||||
|
|
||||||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
|
||||||
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
||||||
|
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
||||||
import {IBaal} from "lib/Baal/contracts/interfaces/IBaal.sol";
|
import {IBaal} from "lib/Baal/contracts/interfaces/IBaal.sol";
|
||||||
|
|
||||||
import { IUniswapV3Factory } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
|
import { IUniswapV3Factory } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
|
||||||
import { IERC20, TransferHelper } from "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
|
import { TransferHelper } from "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
|
||||||
import { INonfungiblePositionManager } from "./lib/INonfungiblePositionManager.sol";
|
import { INonfungiblePositionManager } from "./lib/INonfungiblePositionManager.sol";
|
||||||
import { CustomMath} from "./lib/CustomMath.sol";
|
import { CustomMath} from "./lib/CustomMath.sol";
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ import {Army, Player, Raider, Boss, LastBossResult} from "../src/RaidGeldStructs
|
|||||||
import { Constants} from "../src/Constants.sol";
|
import { Constants} from "../src/Constants.sol";
|
||||||
|
|
||||||
|
|
||||||
contract RaidGeld is ERC20, Ownable, Constants, IRaidGeld {
|
contract RaidGeld is ERC20Upgradeable, OwnableUpgradeable, Constants, IRaidGeld {
|
||||||
uint256 public constant MANTISSA = 1e4;
|
uint256 public constant MANTISSA = 1e4;
|
||||||
uint256 public constant BUY_IN_AMOUNT = 0.00045 ether;
|
uint256 public constant BUY_IN_AMOUNT = 0.00045 ether;
|
||||||
uint256 public BUY_IN_DAO_TOKEN_AMOUNT;
|
uint256 public BUY_IN_DAO_TOKEN_AMOUNT;
|
||||||
@ -28,15 +29,15 @@ contract RaidGeld is ERC20, Ownable, Constants, IRaidGeld {
|
|||||||
mapping(address => LastBossResult) private lastBossResults;
|
mapping(address => LastBossResult) private lastBossResults;
|
||||||
|
|
||||||
// WETH
|
// WETH
|
||||||
IWETH public immutable weth = IWETH(WETH);
|
IWETH public constant weth = IWETH(WETH);
|
||||||
// RGCVII token
|
// RGCVII token
|
||||||
ERC20 public daoToken;
|
IERC20Metadata public daoToken;
|
||||||
IBaal public baal;
|
IBaal public baal;
|
||||||
address public DAO;
|
address public DAO;
|
||||||
bool poolDeployed = false;
|
bool poolDeployed;
|
||||||
int24 internal maxTick;
|
int24 internal maxTick;
|
||||||
int24 internal minTick;
|
int24 internal minTick;
|
||||||
uint24 internal poolFee = 10000;
|
uint24 internal constant poolFee = 10000;
|
||||||
INonfungiblePositionManager public nonfungiblePositionManager;
|
INonfungiblePositionManager public nonfungiblePositionManager;
|
||||||
// RGCVII pool
|
// RGCVII pool
|
||||||
address public DAOWETHpool;
|
address public DAOWETHpool;
|
||||||
@ -106,8 +107,25 @@ contract RaidGeld is ERC20, Ownable, Constants, IRaidGeld {
|
|||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(address _daoToken, address _pool, address _baal, address _nftPositionManager) ERC20("Raid Geld", "GELD") Ownable(msg.sender) {
|
// constructor(address _daoToken, address _pool, address _baal, address _nftPositionManager) {
|
||||||
daoToken = ERC20(_daoToken);
|
// daoToken = IERC20Metadata(_daoToken);
|
||||||
|
// DAOWETHpool = _pool;
|
||||||
|
// baal = IBaal(_baal);
|
||||||
|
// BUY_IN_DAO_TOKEN_AMOUNT = 400 * 10 ** daoToken.decimals();
|
||||||
|
// nonfungiblePositionManager = INonfungiblePositionManager(_nftPositionManager);
|
||||||
|
|
||||||
|
// IUniswapV3Factory factory = IUniswapV3Factory(nonfungiblePositionManager.factory());
|
||||||
|
// int24 tickSpacing = factory.feeAmountTickSpacing(poolFee);
|
||||||
|
// require(tickSpacing != 0, "InvalidPoolFee");
|
||||||
|
// maxTick = (887272 / tickSpacing) * tickSpacing;
|
||||||
|
// minTick = -maxTick;
|
||||||
|
// }
|
||||||
|
|
||||||
|
function initialize(address _owner, address _daoToken, address _pool, address _baal, address _nftPositionManager) public initializer {
|
||||||
|
__ERC20_init("RaidGeld", "GELD");
|
||||||
|
__Ownable_init(_owner);
|
||||||
|
|
||||||
|
daoToken = IERC20Metadata(_daoToken);
|
||||||
DAOWETHpool = _pool;
|
DAOWETHpool = _pool;
|
||||||
baal = IBaal(_baal);
|
baal = IBaal(_baal);
|
||||||
BUY_IN_DAO_TOKEN_AMOUNT = 400 * 10 ** daoToken.decimals();
|
BUY_IN_DAO_TOKEN_AMOUNT = 400 * 10 ** daoToken.decimals();
|
||||||
@ -466,7 +484,7 @@ interface ISwapRouter02 {
|
|||||||
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
|
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IWETH is IERC20 {
|
interface IWETH is IERC20Metadata {
|
||||||
function deposit() external payable;
|
function deposit() external payable;
|
||||||
function withdraw(uint256 amount) external;
|
function withdraw(uint256 amount) external;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ pragma solidity ^0.8.13;
|
|||||||
|
|
||||||
import {Test, console} from "forge-std/Test.sol";
|
import {Test, console} from "forge-std/Test.sol";
|
||||||
import {stdStorage, StdStorage} from "forge-std/Test.sol";
|
import {stdStorage, StdStorage} from "forge-std/Test.sol";
|
||||||
|
import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
|
||||||
import {RaidGeld, Army, Player, Boss, LastBossResult} from "../src/RaidGeld.sol";
|
import {RaidGeld, Army, Player, Boss, LastBossResult} from "../src/RaidGeld.sol";
|
||||||
import "../src/RaidGeldUtils.sol";
|
import "../src/RaidGeldUtils.sol";
|
||||||
import {Constants} from "../src/Constants.sol";
|
import {Constants} from "../src/Constants.sol";
|
||||||
@ -38,7 +39,22 @@ contract raid_geldTest is Test, Constants {
|
|||||||
vm.deal(owner, 10 ether);
|
vm.deal(owner, 10 ether);
|
||||||
fundAccount(player1);
|
fundAccount(player1);
|
||||||
vm.prank(owner);
|
vm.prank(owner);
|
||||||
raid_geld = new RaidGeld(DAO_TOKEN, POOL, BAAL, NFT_POSITION_MANAGER);
|
// raid_geld = new RaidGeld(DAO_TOKEN, POOL, BAAL, NFT_POSITION_MANAGER);
|
||||||
|
// raid_geld.weth().deposit{value: 5 ether}();
|
||||||
|
|
||||||
|
address proxy = Upgrades.deployUUPSProxy(
|
||||||
|
"RaidGeld.sol:RaidGeld",
|
||||||
|
abi.encodeCall(RaidGeld.initialize, (
|
||||||
|
owner,
|
||||||
|
DAO_TOKEN,
|
||||||
|
POOL,
|
||||||
|
BAAL,
|
||||||
|
NFT_POSITION_MANAGER
|
||||||
|
))
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("Upgrades sysmbol", RaidGeld(payable(proxy)).symbol());
|
||||||
|
raid_geld = RaidGeld(payable(proxy));
|
||||||
raid_geld.weth().deposit{value: 5 ether}();
|
raid_geld.weth().deposit{value: 5 ether}();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ contract raid_geldTest is Test, Constants {
|
|||||||
owner = address(0x126);
|
owner = address(0x126);
|
||||||
vm.deal(owner, 10 ether);
|
vm.deal(owner, 10 ether);
|
||||||
vm.prank(owner);
|
vm.prank(owner);
|
||||||
raid_geld = new RaidGeld(DAO_TOKEN, POOL, BAAL, NFT_POSITION_MANAGER);
|
// raid_geld = new RaidGeld(DAO_TOKEN, POOL, BAAL, NFT_POSITION_MANAGER);
|
||||||
raid_geld.weth().deposit{value: 5 ether}();
|
raid_geld.weth().deposit{value: 5 ether}();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user