Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions contracts/TestCondition.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface StubIERC20 {
function transfer(address to, uint256 amount) external returns (bool);
}

contract TestCondition {

event Transfer(TransferInfo transferInfo, bytes data);

struct TransferInfo {
StubIERC20 token;
address receiver;
uint256 amount;
}

function transfer(TransferInfo calldata transferInfo, bytes calldata data) external {
emit Transfer(transferInfo, data);
}
}
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
settings: {
optimizer: {
enabled: true,
runs: 1000,
runs: 200,
},
},
},
Expand Down
21 changes: 21 additions & 0 deletions scripts/deploy/TestCondition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ethers } from "hardhat"
import { getDeployer } from "../utils"

async function main() {
const deployer = getDeployer()

// Deploying TestCondition
console.log("Deploying TestCondition...")
const TestCondition = await (
await ethers.getContractFactory("TestCondition", deployer)
).deploy()
await TestCondition.deployTransaction.wait()
console.log(`TestCondition contract address: ${TestCondition.address}`)
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
42 changes: 42 additions & 0 deletions scripts/testCondition/transfer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ethers } from "hardhat"
import { default as prompts } from "prompts"
import { getDeployer, testConditionAddr } from "../utils"

async function main() {
const deployer = await getDeployer()
const TestCondition = await ethers.getContractAt("TestCondition", testConditionAddr)

// const promptErrandParamResult = await prompts(
// {
// type: "number",
// name: "errandParam",
// message: "important param",
// },
// {
// onCancel: async function () {
// console.log("Exit process")
// process.exit(0)
// },
// },
// )
// const newErrandParam = promptErrandParamResult.errandParam

const tx = await TestCondition.connect(deployer).transfer(
["0x000000000000000000000000000000000000beef", "0x000000000000000000000000000000000000abcd", 10],
"0x1234"
)
console.log(`transfer tx sent: ${tx.hash}`)
await tx.wait()

// const paramStored = await TestCondition.callStatic.errandParam()
// if (paramStored != newErrandParam) {
// throw new Error(`Wrong errandParam: ${paramStored}`)
// }
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
4 changes: 3 additions & 1 deletion scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@ export const upgradeProxyImplementationAddr = "0x1E0D76E9556a8089cdb382243610437

export const oneRoleAccessControlAddr = "0x4Ed59b1E11E1460f4Ff5c5ae2895d7bd7c93E713"

export const oneRoleAccessControlWithTimeLockAddr = "0x0d975AEB0ee9EFd0682A303987aF2018e2917189"
export const oneRoleAccessControlWithTimeLockAddr = "0x0d975AEB0ee9EFd0682A303987aF2018e2917189"

export const testConditionAddr = "0xddD10b48CE74a0640725b24775a3CE4EC7549A62"