This commit is contained in:
fiftyeightandeight
2022-12-04 10:57:46 +08:00
committed by GitHub
parent 1bfd401c55
commit 7698a096ea
3 changed files with 6 additions and 66 deletions

View File

@@ -11,24 +11,24 @@ concurrency:
jobs:
check:
name: check - ${{ github.ref_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: sergeysova/jq-action@v2
- uses: wei/curl@v1
- name: Install Deps
run: |
cd clarity && ./scripts/clarinet_manager.sh install
- name: "Check contract"
uses: docker://hirosystems/clarinet:0.32.0
uses: docker://hirosystems/clarinet:1.1.0
with:
entrypoint: "bash"
args: -c "cd clarity && clarinet check"
test:
name: test - ${{ github.ref_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: sergeysova/jq-action@v2
- uses: wei/curl@v1
- name: Install Deps
@@ -38,7 +38,7 @@ jobs:
run: |
echo "ci_env=$(bash <(curl -s https://codecov.io/env))" >> $GITHUB_ENV
- name: "Execute test suite"
uses: docker://hirosystems/clarinet:0.32.0
uses: docker://hirosystems/clarinet:1.1.0
with:
entrypoint: "bash"
#args: -c "cd clarity && clarinet test --coverage && curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov && ./codecov -t ${{ secrets.CODECOV_TOKEN }} -f coverage.lcov"

View File

@@ -7,9 +7,6 @@ contract_id = "ST287GF5M9WEJ6BXEN7NPN1WGA95YWXWBE0ZRK6X.Wrapped-USD"
[[project.requirements]]
contract_id = "SP2TZK01NKDC89J6TA56SA47SDF7RTHYEQ79AAB9A.Wrapped-USD"
[project.cache_location]
path = "./.cache/.requirements"
[repl]
costs_version = 2

View File

@@ -1,57 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract Ownable {
address private _owner;
constructor()
{
_owner = msg.sender;
}
function owner() public view returns(address)
{
return _owner;
}
modifier only_owner()
{
require(check_is_owner(),
"Error: Unauthorized access");
_;
}
function check_is_owner() public view returns(bool)
{
return msg.sender == _owner;
}
}
contract TokenTransfer is Ownable {
using SafeERC20 for IERC20;
IERC20 _token;
mapping(address => bool) private _approved_recipients;
constructor(address token) {
_token = IERC20(token);
}
event SettleInfoEvent(string settle);
function set_approved_recipient (address recipient, bool approved) only_owner public {
_approved_recipients[recipient] = approved;
}
function depositTokens(address _to, uint _amount, string memory _settle) public {
require(_approved_recipients[_to] == true, "Error: Unapproved recipient");
_token.safeTransferFrom(msg.sender, _to, _amount);
emit SettleInfoEvent(_settle);
}
}