Skip to content

Commit

Permalink
fix-chainid-hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyewwww committed Jan 9, 2024
1 parent ad9d148 commit 93190ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
22 changes: 14 additions & 8 deletions contracts/GasSavingPool/impl/GSP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,31 @@ contract GSP is GSPTrader, GSPFunding {
symbol = "GLP";
// decimals of the shares is the same as the base token decimals
decimals = IERC20Metadata(baseTokenAddress).decimals();
}

// ============================== Permit ====================================
/**
* @notice DOMAIN_SEPARATOR is used for approve by signature
*/
function buildDomainSeparator() public returns (bytes32){
string memory connect = "_";
string memory suffix = "GSP";
// name of the shares is the combination of suffix, connect and string of the GSP
string memory name = string(abi.encodePacked(suffix, connect, addressToShortString(address(this))));

// ============================== Permit ====================================
uint256 chainId;
assembly {
chainId := chainid()
}
// DOMAIN_SEPARATOR is used for approve by signature
DOMAIN_SEPARATOR = keccak256(
abi.encode(
// keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
block.chainid,
address(this)
)
);
// ==========================================================================
return DOMAIN_SEPARATOR;
}

/**
* @notice Convert the address to a shorter string
* @param _addr The address to convert
Expand Down
1 change: 1 addition & 0 deletions git
Submodule git added at a54a84

0 comments on commit 93190ea

Please sign in to comment.