-
Notifications
You must be signed in to change notification settings - Fork 31
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
3 changed files
with
176 additions
and
3 deletions.
There are no files selected for viewing
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,82 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.19; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {console} from "forge-std/console.sol"; | ||
|
||
import {EAS} from "@eas/contracts/EAS.sol"; | ||
|
||
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; | ||
|
||
import { | ||
ITransparentUpgradeableProxy, | ||
TransparentUpgradeableProxy | ||
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
|
||
import {EmptyContract} from "../src/misc/EmptyContract.sol"; | ||
import {Profile} from "../src/profile/Profile.sol"; | ||
import {ProfileRegistry} from "../src/profile/ProfileRegistry.sol"; | ||
import {ScrollBadgeResolver} from "../src/resolver/ScrollBadgeResolver.sol"; | ||
|
||
contract DeployTestContracts is Script { | ||
uint256 DEPLOYER_PRIVATE_KEY = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
|
||
address SIGNER_ADDRESS = vm.envAddress("SIGNER_ADDRESS"); | ||
address TREASURY_ADDRESS = vm.envAddress("TREASURY_ADDRESS"); | ||
|
||
address EAS_ADDRESS = vm.envAddress("EAS_ADDRESS"); | ||
|
||
function run() external { | ||
vm.startBroadcast(DEPLOYER_PRIVATE_KEY); | ||
|
||
// deploy proxy admin | ||
ProxyAdmin proxyAdmin = new ProxyAdmin(); | ||
|
||
// deploy profile registry placeholder | ||
address placeholder = address(new EmptyContract()); | ||
address profileRegistryProxy = address(new TransparentUpgradeableProxy(placeholder, address(proxyAdmin), "")); | ||
|
||
// deploy Scroll badge resolver | ||
address resolverImpl = address(new ScrollBadgeResolver(EAS_ADDRESS, profileRegistryProxy)); | ||
address resolverProxy = address(new TransparentUpgradeableProxy(resolverImpl, address(proxyAdmin), "")); | ||
ScrollBadgeResolver resolver = ScrollBadgeResolver(payable(resolverProxy)); | ||
resolver.initialize(); | ||
|
||
bytes32 schema = resolver.schema(); | ||
|
||
// deploy profile implementation and upgrade registry | ||
Profile profileImpl = new Profile(address(resolver)); | ||
ProfileRegistry profileRegistryImpl = new ProfileRegistry(); | ||
proxyAdmin.upgrade(ITransparentUpgradeableProxy(profileRegistryProxy), address(profileRegistryImpl)); | ||
ProfileRegistry(profileRegistryProxy).initialize(TREASURY_ADDRESS, SIGNER_ADDRESS, address(profileImpl)); | ||
|
||
// misc | ||
bytes32[] memory blacklist = new bytes32[](1); | ||
blacklist[0] = keccak256(bytes("vpn")); | ||
ProfileRegistry(profileRegistryProxy).blacklistUsername(blacklist); | ||
|
||
ProfileRegistry(profileRegistryProxy).updateSigner(0x70997970C51812dc3A010C7d01b50e0d17dc79C8); | ||
|
||
// log addresses | ||
logAddress("DEPLOYER_ADDRESS", vm.addr(DEPLOYER_PRIVATE_KEY)); | ||
logAddress("SIGNER_ADDRESS", SIGNER_ADDRESS); | ||
logAddress("TREASURY_ADDRESS", TREASURY_ADDRESS); | ||
logAddress("EAS_ADDRESS", EAS_ADDRESS); | ||
logAddress("SCROLL_PROFILE_REGISTRY_PROXY_ADMIN_ADDRESS", address(proxyAdmin)); | ||
logAddress("SCROLL_PROFILE_REGISTRY_PROXY_CONTRACT_ADDRESS", address(profileRegistryProxy)); | ||
logAddress("SCROLL_BADGE_RESOLVER_CONTRACT_ADDRESS", address(resolver)); | ||
logBytes32("SCROLL_BADGE_SCHEMA_UID", schema); | ||
logAddress("SCROLL_PROFILE_IMPLEMENTATION_CONTRACT_ADDRESS", address(profileImpl)); | ||
logAddress("SCROLL_PROFILE_REGISTRY_IMPLEMENTATION_CONTRACT_ADDRESS", address(profileRegistryImpl)); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
function logAddress(string memory name, address addr) internal view { | ||
console.log(string(abi.encodePacked(name, "=", vm.toString(address(addr))))); | ||
} | ||
|
||
function logBytes32(string memory name, bytes32 data) internal view { | ||
console.log(string(abi.encodePacked(name, "=", vm.toString(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,92 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.19; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {console} from "forge-std/console.sol"; | ||
|
||
import {Attestation} from "@eas/contracts/IEAS.sol"; | ||
|
||
import {ScrollBadge} from "../src/badge/ScrollBadge.sol"; | ||
import {ScrollBadgeTokenOwner} from "../src/badge/examples/ScrollBadgeTokenOwner.sol"; | ||
import {ScrollBadgeSelfAttest} from "../src/badge/extensions/ScrollBadgeSelfAttest.sol"; | ||
import {ScrollBadgeSingleton} from "../src/badge/extensions/ScrollBadgeSingleton.sol"; | ||
import {ScrollBadgeResolver} from "../src/resolver/ScrollBadgeResolver.sol"; | ||
|
||
contract CanvasTestBadge is ScrollBadgeSelfAttest, ScrollBadgeSingleton { | ||
string public sharedTokenURI; | ||
|
||
constructor(address resolver_, string memory tokenUri_) ScrollBadge(resolver_) { | ||
sharedTokenURI = tokenUri_; | ||
} | ||
|
||
function onIssueBadge(Attestation calldata attestation) | ||
internal | ||
virtual | ||
override (ScrollBadgeSelfAttest, ScrollBadgeSingleton) | ||
returns (bool) | ||
{ | ||
return super.onIssueBadge(attestation); | ||
} | ||
|
||
function onRevokeBadge(Attestation calldata attestation) | ||
internal | ||
virtual | ||
override (ScrollBadgeSelfAttest, ScrollBadgeSingleton) | ||
returns (bool) | ||
{ | ||
return super.onRevokeBadge(attestation); | ||
} | ||
|
||
function badgeTokenURI(bytes32 /*uid*/ ) public view override returns (string memory) { | ||
return sharedTokenURI; | ||
} | ||
} | ||
|
||
contract DeployTestContracts is Script { | ||
uint256 DEPLOYER_PRIVATE_KEY = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
|
||
address RESOLVER_ADDRESS = vm.envAddress("SCROLL_BADGE_RESOLVER_CONTRACT_ADDRESS"); | ||
|
||
function run() external { | ||
vm.startBroadcast(DEPLOYER_PRIVATE_KEY); | ||
|
||
ScrollBadgeResolver resolver = ScrollBadgeResolver(payable(RESOLVER_ADDRESS)); | ||
|
||
// deploy test badges | ||
CanvasTestBadge badge1 = new CanvasTestBadge( | ||
address(resolver), "ipfs://bafybeibc5sgo2plmjkq2tzmhrn54bk3crhnc23zd2msg4ea7a4pxrkgfna/1" | ||
); | ||
|
||
CanvasTestBadge badge2 = new CanvasTestBadge( | ||
address(resolver), "ipfs://bafybeibc5sgo2plmjkq2tzmhrn54bk3crhnc23zd2msg4ea7a4pxrkgfna/2" | ||
); | ||
|
||
CanvasTestBadge badge3 = new CanvasTestBadge( | ||
address(resolver), "ipfs://bafybeibc5sgo2plmjkq2tzmhrn54bk3crhnc23zd2msg4ea7a4pxrkgfna/3" | ||
); | ||
|
||
address[] memory tokens = new address[](1); | ||
tokens[0] = 0xDd7d857F570B0C211abfe05cd914A85BefEC2464; | ||
|
||
ScrollBadgeTokenOwner badge4 = new ScrollBadgeTokenOwner(address(resolver), tokens); | ||
|
||
// set permissions | ||
resolver.toggleBadge(address(badge1), true); | ||
resolver.toggleBadge(address(badge2), true); | ||
resolver.toggleBadge(address(badge3), true); | ||
resolver.toggleBadge(address(badge4), true); | ||
|
||
// log addresses | ||
logAddress("DEPLOYER_ADDRESS", vm.addr(DEPLOYER_PRIVATE_KEY)); | ||
logAddress("SIMPLE_BADGE_A_CONTRACT_ADDRESS", address(badge1)); | ||
logAddress("SIMPLE_BADGE_B_CONTRACT_ADDRESS", address(badge2)); | ||
logAddress("SIMPLE_BADGE_C_CONTRACT_ADDRESS", address(badge3)); | ||
logAddress("ORIGINS_BADGE_ADDRESS", address(badge4)); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
function logAddress(string memory name, address addr) internal view { | ||
console.log(string(abi.encodePacked(name, "=", vm.toString(address(addr))))); | ||
} | ||
} |
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