forked from TrueFiEng/devcon-raffle
-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
3a5c534
commit af6318e
Showing
4 changed files
with
46 additions
and
15 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
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
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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import { AuctionRaffle } from 'build/types' | ||
import { BigNumberish, BytesLike, Signer } from 'ethers' | ||
import { BigNumberish, Contract, Signer, Wallet } from 'ethers' | ||
import { attestScore } from 'utils/attestScore' | ||
|
||
export async function bidAsSigner( | ||
auctionRaffle: AuctionRaffle, | ||
auctionRaffle: Contract, | ||
signer: Signer, | ||
value: BigNumberish, | ||
score: BigNumberish, | ||
proof: BytesLike | ||
attestor: Signer, | ||
scoreAttestationVerifier: Contract | ||
) { | ||
const { signature: proof } = await attestScore( | ||
await signer.getAddress(), | ||
score, | ||
attestor as unknown as Wallet, | ||
scoreAttestationVerifier.address | ||
) | ||
await auctionRaffle.connect(signer).bid(score, proof, { value, gasLimit: 1_000_000 }) | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/contracts/scripts/utils/scoreAttestationVerifier.ts
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,12 @@ | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types' | ||
|
||
export const scoreAttestationVerifierArtifactName = | ||
'contracts/verifier/ScoreAttestationVerifier.sol:ScoreAttestationVerifier' | ||
|
||
export async function connectToScoreAttestationVerifier( | ||
hre: HardhatRuntimeEnvironment, | ||
scoreAttestationVerifierAddress: string | ||
) { | ||
const scoreAttestationVerifierFactory = await hre.ethers.getContractFactory(scoreAttestationVerifierArtifactName) | ||
return scoreAttestationVerifierFactory.attach(scoreAttestationVerifierAddress) | ||
} |