Skip to content

Commit

Permalink
Update simpleoffchainverifier to an account with eth
Browse files Browse the repository at this point in the history
  • Loading branch information
chcharcharlie committed Feb 6, 2024
1 parent 20a6e46 commit 4b68383
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion deploy/001_deploy_simple_erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await deploy('SimpleERC20', {
from: deployer,
args: [simpleOffchainVerifier, parseEther('1000000000')],
args: [deployer, parseEther('1000000000')],
log: true,
autoMine: true, // speed up deployment on local network (ganache, hardhat), no effect on live networks
});
Expand Down
2 changes: 1 addition & 1 deletion deploy/002_deploy_deramp_vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
await deploy('DeRampVault', {
from: deployer,
proxy: useProxy && {
owner: deployer,
owner: simpleOffchainVerifier,
proxyContract: 'UUPS',

execute: {
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const config: HardhatUserConfig = {
onRamper: 2,
offRamper: 3,
simpleOffchainVerifier: {
default: 4,
default: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
sepolia: '0x36e7Fda8CC503D5Ec7729A42eb86EF02Af315Bf9'
},

Expand Down
4 changes: 2 additions & 2 deletions scripts/getBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ async function main() {
console.log('deramp balance: ', supp2);
*/

const { owner, simpleOffchainVerifier, offRamper, onRamper } = await getNamedAccounts();
const { deployer, simpleOffchainVerifier, offRamper, onRamper } = await getNamedAccounts();
const SimpleERC20Factory = await deployments.get('SimpleERC20');
const DeRampVault = await deployments.get('DeRampVault');

const benefactor = await ethers.getSigner(simpleOffchainVerifier);
const benefactor = await ethers.getSigner(deployer);
const bobby = await ethers.getSigner(offRamper);
const alice = await ethers.getSigner(onRamper);

Expand Down
11 changes: 6 additions & 5 deletions scripts/onramp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ async function main() {
const benefactor = await ethers.getSigner(simpleERC20Beneficiary);
const bob = await ethers.getSigner(offRamper);
const alice = await ethers.getSigner(onRamper);
const backend = await ethers.getSigner(simpleOffchainVerifier);
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
const backendWallet = new ethers.Wallet("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", provider);
// const backend = await ethers.getSigner(simpleOffchainVerifier);

console.log("offramper addy: ", bob.address);
console.log("onramper addy: ", alice.address);

console.log("backend addy: ", backend.address);

console.log("backend addy: ", backendWallet.address);


const erc20Handle = await erc20imp.connect(bob).attach(erc.address);
const see = await erc20Handle.approve(DeRampVault.address, ethers.parseEther('1000000000'));
console.log("using erc20: ", erc.address);
const MyContract2 = await ethers.getContractFactory('DeRampVault');
const DeRampHandle = await MyContract2.connect(backend).attach(DeRampVault.address);
const DeRampHandle = await MyContract2.connect(backendWallet).attach(DeRampVault.address);
//const supp2 = await DeRampHandle.deposit(ethers.parseEther(".05"), bob.address);
const supp2 = await DeRampHandle.onramp(100, bob.address, alice.address);
const supp2 = await DeRampHandle.onramp(10, bob.address, alice.address);

}

Expand Down
6 changes: 3 additions & 3 deletions scripts/transferERC20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const account = args[0];
const message = args[1];

async function main() {
const { owner, simpleOffchainVerifier, offRamper } = await getNamedAccounts();
const benefactor = await ethers.getSigner(simpleOffchainVerifier);
const { deployer, simpleOffchainVerifier, offRamper } = await getNamedAccounts();
const benefactor = await ethers.getSigner(deployer);
const bob = await ethers.getSigner(offRamper);

console.log('simpleERC20Beneficiary: ', simpleOffchainVerifier);
console.log('simpleERC20Beneficiary: ', deployer);
console.log('bob.address: ', bob.address);

const erc20Deployment = await deployments.get('SimpleERC20');
Expand Down
10 changes: 5 additions & 5 deletions scripts/withdrawDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const account = args[0];
const message = args[1];

async function main() {
const { owner, simpleERC20Beneficiary, offRamper } = await getNamedAccounts();
const benefactor = await ethers.getSigner(simpleERC20Beneficiary);
const { owner, simpleERC20Beneficiary, offRamper, simpleOffchainVerifier } = await getNamedAccounts();
const benefactor = await ethers.getSigner(simpleOffchainVerifier);
const bob = await ethers.getSigner(offRamper);

console.log('account: ', simpleERC20Beneficiary);
console.log('account: ', simpleOffchainVerifier);
console.log('account: ', bob.address);

const DeRampVault = await deployments.get('DeRampVault');
Expand All @@ -21,8 +21,8 @@ async function main() {

const contract2 = MyContract2.attach(DeRampVault.address);

const DeRampHandle = await MyContract2.connect(bob).attach(DeRampVault.address);
const supp2 = await DeRampHandle.withdrawDeposit(1, bob.address);
const DeRampHandle = await MyContract2.connect(benefactor).attach(DeRampVault.address);
const supp2 = await DeRampHandle.withdrawDeposit(50, bob.address);
}

main()
Expand Down

0 comments on commit 4b68383

Please sign in to comment.