forked from RafaelAPB/blockchain-integration-framework
-
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.
build(besu-all-in-one): update besu image version
* todo: check bungee-hermes besu-test-basic and ethereum-test-basic tests * added new satp contracts Signed-off-by: eduv09 <eduardovasques10@tecnico.ulisboa.pt>
- Loading branch information
Showing
9 changed files
with
43,359 additions
and
45 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
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
21,528 changes: 21,528 additions & 0 deletions
21,528
...s-plugin-bungee-hermes/src/test/typescript/solidity/lock-asset-contract/SATPContract.json
Large diffs are not rendered by default.
Oops, something went wrong.
21,436 changes: 21,436 additions & 0 deletions
21,436
...n-bungee-hermes/src/test/typescript/solidity/lock-asset-contract/SATPWrapperContract.json
Large diffs are not rendered by default.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...ungee-hermes/src/test/typescript/solidity/lock-asset-contract/satp-contract-interface.sol
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,18 @@ | ||
// SPDX-License-Identifier: UNKNOWN | ||
|
||
pragma solidity >=0.7.0; | ||
|
||
/* | ||
* Smart Contract Interface to define the methods needed by SATP Wrapper Contract. | ||
*/ | ||
|
||
interface SATPContractInterface { | ||
// mint creates new tokens with the given amount and assigns them to the owner. | ||
function mint(address account, uint256 amount) external returns (bool); | ||
// burn destroys the given amount of tokens from the owner. | ||
function burn(address account, uint256 amount) external returns (bool); | ||
// assign assigns the given amount of tokens from the owner to the target, without approval. | ||
function assign(address from, address recipient, uint256 amount) external returns (bool); | ||
// transfer transfers the given amount of tokens from the sender to the target, with approval needed. | ||
function transfer(address from, address recipient, uint256 amount) external returns (bool); | ||
} |
87 changes: 87 additions & 0 deletions
87
...ctus-plugin-bungee-hermes/src/test/typescript/solidity/lock-asset-contract/satp-erc20.sol
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,87 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity ^0.8.15; | ||
|
||
import "@openzeppelin/contracts/access/AccessControl.sol"; | ||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import "@openzeppelin/contracts/utils/Strings.sol"; | ||
import "./ITraceableContract.sol"; | ||
|
||
import "hardhat/console.sol"; | ||
import "./satp-contract-interface.sol"; | ||
|
||
|
||
contract SATPContract is AccessControl, ERC20, ITraceableContract, SATPContractInterface { | ||
|
||
bytes32 public constant BRIDGE_ROLE = keccak256("BRIDGE_ROLE"); | ||
bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE"); | ||
|
||
string public id; | ||
|
||
mapping (string => uint256) public balanceOf; | ||
|
||
constructor(address _owner, string memory _id) ERC20("SATPToken", "SATP") { | ||
_grantRole(OWNER_ROLE, _owner); | ||
_grantRole(BRIDGE_ROLE, _owner); | ||
|
||
id = _id; | ||
string[] memory t = new string[](1); | ||
t[0] = "atoa"; | ||
emit Changed(id, t); | ||
} | ||
|
||
function mint(address account, uint256 amount) external onlyRole(BRIDGE_ROLE) returns (bool success) { | ||
console.log("Mint to: %s\n amount: %s", account, amount); | ||
_mint(account, amount); | ||
string[] memory t = new string[](1); | ||
t[0] = "atoa"; | ||
emit Changed(id, t); | ||
return true; | ||
} | ||
|
||
function burn(address account, uint256 amount) external onlyRole(BRIDGE_ROLE) returns (bool success) { | ||
console.log("Burn from: %s\n amount: %s", account, amount); | ||
_burn(account, amount); | ||
string[] memory t = new string[](1); | ||
t[0] = "atoa"; | ||
emit Changed(id, t); | ||
return true; | ||
} | ||
|
||
function assign(address from, address recipient, uint256 amount) external onlyRole(BRIDGE_ROLE) returns (bool success) { | ||
console.log("Assing from: %s\n to: %s \n amount: %s", from, recipient, amount); | ||
require(from == _msgSender(), "The msgSender is not the owner"); | ||
_transfer(from, recipient, amount); | ||
string[] memory t = new string[](1); | ||
t[0] = "atoa"; | ||
emit Changed(id, t); | ||
return true; | ||
} | ||
|
||
function transfer(address from, address recipient, uint256 amount) external onlyRole(BRIDGE_ROLE) returns (bool success) { | ||
console.log("transfer from: %s\n to: %s \n amount: %s", from, recipient, amount); | ||
transferFrom(from, recipient, amount); | ||
string[] memory t = new string[](1); | ||
t[0] = "atoa"; | ||
emit Changed(id, t); | ||
return true; | ||
} | ||
|
||
function getAllAssetsIDs() external view returns (string[] memory) { | ||
string[] memory myArray = new string[](1); | ||
myArray[0] = id; | ||
return myArray; | ||
} | ||
|
||
function getId() view public returns (string memory) { | ||
return id; | ||
} | ||
|
||
function giveRole(address account) external onlyRole(OWNER_ROLE) returns (bool success) { | ||
_grantRole(BRIDGE_ROLE, account); | ||
string[] memory t = new string[](1); | ||
t[0] = "atoa"; | ||
emit Changed(id, t); | ||
return true; | ||
} | ||
} |
Oops, something went wrong.