-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
2,413 additions
and
1,413 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ethers } from 'ethers'; | ||
|
||
import ChickenLauncherAbi from './abi/ChickenLauncher.json'; | ||
|
||
const LAUNCHER_CONTRACT_ADDRESS = '0x4db097b90530f111e88325e514c9a0d59392db9e'; | ||
|
||
export class ChickenLauncher { | ||
rpcUrl: string; | ||
wallet: ethers.Wallet; | ||
provider: ethers.JsonRpcProvider; | ||
contract: ethers.Contract; | ||
|
||
constructor(rpcUrl: string, wallet: ethers.Wallet, provider: ethers.JsonRpcProvider) { | ||
this.rpcUrl = rpcUrl; | ||
this.wallet = wallet; | ||
this.provider = provider; | ||
this.contract = new ethers.Contract(LAUNCHER_CONTRACT_ADDRESS, ChickenLauncherAbi, wallet); | ||
} | ||
|
||
async launch( | ||
tokenName: string, | ||
tokenSymbol: string, | ||
initialMint: number, | ||
initialOwner: string, | ||
supplyCap: number, | ||
): Promise<void> { | ||
const initialMintWei = ethers.parseUnits(initialMint.toString(), 18); | ||
const supplyCapWei = ethers.parseUnits(supplyCap.toString(), 18); | ||
const tx = await this.contract.launch(tokenName, tokenSymbol, initialMintWei, initialOwner, supplyCapWei); | ||
console.log(`Transaction hash: ${tx.hash}`); | ||
} | ||
} |
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,51 @@ | ||
import { ethers } from 'ethers'; | ||
|
||
import ChickenPoolAbi from './abi/PlayChicken.json'; | ||
|
||
const CHICKEN_POOL_ADDRESS = '0x9ee040266605a8b0b65d859cfa6e2b7d5f34c163'; | ||
|
||
export class ChickenPool { | ||
rpcUrl: string; | ||
wallet: ethers.Wallet; | ||
provider: ethers.JsonRpcProvider; | ||
contract: ethers.Contract; | ||
|
||
constructor(rpcUrl: string, wallet: ethers.Wallet, provider: ethers.JsonRpcProvider) { | ||
this.rpcUrl = rpcUrl; | ||
this.wallet = wallet; | ||
this.provider = provider; | ||
this.contract = new ethers.Contract(CHICKEN_POOL_ADDRESS, ChickenPoolAbi, wallet); | ||
} | ||
|
||
// function start(address _token, uint256 _buyIn, uint256 _slashingPercent) external whenNotPaused nonReentrant { | ||
async start(token: string, buyIn: number, slashingPercent: number): Promise<void> { | ||
const buyInInWei = ethers.parseEther(buyIn.toString()); | ||
const tx = await this.contract.start(token, buyInInWei, slashingPercent); | ||
console.log(`Transaction hash: ${tx.hash}`); | ||
} | ||
|
||
async join(poolId: number, deposit: number): Promise<void> { | ||
const depositWei = ethers.parseEther(deposit.toString()); | ||
const tx = await this.contract.join(poolId, depositWei); | ||
console.log(`Transaction hash: ${tx.hash}`); | ||
} | ||
|
||
async withdraw(poolId: number): Promise<void> { | ||
const tx = await this.contract.withdraw(poolId); | ||
console.log(`Transaction hash: ${tx.hash}`); | ||
} | ||
|
||
async claim(poolId: number): Promise<void> { | ||
const tx = await this.contract.claim(poolId); | ||
console.log(`Transaction hash: ${tx.hash}`); | ||
} | ||
|
||
async withdrawProtocolFee(poolId: number): Promise<void> { | ||
const tx = await this.contract.withdrawProtocolFee(poolId); | ||
console.log(`Transaction hash: ${tx.hash}`); | ||
} | ||
|
||
getAddress(): string { | ||
return CHICKEN_POOL_ADDRESS; | ||
} | ||
} |
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
Oops, something went wrong.