-
Notifications
You must be signed in to change notification settings - Fork 1
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
3a746d0
commit 87ecc46
Showing
12 changed files
with
29,728 additions
and
8,819 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"address":"e643cf465ede9ad11e152bab8d3cdc6cbc3712e1","id":"a09f0a2d-99bf-458e-b40a-0fb98134efac","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"c5c3fed84464e03f84382a2c6aff2c35"},"ciphertext":"0a39b278309b79ce2296279dd7eae70d878503d22152034f4e1dc63c4780dee1","kdf":"scrypt","kdfparams":{"salt":"8321bc95b52e5243400ab6c08fabcb68f87c97eb041f8087077d47014a003b2b","n":131072,"dklen":32,"p":1,"r":8},"mac":"3f6506991f105be873ef67433e1d4ad76ed4dc8f64990da752c33a96f2aa3202"},"x-ethers":{"client":"ethers.js","gethFilename":"UTC--2023-02-17T05-04-42.0Z--e643cf465ede9ad11e152bab8d3cdc6cbc3712e1","mnemonicCounter":"4046aa91b7178af4ede1f5a69aacd7df","mnemonicCiphertext":"145d31966fcd437f1705de254ce8c840","path":"m/44'/60'/0'/0/0","locale":"en","version":"0.1"}} |
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,20 @@ | ||
import { ethers, accounts } from "hardhat"; | ||
|
||
async function main() { | ||
// We get the contract to deploy | ||
const signer = await accounts.getSigners(); | ||
const USDT = await ethers.getContractFactory("USDT", signer[0]); | ||
|
||
const usdt = await USDT.deploy("USDT", "USDT"); | ||
|
||
await usdt.deployed(); | ||
|
||
console.log("USDT deployed to:", usdt.address); | ||
} | ||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
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,65 @@ | ||
import { Framework } from "@superfluid-finance/sdk-core"; | ||
import { ethers } from "ethers"; | ||
export async function createNewFlow( | ||
recipient: any, | ||
flowRate: any, | ||
provider: any, | ||
tokenName: string | ||
) { | ||
const chainId = await provider | ||
.getNetwork() | ||
.then((network: any) => network.chainId); | ||
|
||
const sf = await Framework.create({ | ||
chainId: Number(chainId), | ||
provider: provider, | ||
}); | ||
|
||
const signer = provider.getSigner(); | ||
|
||
const superSigner = sf.createSigner({ signer: signer }); | ||
|
||
const token = await sf.loadSuperToken(tokenName); | ||
|
||
console.log(token); | ||
|
||
try { | ||
const createFlowOperation = token.createFlow({ | ||
sender: await superSigner.getAddress(), | ||
receiver: recipient, | ||
flowRate: flowRate, | ||
// userData?: string | ||
}); | ||
|
||
console.log(createFlowOperation); | ||
console.log("Creating your stream..."); | ||
|
||
const result = await createFlowOperation.exec(superSigner); | ||
console.log(result); | ||
|
||
console.log( | ||
`Congrats - you've just created a money stream! | ||
` | ||
); | ||
} catch (error) { | ||
console.log( | ||
"Hmmm, your transaction threw an error. Make sure that this stream does not already exist, and that you've entered a valid Ethereum address!" | ||
); | ||
console.error(error); | ||
} | ||
} | ||
|
||
function calculateFlowRate(amount: number) { | ||
if (typeof Number(amount) !== "number" || isNaN(Number(amount)) === true) { | ||
alert("You can only calculate a flowRate based on a number"); | ||
return; | ||
} else if (typeof Number(amount) === "number") { | ||
if (Number(amount) === 0) { | ||
return 0; | ||
} | ||
const amountInWei = ethers.BigNumber.from(amount); | ||
const monthlyAmount: any = ethers.utils.formatEther(amountInWei.toString()); | ||
const calculatedFlowRate = monthlyAmount * 3600 * 24 * 30; | ||
return calculatedFlowRate; | ||
} | ||
} |
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 @@ | ||
export const address = "0xeA7a60bC7E14908b69489394dfc322F7E9d16918"; |
Oops, something went wrong.