Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5255856727 | |||
| 20b81db5e7 | |||
| 0477e3be1a | |||
| 06cc9fa717 |
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -4,3 +4,9 @@
|
||||
[submodule "lib/openzeppelin-contracts"]
|
||||
path = lib/openzeppelin-contracts
|
||||
url = https://github.com/OpenZeppelin/openzeppelin-contracts
|
||||
[submodule "lib\\openzeppelin-foundry-upgrades"]
|
||||
path = lib\\openzeppelin-foundry-upgrades
|
||||
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades
|
||||
[submodule "lib\\openzeppelin-contracts-upgradeable"]
|
||||
path = lib\\openzeppelin-contracts-upgradeable
|
||||
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
|
||||
|
||||
@ -2,5 +2,9 @@
|
||||
src = "src"
|
||||
out = "out"
|
||||
libs = ["lib"]
|
||||
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
|
||||
|
||||
1
lib/openzeppelin-contracts-upgradeable
Submodule
1
lib/openzeppelin-contracts-upgradeable
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit fa525310e45f91eb20a6d3baa2644be8e0adba31
|
||||
1
lib/openzeppelin-foundry-upgrades
Submodule
1
lib/openzeppelin-foundry-upgrades
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 16e0ae21e0e39049f619f2396fa28c57fad07368
|
||||
@ -1 +1,2 @@
|
||||
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
|
||||
@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/
|
||||
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
|
||||
@ -3,15 +3,26 @@ pragma solidity ^0.8.13;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {RaidGeld} from "../src/RaidGeld.sol";
|
||||
import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
|
||||
|
||||
contract RaidGeldScript is Script {
|
||||
RaidGeld public raidgeld;
|
||||
|
||||
function setUp() public {}
|
||||
|
||||
function run() public {
|
||||
vm.startBroadcast();
|
||||
raidgeld = new RaidGeld();
|
||||
|
||||
// Deploy the upgradeable contract
|
||||
address _proxyAddress = Upgrades.deployTransparentProxy(
|
||||
"RaidGeld.sol",
|
||||
msg.sender,
|
||||
abi.encodeCall(RaidGeld.initialize, ())
|
||||
);
|
||||
|
||||
// Get the implementation address
|
||||
address implementationAddress = Upgrades.getImplementationAddress(
|
||||
_proxyAddress
|
||||
);
|
||||
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
|
||||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
||||
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
||||
import {RaidGeldUtils} from "../src/RaidGeldUtils.sol";
|
||||
import {Army, Player, Raider} from "../src/RaidGeldStructs.sol";
|
||||
|
||||
contract RaidGeld is ERC20, Ownable {
|
||||
contract RaidGeld is Initializable, ERC20Upgradeable, OwnableUpgradeable {
|
||||
uint256 public constant MANTISSA = 1e4;
|
||||
|
||||
uint256 public constant BUY_IN_AMOUNT = 0.00005 ether;
|
||||
@ -21,7 +22,10 @@ contract RaidGeld is ERC20, Ownable {
|
||||
_;
|
||||
}
|
||||
|
||||
constructor() ERC20("Raid Geld", "GELD") Ownable(msg.sender) {}
|
||||
function initialize() public initializer {
|
||||
__ERC20_init("Raid Geld", "GELD");
|
||||
__Ownable_init(msg.sender);
|
||||
}
|
||||
|
||||
// This effectively registers the user
|
||||
function register() external payable {
|
||||
|
||||
@ -2,11 +2,14 @@
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import {Test, console} from "forge-std/Test.sol";
|
||||
import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
|
||||
import {RaidGeld, Army, Player} from "../src/RaidGeld.sol";
|
||||
import "../src/RaidGeldUtils.sol";
|
||||
|
||||
contract raid_geldTest is Test {
|
||||
RaidGeld public raid_geld;
|
||||
address implementationAddress;
|
||||
address payable proxyAddress;
|
||||
address public player1;
|
||||
address public player2;
|
||||
address public owner;
|
||||
@ -17,7 +20,16 @@ contract raid_geldTest is Test {
|
||||
vm.deal(owner, 10 ether);
|
||||
vm.deal(player1, 10 ether);
|
||||
vm.prank(owner);
|
||||
raid_geld = new RaidGeld();
|
||||
|
||||
// Deploy the upgradeable contract
|
||||
address _proxyAddress = Upgrades.deployTransparentProxy(
|
||||
"RaidGeld.sol",
|
||||
msg.sender,
|
||||
abi.encodeCall(RaidGeld.initialize, ())
|
||||
);
|
||||
|
||||
proxyAddress = payable(_proxyAddress);
|
||||
raid_geld = RaidGeld(proxyAddress);
|
||||
}
|
||||
|
||||
function registerPlayer() private {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user