Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSilva committed May 22, 2024
1 parent 23afd25 commit 296cce6
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 100 deletions.
5 changes: 4 additions & 1 deletion packages/contracts/contracts/token/Sale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ contract Sale is ISale, RisingTide, ERC165, AccessControl, ReentrancyGuard {
bool isValidLeaf = MerkleProof.verify(_merkleProof, merkleRoot, leaf);
if (!isValidLeaf) revert InvalidLeaf();

require(_amount >= paymentTokenToToken(minContribution), "can't be below minimum");
require(
_amount >= paymentTokenToToken(minContribution),
"can't be below minimum"
);

uint256 paymentAmount = tokenToPaymentToken(_amount);
require(paymentAmount > 0, "can't be zero");
Expand Down
6 changes: 4 additions & 2 deletions packages/contracts/script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ contract DeployScript is Script {
uint256 start = 1716378600;
uint256 end = 1716638400;

// address USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address USDC = 0x697485a9E004Da9bd9b3204dfB24efc288C04c2c;
address USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;

Sale sale = new Sale(
USDC,
Expand All @@ -29,6 +28,9 @@ contract DeployScript is Script {
);

sale.setMinContribution(100 * 1e6);
sale.setMerkleRoot(
0x3473739e14ba98305b06c55d144c1059932d192d12e4a558bde18f25bde0b388
);

vm.stopBroadcast();
}
Expand Down
18 changes: 13 additions & 5 deletions packages/contracts/script/ForkTest.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ contract ForkTestScript is Script {
console.log(sale.maxTarget() / sale.minContribution());
console.log(sale.paymentTokenToToken(sale.minContribution()));

sale.setMerkleRoot(0xb2a5fa3b3e2f98fd1eec385ca41ee5ec339d6e0e10ef2e628b6dd1c05efd5d2f);

merkleProof[0] = 0x4522f57b6fe79305db47fb076fb0074084084e27b1401a6e2b82e4743ebcd22e;
merkleProof[1] = 0x44a01d943b6e8676e88542b2f512dc51dbd5479373b5317864fd63fbcc0bad32;
merkleProof[2] = 0xfc155ecc3cb89777797847582c94ff6c173964a88c99f2bd13551a83ec921266;
sale.setMerkleRoot(
0xb2a5fa3b3e2f98fd1eec385ca41ee5ec339d6e0e10ef2e628b6dd1c05efd5d2f
);

merkleProof[
0
] = 0x4522f57b6fe79305db47fb076fb0074084084e27b1401a6e2b82e4743ebcd22e;
merkleProof[
1
] = 0x44a01d943b6e8676e88542b2f512dc51dbd5479373b5317864fd63fbcc0bad32;
merkleProof[
2
] = 0xfc155ecc3cb89777797847582c94ff6c173964a88c99f2bd13551a83ec921266;

sale.buy(500 ether, merkleProof);

Expand Down
2 changes: 0 additions & 2 deletions packages/contracts/script/generateMerkleTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ async function main(address: string) {
.filter((s: string) => s.length > 0);
}

console.log("Addresses: ", addresses);

const data = addresses.map((addr: string) => {
return {
address: addr,
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/wagmi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig({
namePrefix: "Ctznd",
deployments: {
Sale: {
1: "0x85b34Aa54fdf8242e4656eA50b711F45340925bC",
1: "0x733e41e5a08c6d922eddaef715186d7e97d55c50",
31337: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
11155111: "0x3b11b3bc2ef9a24a1a1fae9d80127f44386e3f7d",
},
Expand Down
2 changes: 2 additions & 0 deletions packages/web-app/app/_server/projects/generate-merkle-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export const generateMerkleRoot = async (): Promise<
projectsInfo.citizend.address,
);

console.log(addresses);

if (typeof addresses === 'object' && 'error' in addresses) {
// forward the error
return addresses;
Expand Down
178 changes: 89 additions & 89 deletions packages/web-app/wagmi.generated.ts

Large diffs are not rendered by default.

0 comments on commit 296cce6

Please sign in to comment.