https://github.com/btc415/eventwinner
The EventWinner project is a Solidity smart contract that demonstrates external contract interaction on the Ethereum blockchain.
https://github.com/btc415/eventwinner
ethersjs hardhat solidity stackoverflow stackoverflow-answer typescript
Last synced: 9 months ago
JSON representation
The EventWinner project is a Solidity smart contract that demonstrates external contract interaction on the Ethereum blockchain.
- Host: GitHub
- URL: https://github.com/btc415/eventwinner
- Owner: BTC415
- License: mit
- Created: 2024-11-29T18:13:28.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-29T20:39:58.000Z (about 1 year ago)
- Last Synced: 2025-03-24T10:22:45.310Z (10 months ago)
- Topics: ethersjs, hardhat, solidity, stackoverflow, stackoverflow-answer, typescript
- Language: TypeScript
- Homepage:
- Size: 74.2 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EventWinner Smart Contract
A Solidity smart contract implementation that demonstrates external contract interaction on the Ethereum blockchain.
This is the answer to stackoverflow question: [Error: cannot estimate gas; transaction may fail or may require manual gas limit (Sepolia test Network)
](https://stackoverflow.com/questions/79231971/error-cannot-estimate-gas-transaction-may-fail-or-may-require-manual-gas-limit)
## Overview
The EventWinner project showcases a smart contract that can interact with other contracts through their interfaces. It implements a pattern for making external calls to contracts that expose an `attempt()` function.
## Technical Stack
- Solidity ^0.8.27
- Hardhat
- TypeScript
- Ethers.js
## Contract Architecture
### EventWinner.sol
The main contract contains:
- Interface definition for target contracts
- External function to interact with other contracts
- Low-level call implementation for robust contract interaction
### Key Features
- External contract interaction
- Interface-based calling
- Gas-efficient implementation
- Error handling
## Usage
The contract can be used to interact with any contract that implements the `attempt()` function:
```bash
// Get contract instance
const eventWinner = await EventWinner.deploy();
// Call target contract
await eventWinner.callWinner(targetContractAddress);
```
## Development
1. Clone the repository
```bash
git clone https://github.com/BTC415/EventWinner.git
```
2. Install dependencies:
```bash
npm install
```
3. Compile contracts:
```bash
npx hardhat compile
```
4. Run deployment script:
```bash
npx hardhat run scripts/deploy.ts --network sepolia
```
## Network support
- Sepolia
- Local hardhat Network
## License
This project is licensed under the MIT License.