Skip to content

Commit

Permalink
hotfix: deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSilva committed May 21, 2024
1 parent 4922fd3 commit f9b52d4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/contracts/contracts/token/Sale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ contract Sale is ISale, RisingTide, ERC165, AccessControl, ReentrancyGuard {
bool isValidLeaf = MerkleProof.verify(_merkleProof, merkleRoot, leaf);
if (!isValidLeaf) revert InvalidLeaf();

require(_amount >= 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
2 changes: 1 addition & 1 deletion packages/contracts/script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract DeployScript is Script {
endRegistration
);

sale.setMinContribution(500 * 1e6);
sale.setMinContribution(100 * 1e6);

vm.stopBroadcast();
}
Expand Down
11 changes: 7 additions & 4 deletions packages/contracts/test/contracts/token/Sale.d.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ contract SaleTest is Test {

function test_BuyRevertsAfterReachingMaxTarget() public {
vm.startPrank(owner);
sale.setMinContribution(1 ether);
sale.setMaxTarget(1 ether);
sale.setMinContribution(1 * 1e6);
sale.setMaxTarget(1 * 1e6);

vm.startPrank(alice);
sale.buy(1 ether, aliceMerkleProof);
sale.buy(5 ether, aliceMerkleProof);

vm.expectRevert(Sale.MaxContributorsReached.selector);
sale.buy(1 ether, aliceMerkleProof);
sale.buy(5 ether, aliceMerkleProof);
}

function test_WithdrawRevertsIfNotOwner() public {
Expand Down Expand Up @@ -250,6 +250,9 @@ contract SaleTest is Test {
}

function test_WithdrawDoesNotWithdrawRefunds() public {
vm.startPrank(owner);
sale.setMinContribution(0.1 * 1e6);

vm.startPrank(alice);
sale.buy(sale.paymentTokenToToken(0.1 * 1e6), aliceMerkleProof);
vm.stopPrank();
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 @@ -12,7 +12,7 @@ export default defineConfig({
Sale: {
1: "0x85b34Aa54fdf8242e4656eA50b711F45340925bC",
31337: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
11155111: "0x17757D223e6eEd4f6DeFB9FE5543D327C456264F",
11155111: "0x132d291401f03c743520c8e4429194a885ff1192",
},
},
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app/app/_lib/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export const useCtzndMinContributionUsdc = () => {
const { data: min } = useReadCtzndSaleMinContribution();

const { data: minUsdc } = useReadCtzndSaleTokenToPaymentToken({
args: [parseEther(formatUnits(min || 0n, 6)) || 0n],
args: [min || 0n],
});

const usdcValue = min && minUsdc ? formatUnits(minUsdc, 6) : '0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,21 @@ const AllowFunds = ({ amountInWei }: TAllowFundsProps) => {

type TContributeProps = {
tokensToBuyInWei: bigint;
tokensToBuyInSzabo: bigint;
contributionTxHash?: `0x${string}`;
buyCtzndTokens: (tokensToBuyInWei: bigint) => void;
error: any;
};

const Contribute = ({
tokensToBuyInSzabo,
tokensToBuyInWei,
contributionTxHash,
buyCtzndTokens,
error,
}: TContributeProps) => {
useEffectSafe(() => {
if (!tokensToBuyInSzabo || contributionTxHash) return;
if (!tokensToBuyInWei || contributionTxHash) return;

buyCtzndTokens(tokensToBuyInSzabo);
buyCtzndTokens(tokensToBuyInWei);
}, []);

if (contributionTxHash) {
Expand Down

0 comments on commit f9b52d4

Please sign in to comment.