Skip to content

Commit

Permalink
feat: added oz dependencies and changed sol version
Browse files Browse the repository at this point in the history
  • Loading branch information
zxstim committed Jan 6, 2025
1 parent 5b95f95 commit e212bef
Show file tree
Hide file tree
Showing 31 changed files with 146 additions and 1,121 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:

- name: Run Forge tests
run: |
forge test -vvv
forge test -vvvv
id: test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ out/

# Dotenv file
.env


# Soldeer
/dependencies
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"solidity.compileUsingRemoteVersion": "v0.8.28+commit.7893614a"
"solidity.compileUsingRemoteVersion": "v0.8.28+commit.7893614a",
"editor.tabSize": 4
}
6 changes: 5 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
libs = ["lib", "dependencies"]

[dependencies]
forge-std = "1.9.5"
"@openzeppelin-contracts" = "5.2.0-rc.1"

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
2 changes: 2 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.2.0-rc.1/
forge-std-1.9.5/=dependencies/forge-std-1.9.5/
13 changes: 13 additions & 0 deletions soldeer.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[dependencies]]
name = "@openzeppelin-contracts"
version = "5.2.0-rc.1"
url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/5_2_0-rc_1_18-12-2024_19:26:33_contracts.zip"
checksum = "0430f56c556a4864cb2c0f28edbd497304a1e367d30dd07942778bef3a0f7a5f"
integrity = "17e24d71e2995a505f428ff1e4b514723175d8c6f7b84db6a96cfa31bc73fe23"

[[dependencies]]
name = "forge-std"
version = "1.9.5"
url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_9_5_21-12-2024_15:04:05_forge-std-1.9.zip"
checksum = "57ada736f383289db77fac4472d48f820e7c98172cf9b01681b0c37065ce043f"
integrity = "4753ffdfa0dde40878372b6a4d8e8fd1648b190b33996896c8b92f6f1680850f"
56 changes: 48 additions & 8 deletions src/BaseSlpx.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import "src/SlpxContracts/interfaces/IVETH.sol";
import "src/SlpxContracts/interfaces/snowbridge/IGateway.sol";
import "src/SlpxContracts/interfaces/snowbridge/MultiAddress.sol";

contract EthereumSlpx {
address constant gateway = 0x74bAA141B18D5D1eeF1591abf37167FbeCE23B72;
address constant slpcore = 0x74bAA141B18D5D1eeF1591abf37167FbeCE23B72;
address constant veth = 0x4Bc3263Eb5bb2Ef7Ad9aB6FB68be80E43b43801F;
uint128 constant destinationFee = 1000000;
uint32 constant paraId = 2030;
contract BaseSlpx {
address public gateway;
address public slpcore;
address public veth;
uint128 public destinationFee;
uint32 public paraId;

constructor(address _gateway) {
gateway = _gateway;
slpcore = _slpcore;
veth = _veth;
destinationFee = _destinationFee;
paraId = _paraId;
}

/*//////////////////////////////////////////////////////////////
CORE LOGIC
//////////////////////////////////////////////////////////////*/
function mint() external payable {
uint256 fee = IGateway(gateway).quoteSendTokenFee(
veth,
Expand All @@ -32,4 +44,32 @@ contract EthereumSlpx {
uint128(vethAmount)
);
}


/*//////////////////////////////////////////////////////////////
SETTERS
//////////////////////////////////////////////////////////////*/
function setGateway(address _gateway) external {
gateway = _gateway;
}


function setSlpcore(address _slpcore) external {
slpcore = _slpcore;
}


function setVeth(address _veth) external {
veth = _veth;
}


function setDestinationFee(uint128 _destinationFee) external {
destinationFee = _destinationFee;
}


function setParaId(uint32 _paraId) external {
paraId = _paraId;
}
}
24 changes: 24 additions & 0 deletions src/Gateway.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;


contract Gateway {

uint256 sendTokenFee = 1000000;

function quoteSendTokenFee(address token, uint32 paraId, uint128 destinationFee) external view returns (uint256) {
// Basic validation to use the parameters
require(token != address(0), "Invalid token address");
require(paraId > 0, "Invalid paraId");
require(destinationFee > 0, "Invalid destination fee");

// mock the fee
return sendTokenFee;
}


function setSendTokenFee(uint256 _fee) external {
sendTokenFee = _fee;
}

}
31 changes: 31 additions & 0 deletions src/LSToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.22;

import {ERC20} from "src/ERC20.sol";

contract LSToken is ERC20("LSToken", "LSToken", 18) {

address public owner;

constructor(address _owner) {
owner = _owner;
}

modifier onlyOwner() {
require(owner == msg.sender);
_;
}

function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}

function burn(address from, uint256 amount) public onlyOwner {
_burn(from, amount);
}

function setOwner(address _owner) public onlyOwner {
owner = _owner;
}
}
Loading

0 comments on commit e212bef

Please sign in to comment.