forked from PraneshASP/huff-math
-
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.
Merge pull request PraneshASP#12 from PraneshASP/feat/deployment-script
✨ Deployment scripts
- Loading branch information
Showing
10 changed files
with
82 additions
and
11 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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 | ||
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY> | ||
RPC_URL=<RPC_URL> | ||
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
node_modules | ||
.env | ||
|
||
#Hardhat files | ||
#Build files | ||
cache | ||
artifacts | ||
broadcast |
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,14 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.15; | ||
|
||
import "foundry-huff/HuffDeployer.sol"; | ||
import "forge-std/Script.sol"; | ||
|
||
import {IMath} from "../src/interfaces/IMath.sol"; | ||
|
||
contract DeployMath is Script { | ||
function run() public returns (IMath math) { | ||
math = IMath(HuffDeployer.broadcast("wrappers/MathWrapper")); | ||
console2.log("MathWrapper contract deployed to: ", address(math)); | ||
} | ||
} |
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,19 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.15; | ||
|
||
import "foundry-huff/HuffDeployer.sol"; | ||
import "forge-std/Script.sol"; | ||
|
||
import {IWadRayMath} from "../src/interfaces/IWadRayMath.sol"; | ||
|
||
contract DeployWadRayMath is Script { | ||
function run() public returns (IWadRayMath wadRayMath) { | ||
wadRayMath = IWadRayMath( | ||
HuffDeployer.broadcast("wrappers/WadMathWrapper") | ||
); | ||
console2.log( | ||
"WadRayMathWrapper contract deployed to: ", | ||
address(wadRayMath) | ||
); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
test/foundry/wrappers/MathWrapper.huff → src/wrappers/MathWrapper.huff
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
2 changes: 1 addition & 1 deletion
2
test/foundry/wrappers/WadRayMathWrapper.huff → src/wrappers/WadRayMathWrapper.huff
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,39 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Test.sol"; | ||
import {HuffDeployer} from "foundry-huff/HuffDeployer.sol"; | ||
import {IMath} from "../../src/interfaces/IMath.sol"; | ||
|
||
contract MathForkTest is Test { | ||
IMath public math; | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.envString("RPC_URL")); | ||
math = IMath(0x999581D8C0BADA05502945fF3e490f41aE9e4102); | ||
} | ||
|
||
function testAddNumbers() public { | ||
uint256 result = math.addNumbers(420, 69); | ||
assertEq(result, 489); | ||
} | ||
|
||
function testSubNumbers() public { | ||
uint256 result = math.subNumbers(420, 69); | ||
assertEq(result, 351); | ||
} | ||
|
||
function testMultiplyNumbers() public { | ||
uint256 result = math.multiplyNumbers(100, 69); | ||
assertEq(result, 6900); | ||
} | ||
|
||
function testDivideNumbers() public { | ||
uint256 result = math.divideNumbers(200, 10); | ||
assertEq(result, 20); | ||
} | ||
|
||
function testAbs() public view { | ||
require(math.abs(1, 10) == 9); | ||
} | ||
} |
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