mirror of
https://github.com/placeholder-soft/gifted-contracts-v2.git
synced 2026-01-12 15:23:44 +08:00
feat: deploy dev/staging for withdraw all (#6)
* feat: add transfer erc20 * feat: add transfer native ether * chore: add region comment in test file * chore: refactor to move effect to internal call * feat: implement batch transfer with sponsors * feat: deploy gifted box and account * feat: deploy to dev * feat: update staging
This commit is contained in:
303
broadcast/upgrade.gifted-box.s.sol/11155111/run-1730042219.json
Normal file
303
broadcast/upgrade.gifted-box.s.sol/11155111/run-1730042219.json
Normal file
File diff suppressed because one or more lines are too long
303
broadcast/upgrade.gifted-box.s.sol/11155111/run-1730042398.json
Normal file
303
broadcast/upgrade.gifted-box.s.sol/11155111/run-1730042398.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
315
broadcast/upgrade.gifted-box.s.sol/421614/run-1730042150.json
Normal file
315
broadcast/upgrade.gifted-box.s.sol/421614/run-1730042150.json
Normal file
File diff suppressed because one or more lines are too long
315
broadcast/upgrade.gifted-box.s.sol/421614/run-1730042337.json
Normal file
315
broadcast/upgrade.gifted-box.s.sol/421614/run-1730042337.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
339
broadcast/upgrade.gifted-box.s.sol/84532/run-1730042176.json
Normal file
339
broadcast/upgrade.gifted-box.s.sol/84532/run-1730042176.json
Normal file
File diff suppressed because one or more lines are too long
339
broadcast/upgrade.gifted-box.s.sol/84532/run-1730042362.json
Normal file
339
broadcast/upgrade.gifted-box.s.sol/84532/run-1730042362.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -10,10 +10,11 @@
|
||||
"Vault": "0x91E5503C2924F0536353343f455628A18CceDC16",
|
||||
"GasSponsorBook": "0x5C9d46832e29b1ec5972f144773Ef13afc93eA76",
|
||||
"NFTVault": "0xD320547261f6a98a33469c02691f295fb39fc265",
|
||||
"GiftedBoxImplementation": "0xfe4BCdbDC3fd3Db643c4acB2b9d4A4d34354f623",
|
||||
"GiftedBoxImplementation": "0xdE81f9a4686fD5A4694f0b848BAD67171090CD90",
|
||||
"TOKEN_USDT": "0x36F207bE794864DF54a6D517D849822E1f0638F6",
|
||||
"TOKEN_USDC": "0xca772bcdfA5F665a7dF4dDDbEa8d85688f92C98F",
|
||||
"TOKEN_WBTC": "0xaBC8E311b3C2140bE9556281cbC91E024a4eE82C"
|
||||
"TOKEN_WBTC": "0xaBC8E311b3C2140bE9556281cbC91E024a4eE82C",
|
||||
"GiftedAccountImplementation": "0xa9a249Cd132063635126b0f439f9b1806C65561f"
|
||||
},
|
||||
"98864": {
|
||||
"UnifiedStore": "0xbAE2A0d6a65E9EA0dDB4b00ebE4c89a0e1FE02F0",
|
||||
@@ -41,10 +42,11 @@
|
||||
"Vault": "0xF9aE127989ec2C8d683a0605a6dEc973f4B57d9b",
|
||||
"GasSponsorBook": "0x75260D56366fBa5933CB56efd5F671331fF9B6C5",
|
||||
"NFTVault": "0x1170472b0179aAfF645E75d65b23eB6911dD362F",
|
||||
"GiftedBoxImplementation": "0x745bFe96790e254C2ec170F6d0843Ffcd219a86a",
|
||||
"GiftedBoxImplementation": "0x673CCA6A6543dCC596b2567fAB5DA75489aa074E",
|
||||
"TOKEN_USDT": "0xccfF7b06B528A469808EE592dd345ADe04b873BA",
|
||||
"TOKEN_USDC": "0xDc486948f546368deeDA3E6D4f9A15198aa3e2Af",
|
||||
"TOKEN_WBTC": "0x73EEEFC220C91CdDf1450f245441acdd1b1ad13A"
|
||||
"TOKEN_WBTC": "0x73EEEFC220C91CdDf1450f245441acdd1b1ad13A",
|
||||
"GiftedAccountImplementation": "0x11B9F271b05D0F41807EA803E2f9E2FDF67FA198"
|
||||
},
|
||||
"11155111": {
|
||||
"UnifiedStore": "0xA436364dAFb5388f4756Cd334E41948a3F8BfF1d",
|
||||
@@ -57,10 +59,11 @@
|
||||
"Vault": "0xA00D0F5074e7565D5a71893396e19D19aa1f4629",
|
||||
"GasSponsorBook": "0x11d0E669D24F682F7690fDf5407B20287050a74A",
|
||||
"NFTVault": "0x41878675E191A82190baeB5483744189Ca7a7cF9",
|
||||
"GiftedBoxImplementation": "0xc8F3248048ebCbf0a90F439eFB1cBcDc9ea9F297",
|
||||
"GiftedBoxImplementation": "0xDA7B0B43b9Aa113597807b64D831dB27F27c68C7",
|
||||
"TOKEN_USDT": "0x353d0E3aa8DC709934Ca0E023181a53404e9c317",
|
||||
"TOKEN_USDC": "0x52dF2bf0E618474037fEB0e80794543833245f95",
|
||||
"TOKEN_WBTC": "0xbF064eD5c19faC019c405a39C19dBa2f5677Cde0"
|
||||
"TOKEN_WBTC": "0xbF064eD5c19faC019c405a39C19dBa2f5677Cde0",
|
||||
"GiftedAccountImplementation": "0xBC427f80049D6acB9ccb2B6adEF5dB65CE7388CC"
|
||||
},
|
||||
"999999999": {
|
||||
"UnifiedStore": "0xE781924639Fc91CA1a27076947a49dE447Dd95AF",
|
||||
@@ -76,6 +79,7 @@
|
||||
"GiftedBoxImplementation": "0x0000000000000000000000000000000000000000",
|
||||
"TOKEN_USDT": "0x647173D64468eA070Ab467b5BC593543AE6B03Ae",
|
||||
"TOKEN_USDC": "0xCe833A4879E3C790176D7aEcda84bA28C3bED35E",
|
||||
"TOKEN_WBTC": "0x61EbBc22d4E34f4f4f26f67114a5836854996C9B"
|
||||
"TOKEN_WBTC": "0x61EbBc22d4E34f4f4f26f67114a5836854996C9B",
|
||||
"GiftedAccountImplementation": "0x0000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,11 @@
|
||||
"Vault": "0x95c566AB7A776314424364D1e2476399167b916c",
|
||||
"GasSponsorBook": "0xa80F5B8d1126D7A2eB1cE271483cF70bBb4e6e0A",
|
||||
"NFTVault": "0x642A0D79bc1842290ee0B893811b93c52c3A4A0F",
|
||||
"GiftedBoxImplementation": "0x42575CA286C036A32B378ee80F186dFE4b8f63af",
|
||||
"GiftedBoxImplementation": "0xc519D3Ab9ad277ba4E50dd2DC4e6dBa1AcE8E2c7",
|
||||
"TOKEN_USDT": "0x14a7eAFa20BDb3ce9aCE524F443e9e1460c63a38",
|
||||
"TOKEN_USDC": "0x1E080310B2a0A24C70f31e1AC44e9fa35eDb53AE",
|
||||
"TOKEN_WBTC": "0x1db0411a812bE7b0cF9D5d6ED3813FA5e3c702b9"
|
||||
"TOKEN_WBTC": "0x1db0411a812bE7b0cF9D5d6ED3813FA5e3c702b9",
|
||||
"GiftedAccountImplementation": "0x67DAbb8A61d83EC11C03EeF052436D318Ce700b6"
|
||||
},
|
||||
"98864": {
|
||||
"UnifiedStore": "0xaf98db2167914b158df9043c47c3eD2DE14F4d23",
|
||||
@@ -41,10 +42,11 @@
|
||||
"Vault": "0xEdc199d7a4de25511C44aA85f6E5B794A21c1704",
|
||||
"GasSponsorBook": "0xfaA1e72f8609A86F7cEbbaDa0719FaC617D67e18",
|
||||
"NFTVault": "0x6f1Be99caf26cC55C1d3fa827CBC0c2e098aAaf3",
|
||||
"GiftedBoxImplementation": "0xB5397Cb9bf57dF960176677F558D0F4142f68f82",
|
||||
"GiftedBoxImplementation": "0xE4a98506E104bb04A73baf08c358382B61cA5720",
|
||||
"TOKEN_USDT": "0x2E3a8Cf0022140a40a7474d879942f0e55bC57dE",
|
||||
"TOKEN_USDC": "0x1E3151EF594580773651C826414a8b97CDf6FF10",
|
||||
"TOKEN_WBTC": "0xE51ade97dB1151c6e8a7D465B84B29eB9422b5B8"
|
||||
"TOKEN_WBTC": "0xE51ade97dB1151c6e8a7D465B84B29eB9422b5B8",
|
||||
"GiftedAccountImplementation": "0x52eFBa50615686879A67D54642c794DBcCb5E7c8"
|
||||
},
|
||||
"11155111": {
|
||||
"UnifiedStore": "0x09748F6411a4D1A84a87645A3E406dCb3c31Fc73",
|
||||
@@ -57,10 +59,11 @@
|
||||
"Vault": "0xe6121F29A58f235c1c12837fACE0f9419411F402",
|
||||
"GasSponsorBook": "0x01b793FDf3d21d8C9cD52De3aD5B50c5c95009A3",
|
||||
"NFTVault": "0xF5D35748514832bE99c8DBad60ed7cc7957bDBaB",
|
||||
"GiftedBoxImplementation": "0x0C499711de7FD5E156A0000dD882E4921E8ca1Ca",
|
||||
"GiftedBoxImplementation": "0x5De15C78819A6D76E06BD0A44cE4981D69288569",
|
||||
"TOKEN_USDT": "0x309488D8698C9DdA39Ba4Cce9f163932d1984d8b",
|
||||
"TOKEN_USDC": "0x9e0D7B454676116C123d56ff4d5ed609D75Ad00E",
|
||||
"TOKEN_WBTC": "0x8621186D94319349A870c4099465770f0E4FF3cD"
|
||||
"TOKEN_WBTC": "0x8621186D94319349A870c4099465770f0E4FF3cD",
|
||||
"GiftedAccountImplementation": "0x6E3874D12DBCA1c3758a40B835CF0BEF39D2C400"
|
||||
},
|
||||
"999999999": {
|
||||
"UnifiedStore": "0x10B3fEAF1012E82D8ad0beA45857fc35F72E165e",
|
||||
@@ -76,6 +79,7 @@
|
||||
"GiftedBoxImplementation": "0x0000000000000000000000000000000000000000",
|
||||
"TOKEN_USDT": "0x7b557F0992Eca62cE4B00a96C9400F69cdbBed55",
|
||||
"TOKEN_USDC": "0x8431483c91C856DCe2D8e07aD5B1b587Ad5df44D",
|
||||
"TOKEN_WBTC": "0xF9aE127989ec2C8d683a0605a6dEc973f4B57d9b"
|
||||
"TOKEN_WBTC": "0xF9aE127989ec2C8d683a0605a6dEc973f4B57d9b",
|
||||
"GiftedAccountImplementation": "0x0000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,8 @@ import "@openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
||||
import "../src/UnifiedStore.sol";
|
||||
import "../src/Vault.sol";
|
||||
contract UpgradeGiftedBox is Script {
|
||||
GiftedBox public newImplementation;
|
||||
GiftedBox public newGiftedBox;
|
||||
GiftedAccount public newGiftedAccount;
|
||||
ERC1967Proxy public proxy;
|
||||
UnifiedStore public unifiedStore;
|
||||
|
||||
@@ -16,28 +17,32 @@ contract UpgradeGiftedBox is Script {
|
||||
address deployer = getAddressFromConfig("deployer");
|
||||
vm.startBroadcast(deployer);
|
||||
|
||||
address newImplementationAddress = deploy_new_implementation();
|
||||
upgrade_proxy(newImplementationAddress);
|
||||
set_new_implementation_address(newImplementationAddress);
|
||||
address newGiftedBoxImplementation = deploy_new_gifted_box();
|
||||
upgrade_gifted_box(newGiftedBoxImplementation);
|
||||
set_new_gifted_box_address(newGiftedBoxImplementation);
|
||||
|
||||
address vaultAddress = getAddressFromConfig("Vault");
|
||||
Vault vault = Vault(vaultAddress);
|
||||
address giftedBoxAddress = getAddressFromConfig("GiftedBox");
|
||||
address newGiftedAccountImplementation = deploy_new_gifted_account();
|
||||
set_new_gifted_account_address(newGiftedAccountImplementation);
|
||||
|
||||
vault.grantRole(vault.CONTRACT_ROLE(), giftedBoxAddress);
|
||||
|
||||
GiftedBox giftedBox = GiftedBox(giftedBoxAddress);
|
||||
giftedBox.setVault(vaultAddress);
|
||||
address guardianAddress = getAddressFromConfig("GiftedAccountGuardian");
|
||||
GiftedAccountGuardian guardian = GiftedAccountGuardian(guardianAddress);
|
||||
guardian.setGiftedAccountImplementation(newGiftedAccountImplementation);
|
||||
console.log("GiftedAccountGuardian set new GiftedAccount implementation:", newGiftedAccountImplementation);
|
||||
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function deploy_new_implementation() internal returns (address) {
|
||||
newImplementation = new GiftedBox();
|
||||
return address(newImplementation);
|
||||
function deploy_new_gifted_box() internal returns (address) {
|
||||
newGiftedBox = new GiftedBox();
|
||||
return address(newGiftedBox);
|
||||
}
|
||||
|
||||
function upgrade_proxy(address newImplementationAddress) internal {
|
||||
function deploy_new_gifted_account() internal returns (address) {
|
||||
newGiftedAccount = new GiftedAccount();
|
||||
return address(newGiftedAccount);
|
||||
}
|
||||
|
||||
function upgrade_gifted_box(address newGiftedBoxImplementation) internal {
|
||||
address unifiedStoreAddress = getAddressFromConfig("UnifiedStore");
|
||||
unifiedStore = UnifiedStore(unifiedStoreAddress);
|
||||
|
||||
@@ -45,20 +50,28 @@ contract UpgradeGiftedBox is Script {
|
||||
proxy = ERC1967Proxy(payable(proxyAddress));
|
||||
|
||||
GiftedBox existingImplementation = GiftedBox(address(proxy));
|
||||
if (address(existingImplementation) != newImplementationAddress) {
|
||||
UUPSUpgradeable(address(proxy)).upgradeToAndCall(newImplementationAddress, "");
|
||||
console.log("GiftedBox upgraded to new implementation:", newImplementationAddress);
|
||||
if (address(existingImplementation) != newGiftedBoxImplementation) {
|
||||
UUPSUpgradeable(address(proxy)).upgradeToAndCall(newGiftedBoxImplementation, "");
|
||||
console.log("GiftedBox upgraded to new implementation:", newGiftedBoxImplementation);
|
||||
} else {
|
||||
console.log("GiftedBox is already up to date");
|
||||
}
|
||||
}
|
||||
|
||||
function set_new_implementation_address(address newImplementationAddress) internal {
|
||||
function set_new_gifted_box_address(address newGiftedBoxImplementation) internal {
|
||||
address unifiedStoreAddress = getAddressFromConfig("UnifiedStore");
|
||||
unifiedStore = UnifiedStore(unifiedStoreAddress);
|
||||
|
||||
unifiedStore.setAddress("GiftedBoxImplementation", newImplementationAddress);
|
||||
console.log("New GiftedBox implementation address set in UnifiedStore:", newImplementationAddress);
|
||||
unifiedStore.setAddress("GiftedBoxImplementation", newGiftedBoxImplementation);
|
||||
console.log("New GiftedBox implementation address set in UnifiedStore:", newGiftedBoxImplementation);
|
||||
}
|
||||
|
||||
function set_new_gifted_account_address(address newGiftedAccountImplementation) internal {
|
||||
address unifiedStoreAddress = getAddressFromConfig("UnifiedStore");
|
||||
unifiedStore = UnifiedStore(unifiedStoreAddress);
|
||||
|
||||
unifiedStore.setAddress("GiftedAccountImplementation", newGiftedAccountImplementation);
|
||||
console.log("New GiftedAccount implementation address set in UnifiedStore:", newGiftedAccountImplementation);
|
||||
}
|
||||
|
||||
function getAddressFromConfig(string memory key) internal view returns (address) {
|
||||
|
||||
@@ -15,6 +15,7 @@ const keys = [
|
||||
"GasSponsorBook",
|
||||
"NFTVault",
|
||||
"GiftedBoxImplementation",
|
||||
"GiftedAccountImplementation",
|
||||
"TOKEN_USDT",
|
||||
"TOKEN_USDC",
|
||||
"TOKEN_WBTC",
|
||||
|
||||
Reference in New Issue
Block a user